code-search

Token-efficient codebase exploration using MCP-first approach. Locates functions, classes, patterns, and traces dependencies with 80-90% token savings. Use when searching code, finding implementations, or tracing call chains.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026⬇️1downloads

When & Why to Use This Skill

This Claude skill enables token-efficient codebase exploration using an MCP-first approach, allowing users to locate functions, classes, and patterns while reducing token consumption by 80-90%. It streamlines the process of tracing dependencies and understanding complex implementations by prioritizing symbol metadata over full-file reads, making it an essential tool for navigating large-scale repositories.

Use Cases

  • Locating specific function or class implementations across a large codebase without exhausting the context window.
  • Tracing complex call chains and symbol dependencies to understand how different components of a system interact.
  • Verifying architectural boundaries and module dependencies by searching for specific import patterns or annotations.
  • Gathering targeted code snippets and structural overviews to assist in generating accurate technical documentation or refactoring plans.
namecode-search
descriptionToken-efficient codebase exploration using MCP-first approach. Locates functions, classes, patterns, and traces dependencies with 80-90% token savings. Use when searching code, finding implementations, or tracing call chains.

Code Search

Explores codebases efficiently using MCP tools before falling back to file reads.

When to Use

  • Finding functions, classes, or patterns
  • Understanding feature implementation
  • Tracing dependencies and call chains
  • Architecture boundary verification
  • Gathering context for documentation

MCP Workflow

# 1. Check past context
claude-mem.search(query="<keyword>", project="<project>")

# 2. Get file overview
serena.get_symbols_overview(relative_path="target/directory")

# 3. Find symbol (signature only first)
serena.find_symbol(name_path="ClassName", depth=1, include_body=False)

# 4. Get body only when needed
serena.find_symbol(name_path="ClassName/method", include_body=True)

# 5. Trace dependencies
serena.find_referencing_symbols(name_path="ClassName/method")

# 6. Framework patterns
context7.get-library-docs("<framework>", topic="<topic>")

Search Patterns

By Name

serena.find_symbol("*Service", include_kinds=[5])      # Classes
serena.find_symbol("UserService/create", include_body=True)  # Method

By Pattern

serena.search_for_pattern("@Cacheable|@cached")        # Annotations
serena.search_for_pattern("TODO|FIXME")                # Comments

Dependencies

serena.find_referencing_symbols("UserService/create")  # Who calls this?

Architecture

serena.search_for_pattern("import.*infra", relative_path="src/domain/")

For Documentation

# Public APIs (classes, methods)
serena.get_symbols_overview(depth=1)                    # Module structure
serena.find_symbol("*Service", depth=1, include_body=False)  # Signatures

# Find existing docs
serena.find_file(file_mask="*.md", relative_path=".")
serena.find_file(file_mask="README*", relative_path=".")

Output Format

## Search: [Target]

| File | Symbol | Line | Type |
|------|--------|------|------|
| path/file | Class.method | 45 | function |

### Key Code
[Relevant snippet - max 20 lines]

### Dependencies
- Calls: [list]
- Called By: [list]

Symbol Kinds

Kind Number Description
Class 5 Class definition
Method 6 Class method
Function 12 Standalone function
Interface 11 Interface

Efficiency Rules

Do:

  • Start with get_symbols_overview before reading files
  • Use include_body=False first
  • Limit searches with relative_path

Avoid:

  • Reading entire files before symbol search
  • Fetching bodies for signature checks
  • Broad searches without scope restriction