AgentSkillsCN

code-search

搜索代码符号、查找函数调用,并深入分析代码库

SKILL.md
--- frontmatter
name: code-search
description: Search code symbols, find function calls, and analyze codebase
triggers:
  - find function
  - where is
  - who calls
  - find class
  - find method
  - search code
  - code search
  - find symbol
  - call sites
  - references to
  - what calls
  - show me the

Code Search

Recommended model tier: balanced (sonnet) - this skill performs straightforward operations

Search for code symbols (functions, classes, methods, types) and find their call sites.

Available Tools

1. Search Symbols (mcp__plugin_aide_aide__code_search)

Find functions, classes, methods, interfaces, and types by name or signature.

Example usage:

code
Search for: "getUserById"
→ Uses code_search tool
→ Returns: function signatures, file locations, line numbers

2. Find References (mcp__plugin_aide_aide__code_references)

Find all places where a symbol is called/used.

Example usage:

code
Who calls "getUserById"?
→ Uses code_references tool
→ Returns: all call sites with file:line and context

3. List File Symbols (mcp__plugin_aide_aide__code_symbols)

List all symbols defined in a specific file.

Example usage:

code
What functions are in src/auth.ts?
→ Uses code_symbols tool
→ Returns: all functions, classes, types in that file

4. Check Index Status (mcp__plugin_aide_aide__code_stats)

Check if the codebase has been indexed.

Example usage:

code
Is the code indexed?
→ Uses code_stats tool
→ Returns: file count, symbol count, reference count

Workflow

  1. First, check if codebase is indexed:

    • Use code_stats to verify indexing
    • If not indexed, tell user to run: aide code index
  2. Search for symbols:

    • Use code_search with the symbol name or pattern
    • Filter by kind (function, method, class, interface, type)
    • Filter by language (typescript, javascript, go, python)
  3. Find call sites:

    • Use code_references to find where a symbol is used
    • Shows all callers with context
  4. Explore specific files:

    • Use code_symbols to list all definitions in a file

Example Session

User: "Where is the authentication function?"

Assistant action:

  1. Use code_search with query "auth" or "authenticate"
  2. Show matching functions with file locations

User: "Who calls authenticateUser?"

Assistant action:

  1. Use code_references with symbol "authenticateUser"
  2. Show all call sites grouped by file

Notes

  • Code must be indexed first: aide code index
  • Indexing is incremental - only changed files are re-parsed
  • Supports: TypeScript, JavaScript, Go, Python, Rust, and more
  • For file watching: AIDE_CODE_WATCH=1 claude