What problem does it solve?
It eliminates risky, repetitive manual find-and-replace work by performing large-scale code rewrites based on code structure rather than plain text.
Core Features & Use Cases
- Structural search and rewrite: Match and transform code using AST patterns that preserve formatting, whitespace, and nesting.
- Bulk refactors across many files: Apply “rename X to Y” or “change all A-shaped code to B-shaped code” transformations to all call sites and related syntactic positions.
- Safer matching controls: Prefer ast-grep over blind edits, with language-aware support and guidance on preview-first workflows.
Use cases:
Renaming functions, methods, types, or variables across a repository; changing function signatures across implementations and all callers; migrating API usage patterns (including imports) without missing structural variants.
Quick Start
Load the ast-grep skill to rename oldFunction to newFunction across your codebase using structural AST matching instead of manual text edits.