Search Router

by parcadeid07ff4b06b62No license3.9K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 8 months ago

Choose the right search tool for each query type

Instructions onlySoftware Development
AI-generated overview

Routes code search queries to the most token-efficient tool, such as TLDR, AST-grep, Grep or Read.

What it does
This skill provides a decision tree for picking a search tool based on query type, covering code exploration, structural AST patterns, semantic questions, literal text and full-context reading. It includes a token-efficiency comparison table and example commands for each tool. It produces guidance only, not search results or files.
When to use it
Use it when searching for code patterns, locating where something is implemented, finding specific identifiers, or understanding how code works. It helps choose between tools when token cost matters.
Requirements
No scripts are included; it is instructions only. The guidance references external tools and commands such as tldr search, tldr semantic search, AST-grep, Grep and Read, which must be available separately.

Search Tool Router

Use the most token-efficient search tool for each query type.

When to Use

  • Searching for code patterns
  • Finding where something is implemented
  • Looking for specific identifiers
  • Understanding how code works

Decision Tree

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

Token Efficiency Comparison

ToolOutput SizeBest For
TLDR~50-500DEFAULT: Code symbols, call graphs, data flow
TLDR Semantic~100-300Conceptual queries (P6, embedding-based)
AST-grep~50 tokensFunction/class definitions, imports, decorators
Grep~200-2000LAST RESORT: Non-code text, regex
Read~1500+Full understanding after finding the file

Examples

bash
# 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 Semantictldr 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

Optimal Flow

1. AST-grep: "Find async functions" → 3 file:line matches2. Read: Top match only → Full understanding3. Skip: 4 irrelevant files → 6000 tokens saved

Related Skills

  • /tldr-search - DEFAULT - Code exploration with 95% token savings
  • /ast-grep-find - Structural code search
  • /morph-search - Fast text search

Source and attribution

Source:parcadei/continuous-claude-v3in.claude/skills/search-routerat commitd07ff4b

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal