ast-grep - Structural code search, linting, and rewriting
Maps, searches, validates, lints, and rewrites source code using its syntax tree with ast-grep.
Tags
Updated: 2026-10-08Capabilities
Typical Inputs
Typical Outputs
What this skill does
- Map source structure
- Search syntax trees
- Inspect syntax trees
- Validate matching rules
- Author durable rules
- Apply structural rewrites
Inputs
- Source file paths
- Source code snippets
- Search patterns
- Inline YAML rules
- Project rule files
- Language identifier
Outputs
- Structural outlines
- Search match results
- Syntax tree dumps
- Rule test results
- Lint diagnostics
- Rewritten source files
Requirements
- ast-grep CLI
- MCP tools
- Tree-sitter language grammar
- sgconfig.yml for durable rules
