◆SkillCodingFree
ast-grep
Fast, language-agnostic structural search, lint, and rewrite tool that runs codemods using AST patterns written like code.
ast-grep
ast-grep is a Rust-based CLI for structural code search and rewriting. Instead of regex, you write patterns that look like the code you want to match, and ast-grep operates on the syntax tree — so a single rule can find and rewrite constructs reliably across an entire codebase. It powers large-scale migrations and custom lint rules for many languages via Tree-sitter.
Key features
- Pattern matching on the AST, not text — precise and safe rewrites
- Interactive codemods and batch rewriting from the command line
- YAML rule files for reusable lint and migration rules
- Multi-language support (JS/TS, Python, Rust, Go, Java, C, and more)
- Fast parallel search over huge repositories
Perfect for API migrations, deprecation sweeps, and enforcing codebase-wide conventions — a scriptable engine an agent can drive to apply consistent, verifiable code changes.
Curated mirror of the open-source ast-grep (MIT). Get it from the source.