Code Search Selectorのロゴ

Code Search Selector

組織
MadAppGang
code-search-selector

💡 コード検索タスクで使うツールを選ぶためのセレクターです。クエリの種類に応じて、セマンティック検索(claudemem)とネイティブツール(Grep/Glob)のどちらを使うかを判断します。「Xの仕組み」「すべて検索」「監査」「調査」「アーキテクチャ」にはセマンティック検索を推奨します。

Add to TypingMind

概要

公開者MadAppGang
リポジトリclaude-code
スキル名code-search-selector
スター
281
フォーク
26
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    MadAppGangがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Code Search Selector」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/MadAppGang/claude-code/tree/main/plugins/code-analysis/skills/code-search-selector
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MadAppGang/claude-code.git /tmp/claude-code
mkdir -p .claude/skills
cp -r /tmp/claude-code/plugins/code-analysis/skills/code-search-selector .claude/skills/code-search-selector
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでCode Search Selectorを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にCode Search Selectorを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Code Search Selectorは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Code Search Tool Selector

This skill helps choose the most effective search tool for your task.

When Semantic Search Works Better

Claudemem provides better results for conceptual queries:

Query TypeExampleRecommended Tool
"How does X work?""How does authentication work?"claudemem search
Find implementations"Find all API endpoints"claudemem search
Architecture questions"Map the service layer"claudemem --agent map
Trace data flow"How does user data flow?"claudemem search
Audit integrations"Audit Prime API usage"claudemem search

When Native Tools Work Better

Query TypeExampleRecommended Tool
Exact string match"Find 'DEPRECATED_FLAG'"Grep
Count occurrences"How many TODO comments?"Grep -c
Specific symbol"Find class UserService"Grep
File patterns"Find all *.config.ts"Glob

Why Semantic Search is Often More Efficient

Token Efficiency: Reading 5 files costs ~5000 tokens; claudemem search costs ~500 tokens with ranked results.

Context Discovery: Claudemem finds related code you didn't know to ask for.

Ranking: Results sorted by relevance and PageRank, so important code comes first.

Example: Semantic Query

User asks: "How does authentication work?"

Less effective approach:

bash
grep -r "auth" src/
# Result: 500 lines of noise, hard to understand

More effective approach:

bash
claudemem status  # Check if indexed
claudemem search "authentication login flow JWT"
# Result: Top 10 semantically relevant code chunks, ranked

Quick Decision Guide

Classify the Task

User RequestCategoryRecommended Tool
"Find all X", "How does X work"Semanticclaudemem search
"Audit X integration", "Map data flow"Semanticclaudemem search
"Understand architecture", "Trace X"Semanticclaudemem map
"Find exact string 'foo'"Exact MatchGrep
"Count occurrences of X"Exact MatchGrep
"Find symbol UserService"Exact MatchGrep

Step 2: Check claudemem Status (MANDATORY for Semantic)

bash
# ALWAYS run this before semantic search
claudemem status

Interpret the output:

StatusWhat It MeansNext Action
Shows chunk count (e.g., "938 chunks")✅ IndexedUSE CLAUDEMEM (Step 3)
"No index found"❌ Not indexedOffer to index (Step 2b)
"command not found"❌ Not installedFall back to Detective agent

Step 2b: If Not Indexed, Offer to Index

typescript
AskUserQuestion({
  questions: [{
    question: "Claudemem is not indexed. Index now for better semantic search results?",
    header: "Index?",
    multiSelect: false,
    options: [
      { label: "Yes, index now (Recommended)", description: "Takes 1-2 minutes, enables semantic search" },
      { label: "No, use grep instead", description: "Faster but less accurate for semantic queries" }
    ]
  }]
})

If user says yes:

bash
claudemem index -y

Step 3: Execute the Search

IF CLAUDEMEM IS INDEXED (from Step 2):

bash
# Get role-specific guidance first
claudemem ai developer  # or architect, tester, debugger

# Then search semantically
claudemem search "authentication login JWT token validation" -n 15

IF CLAUDEMEM IS NOT AVAILABLE:

Use the detective agent:

typescript
Task({
  subagent_type: "code-analysis:detective",
  description: "Investigate [topic]",
  prompt: "Use semantic search to find..."
})

Tool Recommendations by Use Case

Use CaseLess EfficientMore Efficient
Semantic queriesgrep -r "pattern" src/claudemem search "concept"
Find implementationsGlob → Read allclaudemem search "feature"
Understand flowfind . -name "*.ts" | xargs...claudemem --agent map

Native tools (Grep, Glob, find) work well for exact matches but provide no semantic ranking.


When Hooks Redirect to Claudemem

If a hook provides claudemem results instead of native tool output:

  1. Use the provided results - They're ranked by relevance
  2. For more data - Run additional claudemem queries
  3. Bypass available - Use _bypass_claudemem: true for native tools when needed

The hook system provides claudemem results proactively when the index is available.


Task-to-Tool Mapping Reference

User RequestNative ApproachSemantic Approach (Recommended)
"Audit all API endpoints"grep -r "router|endpoint"claudemem search "API endpoint route handler"
"How does auth work?"grep -r "auth|login"claudemem search "authentication login flow"
"Find all database queries"grep -r "prisma|query"claudemem search "database query SQL prisma"
"Map the data flow"grep -r "transform|map"claudemem search "data transformation pipeline"
"What's the architecture?"ls -la src/claudemem --agent map "architecture"
"Find error handling"grep -r "catch|error"claudemem search "error handling exception"
"Trace user creation"grep -r "createUser"claudemem search "user creation registration"

When Grep IS Appropriate

✅ Use Grep for:

  • Finding exact string: grep -r "DEPRECATED_FLAG" src/
  • Counting occurrences: grep -c "import React" src/**/*.tsx
  • Finding specific symbol: grep -r "class UserService" src/
  • Regex patterns: grep -r "TODO:\|FIXME:" src/

❌ Never use Grep for:

  • Understanding how something works
  • Finding implementations by concept
  • Architecture analysis
  • Tracing data flow
  • Auditing integrations

Integration with Detective Skills

After using this skill's decision tree, invoke the appropriate detective:

Investigation TypeDetective Skill
Architecture patternscode-analysis:architect-detective
Implementation detailscode-analysis:developer-detective
Test coveragecode-analysis:tester-detective
Bug root causecode-analysis:debugger-detective
Comprehensive auditcode-analysis:ultrathink-detective

Quick Reference Card

┌─────────────────────────────────────────────────────────────────┐
│                    CODE SEARCH QUICK REFERENCE                   │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  1. ALWAYS check first:  claudemem status                       │
│                                                                  │
│  2. If indexed:          claudemem search "semantic query"       │
│                                                                  │
│  3. For exact matches:   Grep tool (only this case!)            │
│                                                                  │
│  4. For deep analysis:   Task(code-analysis:detective)          │
│                                                                  │
│  ⚠️ GREP IS FOR EXACT MATCHES, NOT SEMANTIC UNDERSTANDING       │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Pre-Investigation Checklist

Before ANY code investigation task, verify:

  • Ran claudemem status to check index
  • Classified task as SEMANTIC or EXACT MATCH
  • Selected appropriate tool based on classification
  • NOT using grep for semantic queries when claudemem is indexed

Multi-File Read Optimization

When reading multiple files, consider if a semantic search would be more efficient:

ScenarioOptimization
Read 3+ files in same directoryTry claudemem search first
Glob with broad patternsTry claudemem --agent map
Sequential reads to "understand"One semantic query may suffice

Quick check before bulk reads:

  1. Is claudemem indexed? (claudemem status)
  2. Can this be one semantic query instead of N file reads?

Interception Examples

❌ About to do:

Read src/services/auth/login.ts
Read src/services/auth/session.ts
Read src/services/auth/jwt.ts
Read src/services/auth/middleware.ts
Read src/services/auth/types.ts
Read src/services/auth/utils.ts

✅ Do instead:

bash
claudemem search "authentication login session JWT middleware" -n 15

❌ About to do:

Glob pattern: src/services/prime/**/*.ts
Then read all 12 matches sequentially

✅ Do instead:

bash
claudemem search "Prime API integration service endpoints" -n 20

❌ Parallelization trap:

"Let me Read these 5 files while the detective agent works..."

✅ Do instead:

Trust the detective agent to use claudemem.
Don't duplicate work with inferior Read/Glob.

Efficiency Comparison

ApproachToken CostResult Quality
Read 5+ files sequentially~5000 tokensNo ranking
Glob → Read all matches~3000+ tokensNo semantic understanding
claudemem search once~500 tokensRanked by relevance

Tip: Claudemem results include context around matches, so you often don't need to read full files.


Recommended Workflow

  1. Check index: claudemem status
  2. Search semantically: claudemem search "concept query" -n 15
  3. Read specific code: Use results to target file:line reads

This workflow finds relevant code faster than reading files sequentially.


Maintained by: MadAppGang Plugin: code-analysis v2.16.0 Purpose: Help choose the most efficient search tool for each task

よくある質問

AIスキル「Code Search Selector」では何ができますか?

💡 コード検索タスクで使うツールを選ぶためのセレクターです。クエリの種類に応じて、セマンティック検索(claudemem)とネイティブツール(Grep/Glob)のどちらを使うかを判断します。「Xの仕組み」「すべて検索」「監査」「調査」「アーキテクチャ」にはセマンティック検索を推奨します。

TypingMindでCode Search Selectorを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Code Search Selectorはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにCode Search Selectorをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/MadAppGang/claude-code/tree/main/plugins/code-analysis/skills/code-search-selectorを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Code Search Selectorを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Code Search Selectorで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもCode Search Selectorを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Code Search Selector」は無料ですか?

はい。MadAppGangがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇