masih-0x3/agent-skills/ast-grep
Claude Code and agent skill by masih-0x3/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Use for AST-aware code search, syntax-shaped matching, codemods, API migrations, repeated structured edits, or refactors where text grep may overmatch or miss language structure.
Install
npx vskill@latest install masih-0x3/agent-skills/ast-grepSKILL.md
The same SKILL.md was published earlier as masih-0x3/agent-skills/ast-grep.
AST Grep
Use AST-aware search when the question is about code shape, not just text. rg remains the default for plain strings; ast-grep is for syntax.
When To Use
Use this skill when:
- Finding call sites by syntactic shape.
- Searching for imports, JSX props, function calls, decorators, object patterns, assignments, or API usage.
- Planning or applying a mechanical codemod.
- Refactoring repeated code structures across files.
- Avoiding false positives from comments, strings, generated files, or unrelated identifiers.
Skip this skill when:
- A simple
rgorrg --filesquery answers the question. - The language is unsupported or the repo lacks enough files for AST matching to pay off.
- The task needs semantic call flow or impact analysis; use
codegraphfirst when available.
Workflow
- Define the code shape in words before writing the pattern.
- Start with
rgorrg --filesif needed to identify languages and candidate directories. - Choose the language/parser explicitly when the tool requires it.
- Test the AST pattern on a small scope first.
- Inspect matches before changing files.
- For codemods:
- run a dry run or JSON/listing mode first.
- apply changes to the narrowest safe file set.
- inspect the diff.
- run tests/typecheck/lint relevant to the changed language.
Pattern Discipline
- Prefer concrete syntax over broad wildcards.
- Exclude generated/build/vendor directories.
- Avoid matching comments and strings unless that is the target.
- Keep replacement patterns minimal.
- If the pattern is brittle, stop and use manual edits or CodeGraph-assisted navigation.
Tool Notes
Common command shapes:
Use the installed tool's help output for exact flags. Some versions differ on JSON, rewrite, and update flags.
Guardrails
- Do not apply a codemod without inspecting candidate matches.
- Do not run broad rewrites over the whole home directory or unrelated workspaces.
- Do not treat a clean AST search as proof of runtime behavior.
- Preserve unrelated user changes.
Closeout
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ast-grep/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/masih-0x3/agent-skills/ast-grep)