Agent SkillsJamieMason/syncpack › search-code

search-code

GitHub

指导在 Syncpack 代码库中高效搜索代码,区分使用 ast-grep(针对 Rust)和 grep/rg(针对其他文件或注释),提供常用命令示例与模式语法。

.claude/skills/search-code/SKILL.md JamieMason/syncpack

触发场景

需要查找特定代码符号或实现 理解代码结构或依赖关系 搜索特定模式的代码片段

安装

npx skills add JamieMason/syncpack --skill search-code -g -y
更多选项

非标准路径

npx skills add https://github.com/JamieMason/syncpack/tree/main/.claude/skills/search-code -g -y

不安装直接使用

npx skills use JamieMason/syncpack@search-code

指定 Agent (Claude Code)

npx skills add JamieMason/syncpack --skill search-code -a claude-code -g -y

安装 repo 全部 skill

npx skills add JamieMason/syncpack --all -g -y

预览 repo 内 skill

npx skills add JamieMason/syncpack --list

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-grep output to find the file, then read_file to understand context
  • Chain searches: find the type, then find where it's constructed

版本历史

  • 15.3.2 当前 2026-07-06 19:59

同 Skill 集合

.claude/skills/add-feature/SKILL.md
.claude/skills/document-code/SKILL.md
.claude/skills/fix-bug/SKILL.md
.claude/skills/front-loading/SKILL.md
.claude/skills/optimize-benchmarks/SKILL.md
.claude/skills/review-docs/SKILL.md
.claude/skills/signal-over-noise/SKILL.md
.claude/skills/testing-gaps/SKILL.md
.claude/skills/write-code/SKILL.md
.claude/skills/write-tests/SKILL.md

元信息

文件数
0
版本
15.3.3
Hash
b831baa0
收录时间
2026-07-06 19:59

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-12 05:34
浙ICP备14020137号-1 $访客地图$