ast-grep
ast grep
What it does
- Need to search for code patterns using structural matching (e.g., "find all async functions that don't have error handling")
- Want to locate specific language constructs (e.g., "find all function calls with specific parameters")
- Request searches that require understanding code structure rather than just text
- Ask to search for code with particular AST characteristics
- Need to perform complex code queries that traditional text search cannot handle
- What specific code pattern or structure are they looking for?
- Which programming language?
Requirements & configuration
- Need to search for code patterns using structural matching (e.g., "find all async functions that don't have error handling")
- Request searches that require understanding code structure rather than just text
- Need to perform complex code queries that traditional text search cannot handle
- When you don't need relational rules (inside/has)
- When you need the power of full YAML rules
Configuration: EXPRPATTERNNAMEBODY
Derived from the skill's own SKILL.md documentation · extracted 2026-07-23
ast-grep FAQ
What does the ast-grep skill do?
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics. Need to search for code patterns using structural matching (e.g., "find all async functions that don't have error handling") Want to locate specific language constructs (e.g., "find all function calls with specific parameters")
What does ast-grep require?
Need to search for code patterns using structural matching (e.g., "find all async functions that don't have error handling") Request searches that require understanding code structure rather than just text Need to perform complex code queries that traditional text search cannot handle When you don't need relational rules (inside/has) When you need the power of full YAML rules Configuration keys: EXPR, PATTERN, NAME, BODY.
How do I install ast-grep?
Run: npx -y skills add https://github.com/ast-grep/agent-skill --skill ast-grep --agent claude-code — the source lives at github.com/ast-grep/agent-skill.
Maintain ast-grep?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[](https://getagentictools.com/skills/ast-grep-agent-skill-ast-grep?ref=badge) npx agentictools info skills/ast-grep-agent-skill-ast-grep The second line is the CLI lookup for this page — handy in READMEs and docs.