Search Tools

作者 parcadeid07ff4b06b62無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫8 個月前更新

Search Tool Hierarchy

AI 產生的概覽

指導代理在語意、結構、文字與字面程式碼搜尋工具之間做選擇。

功能
此技能提供決策樹與比較表,用來選擇程式碼搜尋方式:LEANN 用於語意或概念查詢,AST-grep 用於結構模式,Morph 用於快速文字搜尋,內建 Grep 工具則用於字面模式。它列出每種工具的範例查詢,並展示 LEANN 命令列在搜尋、列出與重建索引方面的用法。它產出的是指引,而不是檔案或程式碼。
適用情境
當代理需要搜尋程式碼庫,且必須判斷哪種搜尋方式適合當前查詢時使用,例如關於某功能如何運作的概念性問題、結構性重構模式或簡單的字面查找。在需要理解語意搜尋鉤子或回退行為時也適用。
執行需求
不含指令碼,僅為說明性指示。依其指引操作可能需要 LEANN 工具與已建置的索引、AST-grep MCP 伺服器、Morph API 金鑰或內建 Grep 工具。

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

來源與署名

來源:parcadei/continuous-claude-v3位於.claude/skills/archive/search-tools提交d07ff4b

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架