Search Tools

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

Search Tool Hierarchy

Instructions onlySoftware Development
AI-generated overview

Guides an agent in choosing between semantic, structural, text and literal code search tools.

What it does
This skill provides a decision tree and comparison table for selecting a code search approach: LEANN for semantic or conceptual queries, AST-grep for structural patterns, Morph for fast text search, and the built-in Grep tool for literal patterns. It lists example queries for each tool and shows LEANN command-line usage for searching, listing and rebuilding indexes. It produces guidance rather than files or code.
When to use it
Use it when an agent needs to search a codebase and must decide which search method fits the query, such as conceptual questions about how something works, structural refactoring patterns, or simple literal lookups. It is also relevant when a semantic search hook or fallback behavior needs to be understood.
Requirements
No scripts are included; it is instructions only. Following its guidance may require the LEANN tool with a built index, an AST-grep MCP server, a Morph API key, or the built-in Grep tool.

Search Tool Hierarchy

When searching code, use this decision tree:

Decision Tree

Need CONCEPTUAL/SEMANTIC search?  (how does X work, find patterns, understand architecture)  → Use LEANN (/leann-search) - embedding-based semantic search  → PreToolUse hook auto-redirects semantic Grep queries
Need to understand code STRUCTURE?  (find function calls, class usages, refactor patterns)  → Use AST-grep (/ast-grep-find)
Need to find TEXT in code?  → Use Morph (/morph-search) - 20x faster  → If no Morph API key: fall back to Grep tool
Simple one-off search?  → Use built-in Grep tool directly

Tool Comparison

ToolBest ForRequires
LEANNSemantic search: "how does caching work", "error handling patterns", conceptual queriesIndex built
AST-grepStructural patterns: "find all calls to foo()", refactoring, find usages by typeMCP server
MorphFast text search: "find files mentioning error", grep across codebaseAPI key
GrepLiteral patterns, class/function names, regexNothing (built-in)

Examples

LEANN (semantic/conceptual):

  • "how does authentication work"
  • "find error handling patterns"
  • "where is rate limiting implemented"

AST-grep (structural):

  • "Find all functions that return a Promise"
  • "Find all React components using useState"
  • "Refactor all imports of X to Y"

Morph (text search):

  • "Find all files mentioning 'authentication'"
  • "Search for TODO comments"

Grep (literal):

  • class ProviderAdapter
  • def __init__
  • Regex patterns

LEANN Commands

bash
# Search with semantic queryleann search opc-dev "how does blackboard communication work" --top-k 5
# List available indexesleann list
# Rebuild index (when code changes)leann build opc-dev --docs dir1 dir2 --no-recompute --no-compact --force

Source and attribution

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

License: No license

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

Report or request removal

Search Tools Agent Skill | SourceWeft