AST-Grep Structural Search

•
6
•

Enables syntax-aware code searching and structural pattern matching across multiple programming languages using ast-grep and tree-sitter.

This skill empowers Claude to perform highly precise, structural code searches that go far beyond simple text-based grep. By leveraging abstract syntax trees (AST) and meta-variables, it allows for finding complex code constructs—such as specific function signatures, class definitions, or unhandled error blocks—while intelligently ignoring comments and string literals. It is an essential tool for large-scale refactoring, code auditing, and deep codebase exploration where traditional regex-based searches often produce noisy or inaccurate results.

Key Features

016 GitHub stars
02Support for 10+ languages including Python, TypeScript, Go, and Rust
03Syntax-aware structural search using ast-grep meta-variables
04Integration with tree-sitter for full AST parsing and symbol tag extraction
05Distinguishes between actual code, comments, and string literals
06Pre-configured patterns for functions, imports, classes, and error handling

Use Cases

01Large-scale refactoring of deprecated function calls across a complex repository
02Identifying security anti-patterns or missing error handling blocks
03Quickly mapping out a project's API surface and class hierarchies for onboarding