AST-Grep Structural Refactoring
Performs advanced code search, structural refactoring, and linting using Abstract Syntax Trees to automate complex codebase transformations.
The ast-grep skill empowers Claude to perform precise, structural code modifications that go beyond the limitations of regular expressions. By leveraging Abstract Syntax Trees (AST), it understands the underlying syntax of your code, allowing for safe refactoring of function signatures, variable renames, and the enforcement of custom linting rules across polyglot projects. Whether you are migrating legacy codebases, cleaning up technical debt, or performing deep code analysis, this tool provides the speed and accuracy required for high-fidelity code transformations without breaking syntax.
Key Features
010 GitHub stars
02Structural search and replace using AST pattern matching
03Meta-variable capture for complex code transformations
04Interactive refactoring with dry-run capabilities
05Custom YAML-based linting and rewrite rules
06Polyglot support for multiple programming languages
Use Cases
01Enforcing custom architectural patterns or style guides via structural linting
02Migrating legacy APIs by refactoring function calls across an entire project
03Safely reordering function arguments or renaming variables in complex scopes