ast-grep Code Search

0•

Performs high-precision structural code searches and analysis using Abstract Syntax Tree patterns to identify complex programming constructs.

The ast-grep Code Search skill enables Claude to move beyond simple string-based text searches by utilizing Abstract Syntax Tree (AST) matching to identify specific code structures across various programming languages. This skill is essential for complex refactoring, identifying architectural patterns, and enforcing coding standards by allowing users to define precise rules for finding nested logic, specific function signatures, or missing error handling blocks within large codebases. It provides a structured workflow for drafting, testing, and executing rules that understand the syntax and hierarchy of your code rather than just its literal text.

主な機能

01Structural pattern matching using Abstract Syntax Trees (AST)
02Inline and YAML-based rule creation for complex structural queries
03Support for relational rules like 'inside', 'has', 'precedes', and 'follows'
04AST debugging and inspection to visualize code parsing structures
05Multi-language support for precise code analysis across diverse stacks
060 GitHub stars

ユースケース

01Locating all async functions that lack proper try-catch error handling blocks
02Refactoring deprecated function signatures across a large, multi-file codebase
03Identifying specific API method calls nested within particular class structures