search-router について
クエリの種類に応じてコード検索方法を選ぶルーティングスキルです。コード探索では TLDR を優先し、それ以外の目的には構造検索やテキスト検索を案内します。開発者が実装、識別子、コード上の関係を探す際に、不要な出力を抑えます。
主な機能
- 01検索種別に応じた振り分け
- 02TLDR によるコード探索
- 03AST パターン検索の案内
- 04セマンティック検索の案内
- 05トークンを抑える検索手順
活用シーン
- 01シンボルや実装箇所の特定
- 02呼び出し経路やデータフローの追跡
- 03構造による関数やインポートの検索
- 04コード以外のテキストや正規表現の検索
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ parcadei/ continuous-claude-v3 --skill search-routerインストール後、Claude Code で/search-routerを入力して読み込まれたか確認します。
詳細
検索ツールルーター
各クエリの種類に最もトークン効率の高い検索ツールを使用します。
使用する場面
- コードパターンを検索する
- 何かが実装されている場所を見つける
- 特定の識別子を探す
- コードの仕組みを理解する
判断ツリー
Query Type?
├── CODE EXPLORATION (symbols, call chains, data flow)
│ → TLDR Search - 95% token savings
│ DEFAULT FOR ALL CODE SEARCH - use instead of Grep
│ Examples: "spawn_agent", "DataPoller", "redis usage"
│ Command: tldr search "query" .
│
├── STRUCTURAL (AST patterns)
│ → AST-grep (/ast-grep-find) - ~50 tokens output
│ Examples: "def foo", "class Bar", "import X", "@decorator"
│
├── SEMANTIC (conceptual questions)
│ → TLDR Semantic - 5-layer embeddings (P6)
│ Examples: "how does auth work", "find error handling patterns"
│ Command: tldr semantic search "query"
│
├── LITERAL (exact text, regex)
│ → Grep tool - LAST RESORT
│ Only when TLDR/AST-grep don't apply
│ Examples: error messages, config values, non-code text
│
└── FULL CONTEXT (need complete understanding)
→ Read tool - 1500+ tokens
Last resort after finding the right file
トークン効率の比較
| ツール | 出力サイズ | 最適な用途 |
|---|---|---|
| TLDR | ~50-500 | デフォルト:コードシンボル、呼び出しグラフ、データフロー |
| TLDR Semantic | ~100-300 | 概念的なクエリ(P6、埋め込みベース) |
| AST-grep | ~50 tokens | 関数/クラス定義、インポート、デコレーター |
| Grep | ~200-2000 | 最終手段:コード以外のテキスト、正規表現 |
| Read | ~1500+ | ファイルを見つけた後の全体的な理解 |
例
# CODE EXPLORATION → TLDR (DEFAULT)
tldr search "spawn_agent" .
tldr search "redis" . --layer call_graph
# STRUCTURAL → AST-grep
/ast-grep-find "async def $FUNC($$$):" --lang python
# SEMANTIC → TLDR Semantic
tldr semantic search "how does authentication work"
# LITERAL → Grep (LAST RESORT - prefer TLDR)
Grep pattern="check_evocation" path=opc/scripts
# FULL CONTEXT → Read (after finding file)
Read file_path=opc/scripts/z3_erotetic.py
最適な流れ
1. AST-grep: "Find async functions" → 3 file:line matches
2. Read: Top match only → Full understanding
3. Skip: 4 irrelevant files → 6000 tokens saved
関連スキル
/tldr-search- デフォルト - トークンを95%節約するコード探索/ast-grep-find- 構造的なコード検索/morph-search- 高速なテキスト検索
コメント
Markdown 対応