Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ulpi-io/skills --skill ast-grep -a claude-code
Open on GitHub

What 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/catch in 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-grep rule 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-code

2Manually: put the files in place

~/.claude/skills/ast-grep/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ast-grep/

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.

ast-grep ast-grep This skill helps turn code-search requests into ast-grep rules. Use it when you need to find code by its structure rather than by matching text. CX Codex +1 20,100installs ast-grep pproenca A skill with community best practices for writing, reviewing and debugging ast-grep rules for code search, linting and rewriting. CX Codex +1 346installs ast-grep skempken The ast-grep skill brings AST-based search, linting, and rewrites to coding agents. Use it for structural refactors, code analysis, and custom rules. CX Codex +1 1installs ast-grep-outline ast-grep ast-grep-outline generates a lightweight structural map of files and folders with line numbers before full reads. Runs on top-level declarations, imports, and exports during code navigation. CX Codex +1 2,800installs codegraph-ast-grep stark-ai-de The codegraph-ast-grep Claude Code skill sets up CodeGraph and ast-grep for repository analysis. It installs or updates the tools, connects MCP, or checks setup health without making repairs. CX Codex +1 2,800installs ast-grep-find parcadei ast-grep-find runs AST-based code search and refactoring using language syntax trees. Helps locate and replace function calls, imports, and variables without matching text inside strings or comments. CX Codex +1 524installs file-search Netresearch DTT GmbH file-search — a skill that points your agent at rg, fd, ast-grep, semgrep, rga, tokei and scc instead of grep and find. Useful for gathering context before a task. CX Codex +1 549installs search-hierarchy parcadei The search-hierarchy skill picks a search tool based on whether a question concerns code structure, meaning, or an exact identifier. It helps locate a relevant file before reading it. CX Codex +1 ★ 3,951repo stars Vercel Grep vercel Vercel Grep searches public GitHub repositories for exact code strings and regular expressions. Helps find working syntax and real library setups in production code. CX Codex +1 1,219installs

From the same set49

The whole set →
create-pr create-pr opens a GitHub pull request from the real branch diff: commits pending work first, runs the narrowest checks, pushes, then creates and verifies the PR with gh. CX Codex +1 156installs update-skill-learnings update-skill-learnings captures one validated rule about skill design or quality in a central learnings file. Use it when a session reveals guidance worth keeping. CX Codex +1 155installs start start is a Claude Code skill that routes incoming tasks, selects domain skills, evaluates sub-agent delegation, and limits context exploration before code edits. CX Codex +1 152installs pr-retro The pr-retro skill measures a feature branch against its base and reports merge-readiness with recommendations. Run it before reviewing a PR. CX Codex +1 150installs browse-qa browse-qa is a skill that turns feature requests into explicit QA scenarios, runs them through browse, and saves stable flows for regression checks. CX Codex +1 148installs secrets Drives the secrets CLI: add, rotate, list and toggle local service credentials while values stay out of commands and chat. CX Codex +1 148installs run-parallel-agents-feature-debug run-parallel-agents-feature-debug is a Claude Code skill that concurrently diagnoses and fixes three or more independent failures in isolated worktrees after checking for a shared cause. CX Codex +1 148installs find-agents find-agents is a Claude Code skill for searching, installing and updating agents across 43+ editors and CLIs, converting each to the target client's format. CX Codex +1 148installs

Project sponsors

Companies that keep this analytics open