ast-grep
SKILL.md
ABOUTME: ast-grep universal guide for AST-aware code search and analysis
ABOUTME: Provides patterns for Go, Python, Bash, Terraform/HCL; replaces grep for structural search
ast-grep Skill
Overview
ast-grep (sg) is the preferred tool for code search. It matches code structure, not text.
When to Use ast-grep vs grep
| Tool | Matches | False Positives | Comments/Strings |
|---|---|---|---|
| grep/ripgrep | Text patterns | Many | Included |
| ast-grep | AST structure | None | Ignored |
Use grep when: Searching non-code files, paths, or full-text documentation.
Use ast-grep when: Searching code for patterns, refactoring, finding anti-patterns.