| name | codebase-search |
| description | Use when analyzing codebases requiring search patterns, dependency tracing, or architecture discovery. Invoke for ripgrep patterns, call graph analysis, security scanning. |
Codebase Search
ripgrep patterns, AST analysis, and dependency tracing for understanding unfamiliar codebases quickly.
When to Use This Skill
- Exploring unfamiliar codebases
- Finding function definitions and usages
- Tracing dependencies between modules
- Discovering architecture and entry points
- Investigating security patterns
- Analyzing test coverage
Core Workflow
- Discover - Find entry points, main functions, API handlers
- Trace - Follow dependencies and call graphs
- Analyze - Understand patterns and architecture
- Document - Record findings for future reference
Reference Guide
Load detailed patterns based on language:
| Topic | Reference | Load When |
|---|
| Go | references/go-patterns.md | Searching Go codebases |
| Python | references/python-patterns.md | Searching Python codebases |
| TypeScript | references/typescript-patterns.md | Searching TypeScript/JavaScript codebases |
| Rust | references/rust-patterns.md | Searching Rust codebases |
| Java | references/java-patterns.md | Searching Java codebases |
| Ruby | references/ruby-patterns.md | Searching Ruby codebases |
| Analysis | references/analysis-patterns.md | Dependency, security, performance analysis |
Knowledge Reference
ripgrep (rg) - Primary Search Tool
rg [OPTIONS] PATTERN [PATH...]
| Option | Description |
|---|
-n | Show line numbers (default) |
-i | Case-insensitive search |
-w | Match whole words only |
-l | List files with matches only |
-c | Count matches per file |
-A N | Show N lines after match |
-B N | Show N lines before match |
-C N | Show N lines of context |
--type | Filter by file type |
--glob | Filter by glob pattern |
fd - File Finding
fd [PATTERN] [PATH...]
fd -e go
fd -t f
fd -t d
Constraints
MUST DO
- Use
--type filters for performance
- Exclude generated code with
--glob "!generated/*"
- Start broad, then narrow searches
- Use context (
-C 5) for understanding
- Verify search results by reading actual code
MUST NOT DO
- Search without file type filters in large repos
- Trust search results without verification
- Ignore .gitignore patterns
- Search binary files
Output Templates
When reporting search findings, provide:
- Search command used
- Number of matches found
- Key files/locations
- Brief analysis of patterns found