search-code
Locates symbols and implementations across a codebase using pattern matching tools like ast-grep and grep.
Install
mkdir -p .claude/skills/search-code && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8491" && unzip -o skill.zip -d .claude/skills/search-code && rm skill.zipInstalls to .claude/skills/search-code
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Search for code patterns in Syncpack. Use when finding symbols, implementations, or understanding how code is used. Covers ast-grep for Rust and grep/rg for other cases.Key capabilities
- →Search for Rust symbols and patterns
- →Locate code implementations
- →Audit code usage across the project
- →Perform case-insensitive text searches
- →Filter searches by file type
How it works
It utilizes ast-grep for semantic Rust code searching and standard grep/rg for general text pattern matching across the codebase.
Inputs & outputs
When to use search-code
- →Find code symbols
- →Locate pattern implementations
- →Audit code usage across the project
About this skill
Search Code
Guide for searching the Syncpack codebase effectively.
Golden Rule
Use ast-grep for Rust files — it filters out comments, strings, and docs.
Quick Reference
| Looking for... | Use |
|---|---|
| Rust symbols, patterns, structs | ast-grep |
| Multiple file types | grep/rg |
| Content in comments intentionally | grep/rg |
| Non-Rust files (JSON, MD, TOML) | grep/rg |
ast-grep Examples
# Find struct definitions
ast-grep -p 'pub struct $NAME' src/
# Find function calls
ast-grep -p 'Specifier::new' src/
# Find enum variants
ast-grep -p 'pub enum $NAME' src/
# Find impl blocks
ast-grep -p 'impl $TYPE' src/
# Find specific method definitions
ast-grep -p 'pub fn run($$$) -> i32' src/
# Find match expressions
ast-grep -p 'match $EXPR { $$$ }' src/
Pattern Syntax
| Pattern | Matches |
|---|---|
$NAME | Single identifier |
$$$ | Zero or more items (arguments, fields, etc.) |
$_ | Any single expression |
When to Use grep/rg
# Search across file types
rg "TODO" --type rust --type md
# Search in comments (ast-grep ignores these)
rg "FIXME" src/
# Search non-Rust files
rg "version" Cargo.toml
# Case-insensitive search
rg -i "error" src/
Common Searches
Find where a type is used
ast-grep -p 'Context' src/
Find all InstanceState assignments
ast-grep -p 'InstanceState::valid' src/
ast-grep -p 'InstanceState::fixable' src/
ast-grep -p 'InstanceState::unfixable' src/
Find test files
find src -name '*_test.rs'
Find command implementations
ast-grep -p 'pub fn run($$$) -> i32' src/commands/
Tips
- Start broad, then narrow with more specific patterns
- Use
ast-grepoutput to find the file, thenread_fileto understand context - Chain searches: find the type, then find where it's constructed
When not to use it
- →When searching for content inside comments (use grep/rg instead of ast-grep)
Limitations
- →ast-grep is optimized for Rust and ignores comments
- →Requires knowledge of pattern syntax for effective queries
How it compares
It uses semantic AST-based searching for Rust, which ignores comments and strings to focus on actual code structure.
Compared to similar skills
search-code side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| search-code (this skill) | 2 | 4mo | Review | Intermediate |
| debug-cli | 1 | 8mo | Review | Intermediate |
| fix-clippy | 3 | 6mo | No flags | Beginner |
| handling-rust-errors | 4 | 2mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by JamieMason
View all by JamieMason →You might also like
debug-cli
antinomyhq
Use when users need to debug, modify, or extend the code-forge application's CLI commands, argument parsing, or CLI behavior. This includes adding new commands, fixing CLI bugs, updating command options, or troubleshooting CLI-related issues.
fix-clippy
quickwit-oss
Fix all clippy lint warnings in the project
handling-rust-errors
hashintel
HASH error handling patterns using error-stack crate. Use when working with Result types, Report types, defining custom errors, propagating errors with change_context, adding context with attach, implementing Error trait, or documenting error conditions in Rust code.
debug-with-valgrind
facet-rs
Debug crashes, segfaults, and memory errors using valgrind integration with nextest through pre-configured profiles
m01-ownership
actionbook
CRITICAL: Use for ownership/borrow/lifetime issues. Triggers: E0382, E0597, E0506, E0507, E0515, E0716, E0106, value moved, borrowed value does not live long enough, cannot move out of, use of moved value, ownership, borrow, lifetime, 'a, 'static, move, clone, Copy, 所有权, 借用, 生命周期
m03-mutability
actionbook
CRITICAL: Use for mutability issues. Triggers: E0596, E0499, E0502, cannot borrow as mutable, already borrowed as immutable, mut, &mut, interior mutability, Cell, RefCell, Mutex, RwLock, 可变性, 内部可变性, 借用冲突