ast-grep · ulpi-io — Claude Code skill: structural code search
This skill uses the ast-grep CLI to find code by syntax. Use it when a text or regex search cannot express the structure you need.
no license 148 installs ★ 5 updated 2026-08-31
npx skills add ulpi-io/skills --skill ast-grep -a claude-codeWhat ast-grep does
The skill turns a description of a code shape into an ast-grep rule. It can use patterns, node kinds, metavariables, and inside or has relationships. Before searching a repository, the agent checks that the CLI is installed, builds a small example, and tests the rule against it. When the tree shape is unclear, it inspects it with --debug-query.
Once the rule passes the example, the agent searches the codebase and checks the match count and sample results. Its report includes the language, rule type, representative file paths and lines, plus a reusable rule or command. The ast-grep CLI must be installed first; without it, this workflow stops. For plain text searches, use Grep instead.
What it helps with
- find async functions that lack
try/catch - spot conditional calls to React hooks
- locate calls with a specified syntax shape
- test a search rule on a sample before scanning the repository
Example prompts for the agent
- Find async functions without
try/catchin this project; test the rule on a small example first. - Look for conditional React hook calls and verify the search against an example.
- Create an
ast-greprule for calls shaped like this, then report matching files and lines.
How to install ast-grep
1Skills CLI (Vercel)
npx skills add ulpi-io/skills --skill ast-grep -a claude-code2Manually: put the files in place
~/.claude/skills/ast-grep/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/ast-grep/
1Skills CLI (Vercel)
npx skills add ulpi-io/skills --skill ast-grep -a codex2Manually: put the files in place
.agents/skills/ast-grep/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ulpi-io/skills --skill ast-grep -a cursor2Manually: put the files in place
.cursor/skills/ast-grep/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ulpi-io/skills ast-grep2Manually: put the files in place
.github/skills/ast-grep/SKILL.md1Skills CLI (Vercel)
npx skills add ulpi-io/skills --skill ast-grep -a gemini-cli2Platform CLI
gemini skills install https://github.com/ulpi-io/skills --path ast-grepManually: put the files in place
.devin/skills/ast-grep/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ulpi-io/skills --skill ast-grep -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about ast-grep
How do I install ast-grep in Claude Code?
Run npx skills add ulpi-io/skills --skill ast-grep -a claude-code. The skill file is at ~/.claude/skills/ast-grep/SKILL.md.
What does ast-grep do?
The skill helps search code by syntax using the ast-grep CLI. It tests a rule on a small example before applying it to the repository.
Does the skill require the ast-grep CLI?
Yes. It checks for the CLI with ast-grep --version before starting; if it is unavailable, the search stops.
Similar skills
All skills for Code review and refactoring →ast-grep by other authors comes first.