ast-grep
Skill0 starsChanged 3 months agoMITView on GitHub
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.
27 other projects use a version of this.
Adopted by
Most recently taken up by
- Chasen-Liao/Chasen-Skillstheir own version, first seen Nov 29, 2026
- TudorAndrei/skillstheir own version, first seen Nov 29, 2026
- a3449731/chinese-agent-skillstheir own version, first seen Nov 29, 2026
- coleam00/skillstheir own version, first seen Nov 21, 2026
- nodetool-ai/nodetooltheir own version, first seen Nov 21, 2026
- matt-riley/agent-skillstheir own version, first seen Nov 15, 2026
Used with
Projects with it also use ablate-ai-layer, second-brain-audit and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
acgs-aiSkillablate-ai-layer
Measure whether a repository's AI instructions still earn their place, by running the same real task many times with the layer intact and with it stripped, then grading every rule against what actually changed. Runs both arms itself in throwaway git worktrees and never touches the working tree. Agent-agnostic across CLAUDE.md, AGENTS.md, .claude/, .agents/, .cursor/rules, .clinerules, .windsurfrules and copilot-instructions. Use when the user wants to prune, audit, clean up, shrink or "delete" their CLAUDE.md, AGENTS.md, cursor rules, agent instructions or AI layer; when they ask whether their rules are still needed, whether their context is bloated, or what to cut; or when they mention ablating, ablation, or testing their agent without its instructions.
Also in 3 projects that use this
acgs-aiSkillsecond-brain-audit
Audit any second brain, notes folder, or agent memory for facts that have quietly stopped being true, then fix the worst one so it stops recurring. Works on a wiki, a single notes file, daily notes, or a non-markdown tool, and adapts the fix to whichever it finds. Checks every current-sounding claim in whatever the agent loads each session against the freshest evidence, and separates contradicted claims from unsupported ones. Use when an assistant gives an outdated answer, when notes or memory files may be stale, when a vault needs checking for contradictions, or when someone asks how to stop a second brain from rotting, mentions memory rot, or asks about state versus event.
Also in 3 projects that use this
MicrosoftSkillrust
Use this guide when working on Rust changes in the FAST monorepo.
Also in 3 projects that use this
SentrySkillcreate-pr
Create pull requests following Sentry conventions. Use when opening PRs, writing PR descriptions, or preparing changes for review. Follows Sentry's code review guidelines.
Also in 4 projects that use this
VercelSkillagent-browser
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
Also in 4 projects that use this
SentrySkillskill-creator
Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.
Also in 7 projects that use this
- +1 more from acgs-ai
- +1 more from getsentry
Other versions27 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 27
- AprilNEA/OpenLogi★ 26ksame name
- ccusage/ccusage★ 20ksame name
- ryoppippi/ccusage★ 20ksame name
- warp-drive-data/warp-drive★ 3.2ksame name
- coleam00/skills★ 802same name
- nodetool-ai/nodetool★ 669same name
- moeru-ai/auv★ 224same name
- damusix/skills★ 63same name
- Chasen-Liao/Chasen-Skills★ 33same name
- ulpi-io/browse★ 15same name
17 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository160 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ab-testingSkill
- ad-creativeSkill
- adsSkill
- agent-reachSkill
- agents-sdkSkill
- ai-seoSkill
- analyticsSkill
- animation-vocabularySkill
- apk-reverseSkill
- apple-designSkill
- ask-sonnerSkill
- asoSkill
- audit-orchestratorSkill
- background-browser-operatorSkill
- better-colorsSkill
- better-typographySkill
- better-uiSkill
- binary-diffSkill
- brandkitSkill
- checkpoint-quality-loopSkill
- chronicleSkill
- churn-preventionSkill
- cline-orchestratorSkill
- cloudflare-email-serviceSkill
- cloudflareSkill
- codebase-designSkill
- codex-chatgpt-controlSkill
- codex-conductorSkill
- coding-agent-sessionsSkill
- cold-emailSkill
- co-marketingSkill
- community-marketingSkill
- compact-landingSkill
- competitor-profilingSkill
- competitorsSkill
- composio-cliSkill
- computer-useSkill
- content-strategySkill
- context7-mcpSkill
- copy-editingSkill
- copywritingSkill
- create-hookSkill
- croSkill
- customer-researchSkill
- design-taste-frontendSkill
- design-taste-frontend-v1Skill
- diagram-generatorSkill
- diffui-designerSkill
- directory-submissionsSkill
- domain-modelingSkill
- durable-objectsSkill
- edr-bypass-reSkill
- emailsSkill
- emil-design-engSkill
- engineering-acceptance-reviewSkill
- extract-design-systemSkill
- find-animation-opportunitiesSkill
- find-skillsSkill
- firmware-pentestSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 11 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use AST-aware search when the question is about code shape, not just text.
- Distinctive: line 12
Use this skill when:
- Very specific: line 29
Start with rg or rg --files if needed to identify languages and candidate directories.
- Distinctive: line 31
Test the AST pattern on a small scope first.
- Distinctive: line 34
run a dry run or JSON/listing mode first.
- Very specific: line 37
run tests/typecheck/lint relevant to the changed language.
- Distinctive: line 41
Prefer concrete syntax over broad wildcards.
- Distinctive: line 43
Avoid matching comments and strings unless that is the target.
- Distinctive: line 44
Keep replacement patterns minimal.
- Distinctive: line 45
If the pattern is brittle, stop and use manual edits or CodeGraph-assisted navigation.
- Distinctive: line 57
Use the installed tool's help output for exact flags.
- Distinctive: line 61
Do not apply a codemod without inspecting candidate matches.
- Distinctive: line 62
Do not run broad rewrites over the whole home directory or unrelated workspaces.
- Distinctive: line 63
Do not treat a clean AST search as proof of runtime behavior.
“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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:
ast-grep --lang ts -p '<pattern>' <path>
ast-grep --lang tsx -p '<pattern>' <path>
ast-grep --lang js -p '<pattern>' <path>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
AST-grep:
- Shape searched:
- Scope:
- Matches:
- Changes applied:
- Validation:Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

