ast-grep: a Claude Code skill by ast-grep
Official
For developers who need to find code by its structure, like async functions without try-catch. Skip it if plain text search already finds what you need.
The skill's text changed on Nov 4, 2026, after we last read it. Our description may be behind.
- Score
- 73of 100
- Rank
- #149of 239
- Installs
- 19.6Kon skills.sh
- Security
- Clear 5 scanners
- Updated
- 2026
- Context
- ~108tokens always
Install
npx skills add https://github.com/ast-grep/agent-skill --skill ast-grep Run it in your terminal. View the source
Using the Claude app rather than Claude Code? You can add a skill there too. How to add it in the app
What does ast-grep do?
ast-grep is a skill that helps Claude turn a plain request into an ast-grep rule for searching code by its syntax tree rather than its text. It first pins down the pattern and language, writes a small example file, then drafts a YAML rule using pattern, kind, relational rules like has and inside with stopBy: end, and all, any or not logic. It tests the rule on the example with ast-grep scan, uses --debug-query to inspect the tree when nothing matches, and only then runs it on your project. It also explains the --json output format and shell escaping for inline rules.
When should you use ast-grep?
Use it when
- You need every call matching a code shape across a repo
- Grep returns too many false matches
- You want a reusable lint-style rule
Skip it when
- A simple text search answers the question
- You can't install the ast-grep CLI
What it needs and what it can touch
You need
- The ast-grep CLI
What it can do
- Runs shell commands (ast-grep run, ast-grep scan)
- Writes temporary example and rule files
From reading its instructions, not from running it.
Why it scores 73
Strongest on upkeep (100 of 100), weakest on adoption (40).
Is ast-grep safe to install?
Every scanner that checked it passed it. Scanners often miss what other scanners catch, and a skill can change after a scan. Read its source before you install it.
| Scanner | Result | Date |
|---|---|---|
| Gen Agent Trust Hub | Passed | Nov 4, 2026 |
| Socket | Passed | Nov 4, 2026 |
| Snyk | Low risk | Nov 4, 2026 |
| Runlayer | Passed | Feb 26, 2026 |
| ZeroLeaks | Passed | Apr 16, 2026 |
Details
- Installs
- 19,597
- Repository stars
- 903
- Last repository change
- Tokens always loaded
- about 108
- Tokens when used
- about 2,641
- License
- Not stated
- Data confidence
- High
Did it do the job for you?
Alternatives to ast-grep
All skills for this job-
Get rust-best-practicesrust-best-practices
For Rust developers who want code written and reviewed against Apollo GraphQL's handbook.
-
Get code-review-and-qualitycode-review-and-quality
For developers who want a structured review of a diff or pull request before merging.
-
Get nestjs-best-practicesnestjs-best-practices
For NestJS developers who want Claude to follow set rules on modules, injection and security.
-
Get golang-error-handlinggolang-error-handling
For Go developers who want consistent error wrapping, checks and slog logging in new code or reviews.