AST-Grep Structural Code Search & Refactoring

0•

Performs precise structural code searches and automated refactors using Abstract Syntax Tree (AST) patterns across multiple programming languages.

This skill integrates the power of ast-grep into Claude Code, enabling sophisticated code manipulation that transcends simple text-based search and replace. By matching code based on its underlying syntax tree rather than literal strings, it allows developers to perform complex tasks like finding specific function signatures, detecting structural anti-patterns, and executing project-wide refactors while safely preserving variable names. It is an essential tool for large-scale codebase migrations, API updates, and enforcing custom linting rules across diverse languages including JavaScript, TypeScript, Python, Rust, and Go.

주요 기능

01Variable-aware code rewriting that preserves context and logic
02Interactive and batch refactoring modes for safe project-wide updates
03Multi-language support for JS, TS, Python, Rust, Go, C++, and more
040 GitHub stars
05Structural pattern matching using intuitive $VAR and $$$ARGS syntax
06Custom YAML rule support for advanced linting and automated fixes

사용 사례

01Standardizing syntax across a team, such as converting traditional functions to arrow functions.
02Migrating deprecated API calls to new patterns while maintaining existing arguments and variables.
03Scanning for complex security anti-patterns like unsanitized input or empty catch blocks.