ast-grep
Installation
SKILL.md
ast-grep
ast-grep (binary also named sg) is an AST-aware search and rewrite tool across 25 languages. It treats your pattern as code, parses it the same way it parses your project, and matches structurally. It is the right tool whenever your question depends on code shape rather than text bytes.
This skill ships a Python wrapper at scripts/ast_grep_helper.py and platform install scripts at install.sh (POSIX) and install.ps1 (Windows). The helper adds offline pattern validation, the two-pass write trick, and binary auto-resolution. Use it as your default entry point.
Upstream source: vendored from code-yeongyu/ast-grep-skill (MIT), as shipped in oh-my-openagent's shared-skills bundle.
When to use this skill
Use it whenever the question is about code structure, not bytes: