| name | ast-grep |
| description | Use ast-grep MCP tools for syntax-aware structural search, AST inspection, rule testing, and structural verification. Triggers: code-shape queries, structural invariants, pattern debugging, AST inspection, and multi-file syntax matching. |
ast-grep MCP Workflow
When to use this skill
Use this skill when the question depends on code structure rather than plain text.
Good fits:
- Find all code matching a syntax shape.
- Verify a structural invariant across files.
- Debug why a pattern does or does not match.
- Inspect the AST or pattern structure before writing a rule.
- Plan or verify structural rewrite targets before editing.
Do not use ast-grep as the default repo navigation tool when cymbal can answer the question more directly.
Tool map
This local setup uses the official ast-grep/ast-grep-mcp server. Do not assume extra MCP tools exist beyond the four tools below.
-
ast_grep_dump_syntax_tree
- Use to inspect target code or understand how a pattern is parsed.
format: cst shows concrete syntax.
format: ast shows named syntax nodes.
format: pattern shows how ast-grep interprets your search pattern.
-
ast_grep_test_match_code_rule
- Use to test a YAML rule against example code before searching the repo.
-
ast_grep_find_code
- Use for simple single-pattern searches when one AST pattern is enough.
-
ast_grep_find_code_by_rule
- Use for complex searches that need relational rules like , , , , or composite rules like , , .