AST-Grep Structural Search

0•

Enables precise structural code searching and automated refactoring using AST-based pattern matching across multiple programming languages.

The AST-Grep Structural Search skill empowers Claude to perform code searches and transformations based on Abstract Syntax Tree (AST) patterns rather than simple text strings. This approach allows for highly accurate matching that ignores whitespace and formatting differences, making it ideal for large-scale migrations, identifying anti-patterns, and performing complex code rewrites. By providing domain-specific knowledge of ast-grep's CLI syntax and metavariable patterns, this skill ensures reliable codebase analysis and refactoring for languages including JavaScript, Python, Go, and Rust.

Key Features

01Advanced filtering using YAML-based rules for complex logic
02Metavariable support for capturing specific code nodes and variadic arguments
030 GitHub stars
04Language-specific patterns for JS/TS, Python, Go, and Rust
05Interactive and automated code rewriting for large-scale refactors
06Structural pattern matching that ignores whitespace and formatting

Use Cases

01Performing precise code transformations where variable names differ but structure remains identical
02Migrating deprecated API calls or library patterns across large repositories
03Detecting structural anti-patterns such as await calls inside loops