What problem does it solve? Text-based search cannot distinguish a declaration from a use or match code by structure, making large-scale code search, linting, and rewriting error-prone. This Skill provides operational knowledge for using ast-grep's MCP tools and CLI to match, inspect, and rewrite code by its syntax tree. ## Core Features & Use Cases - Structural Code Search: Match code by tree-sitter patterns with metavariables, relational rules (has, inside, follows), and constraints across Python, Bash, YAML, C#, XML, SQL, and more. - Rule Authoring and Hardening: Derive lint rules from diffs, code smells, or project principles, then widen, collapse, and attach behavior-preserving fixes with transforms and rewriters. - Declaration Outlines: Use ast-grep outline and custom extractors to map declarations and members to source ranges in files too long to read whole. - Use Case: You need to find every hand-written counterpart of a library function across a monorepo and rewrite each call site. Write an ast-grep rule with a fix template, prove it on every sibling form, and apply it with ast-grep scan -U. ## Quick Start Ask the agent to list the declarations in a file or search for a code pattern by syntax tree, for example: outline the functions in src/app.py or find all calls matching a given pattern.