ast-grep
Installation
SKILL.md
ast-grep Structural Search
Use ast-grep when the user needs code structure, not just text. The useful outcome is a validated rule plus a clear statement of what it matches and what it may miss.
Triage
Start with the smallest tool that can answer the question.
- Use
rgfor exact names, strings, comments, or simple text. - Use language tooling for semantic facts such as type resolution, references, imports, or rename safety.
- Use ast-grep for syntax shape: descendants, ancestors, call forms, decorators, missing constructs, nested contexts, or multi-language structural searches.
If ast-grep is not installed, say so and offer an rg fallback only when the
fallback will not pretend to be structural.