ast-grep

•
2
•

Performs AST-based code search, linting, and structural refactoring across multiple programming languages.

ast-grep provides a powerful interface for structural code manipulation using Abstract Syntax Trees rather than simple text strings. This skill enables precise searching, linting, and automated rewriting while avoiding common pitfalls of regex-based search, such as matching inside comments or strings. It is particularly robust for Java development, offering specialized patterns for annotations, null safety, and the Stream API, while supporting over 20 other languages including TypeScript, Python, and Rust.

Características Principales

01Structural code rewriting and automated refactoring workflows
02Java-specific specialized patterns for annotations, generics, and exception handling
03AST-based pattern matching using meta-variables and multi-node capture
042 GitHub stars
05Rule-based linting configuration using YAML for project-specific standards
06Multi-language support for over 20 languages including C++, Rust, Go, and Python

Casos de Uso

01Executing large-scale structural refactorings that require syntax awareness
02Creating custom linting rules to enforce project-specific architectural patterns
03Identifying security vulnerabilities or code smells that text-based grep cannot detect