AST-Grep Structural Refactoring

•
27
•

Performs lightning-fast structural code search and AST-based refactoring across multiple programming languages.

The ast-grep skill empowers Claude to perform precise, syntax-aware code modifications by navigating Abstract Syntax Trees (AST) rather than relying on brittle regular expressions. It allows for complex refactoring tasks—such as renaming variables within specific scopes or transforming function signatures—while maintaining code integrity across large polyglot codebases. By leveraging meta-variables and YAML-based rule configurations, it streamlines everything from custom linting to large-scale migrations and deep code analysis, ensuring that modifications are logically sound and contextually accurate.

주요 기능

01Safe code rewriting with support for interactive dry runs
02Multi-language support for consistent polyglot refactoring
03YAML-based custom linting rules and project-wide scans
04Meta-variable matching for capturing complex code structures
0527 GitHub stars
06Structural search and replace using AST-aware patterns

사용 사례

01Refactoring legacy function signatures across a large TypeScript project
02Creating custom linting rules to enforce domain-specific best practices
03Identifying and replacing deprecated API patterns with modern equivalents