ast-grep
OfficialFind code patterns by structure, not text.
Authorconvective
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill enables searching code by Abstract Syntax Tree (AST) patterns rather than raw text, allowing detection of bug patterns and refactoring candidates that are dependent on syntax rather than formatting or naming.
Core Features & Use Cases
- Structural search: Find code patterns based on syntax (AST), not on textual formatting.
- Bug pattern detection: Identify structural bugs across languages.
- Refactoring & auditing: Spot refactoring opportunities by pattern.
- Use Case: Locate all occurrences of a specific subtraction pattern like
discount - $VARin TypeScript to surface incorrect operand ordering.
Quick Start
Run: ast-grep run -p 'PATTERN' -l LANGUAGE to search for AST patterns, e.g., ast-grep run -p 'discount - $VAR' -l typescript
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: ast-grep Download link: https://github.com/convective/cpg-elf-portal/archive/main.zip#ast-grep Please download this .zip file, extract it, and install it in the .claude/skills/ directory.