Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add FlorianBruniaux/claude-code-plugins --skill ast-grep-patternsgit clone --depth 1 https://github.com/FlorianBruniaux/claude-code-pluginsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/florianbruniaux/claude-code-plugins/ast-grep-patterns)<a href="https://agentmods.dev/skills/florianbruniaux/claude-code-plugins/ast-grep-patterns"><img src="https://agentmods.dev/badge/skills/florianbruniaux/claude-code-plugins/ast-grep-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/florianbruniaux/claude-code-plugins/ast-grep-patterns"><img src="https://agentmods.dev/badge/skills/florianbruniaux/claude-code-plugins/ast-grep-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00085 | $0.01569 |
| Opus 5.5 | $0.00034 | $0.00628 |
| Sonnet 5.5 | $0.00017 | $0.00314 |
| Haiku 4.5 | $0.00009 | $0.00157 |
Grade A, and why
ast-grep-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep patterns
ast-grep matches code by syntax tree, so it survives formatting differences and needs no regex escaping. The patterns below were run against ast-grep 0.51.3 on small TypeScript and TSX samples. Test each one on a small file before running it across a repository.
Install
brew install ast-grep # or: npm install --global @ast-grep/cli
ast-grep --version
The binary is ast-grep (alias sg). An optional agent skill is published at ast-grep/agent-skill (install command not verified here).
When to use it
| Request | Tool |
|---|---|
| Find a string, a name, an import | Grep |
| Find code by meaning ("where is auth handled") | A semantic search tool such as grepai, or an LSP or symbol-aware MCP server |
| Find or rewrite code by structure | ast-grep |
| Rename every call, change an API signature, migrate a framework | ast-grep |
For a small project or a one-off lookup, Grep is enough. ast-grep pays off when the same structural change touches many files.
Quick commands
# One-off pattern ($X = one node, $$$X = zero or more nodes)
ast-grep run -p 'console.log($$$ARGS)' -l ts src/
# Rewrite (preview first, then add --update-all to apply)
ast-grep run -p 'oldApi($A)' -r 'newApi($A)' -l ts src/
# Run a YAML rule file
ast-grep scan -r rules/async-no-try.yml src/
# Machine-readable output
ast-grep run -p 'class $C extends React.Component { $$$ }' -l tsx --json=compact src/
# Print the syntax tree of a pattern when it does not match
ast-grep run --debug-query=ast -p 'foo($A)' -l ts
The language is required for run; use ts for .ts files and tsx for .tsx files, because a rule written for one does not scan the other.
Rule recipes
Each recipe is saved as a rule file (id, language, rule) and run with ast-grep scan -r <file> <path>.
Async functions without try/catch
id: async-no-try
language: tsx
rule:
pattern: async function $F($$$P) { $$$B }
not:
has:
kind: try_statement
stopBy: end
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 197 lines · 85 tokens per session scan A a4fd18044cf1
ast-grep-patterns is a skill published in the GitHub repository FlorianBruniaux/claude-code-plugins (47 stars, last pushed 5d ago), licensed MIT. It adds 85 tokens to every session and 1,569 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-26.
ast-grep-patterns compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| ast-grep-patternsFlorianBruniaux/claude-code-plugins | Skill | 47 | 5d ago | MIT | A | 85 | Claude Code |
| oraclesteipete/oracle | Skill | 4.1k | 3d ago | MIT | A | 18 | Claude Code, Codex |
| review-loopsangrokjung/claude-forge | Skill | 886 | 2mo ago | MIT | A | 100 | Claude Code |
| pentest-forensicsfatihkan/badi | Skill | 8 | 1mo ago | MIT | A | 60 | Claude Code |
| pentest-malwarefatihkan/badi | Skill | 8 | 1mo ago | MIT | A | 69 | Claude Code |
| security-checkfatihkan/badi | Skill | 8 | 1mo ago | MIT | A | 91 | Claude Code |
| bughunterirfad7/claude-power-skills | Skill | 4 | 4mo ago | MIT | A | 103 | Claude Code |