SE

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.zip

Installs 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.
169 chars✓ has a “when” trigger
Intermediate

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

You give it
Search pattern and target directory
You get back
List of matching code locations

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, structsast-grep
Multiple file typesgrep/rg
Content in comments intentionallygrep/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

PatternMatches
$NAMESingle 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-grep output to find the file, then read_file to 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.

SkillInstallsUpdatedSafetyDifficulty
search-code (this skill)24moReviewIntermediate
debug-cli18moReviewIntermediate
fix-clippy36moNo flagsBeginner
handling-rust-errors42moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry