Agent Skills
› JamieMason/syncpack
› search-code
search-code
GitHub提供在Syncpack代码库中高效搜索代码的指导,区分Rust与非Rust文件场景。推荐对Rust使用ast-grep以过滤注释和字符串,对其他文件类型或需搜索注释内容时使用grep/rg。包含常用命令示例及模式语法说明。
Trigger Scenarios
需要查找特定符号、结构体或函数实现
理解代码中某处的具体用法
搜索非Rust文件或包含注释的代码
Install
npx skills add JamieMason/syncpack --skill search-code -g -y
SKILL.md
Frontmatter
{
"name": "search-code",
"description": "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."
}
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
Version History
- 15.3.2 Current 2026-07-06 19:59


