首页/ AI 技能 / @skilllib/skill-2014279378778140673
Skill站外收录 @skilllib/skill-2014279378778140673

leann-search

提供基于语义理解的代码库检索能力,能够根据自然语言描述定位功能相似但术语不同的代码片段,适用于概念性查询、架构模式识别和跨命名空间的相关代码发现,弥补传统文本匹配工具在语义鸿沟上的不足。

0.0 (0) 158 次安装 原作者 编程导航
收录于 2026-01-22
数据与分析 AI 技能

Skills.MD

# LEANN Semantic Search Use LEANN for meaning-based code search instead of grep. ## When to Use - **Conceptual queries**: "how does authentication work", "where are errors handled" - **Understanding patterns**: "streaming implementation", "provider architecture" - **Finding related code**: code that's semantically similar but uses different terms ## When NOT to Use - **Exact matches**: Use Grep for `class Foo`, `def bar`, specific identifiers - **Regex patterns**: Use Grep for `error.*handling`, `import.*from` - **File paths**: Use Glob for `*.test.ts`, `src/**/*.py` ## Commands ```bash # Search the current project's index leann search <index-name> "<query>" --top-k 5 # List available indexes leann list # Example leann search rigg "how do providers handle streaming" --top-k 5 ``` ## MCP Tool (in Claude Code) ``` leann_search(index_name="rigg", query="your semantic query", top_k=5) ``` ## Rebuilding the Index When codebase changes significantly: ```bash cd /path/to/project leann build <project-name> --docs src tests scripts \ --file-types '.ts,.py,.md,.json' \ --no-recompute --no-compact \ --embedding-mode sentence-transformers \ --embedding-model all-MiniLM-L6-v2 ``` ## How It Works 1. LEANN uses sentence embeddings to understand *meaning* 2. Searches find conceptually similar code, not just text matches 3. Results ranked by semantic similarity score (0-1) ## Grep vs LEANN Decision | Query Type | Tool | Example | |------------|------|---------| | Natural language | LEANN | "how does caching work" | | Class/function name | Grep | "class CacheManager" | | Pattern matching | Grep | `error\|warning` | | Find implementations | LEANN | "rate limiting logic" |

评论 0

还没有评论,来抢沙发。