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 rolandbrecht/agent-skills --skill ast-grepgit clone --depth 1 https://github.com/rolandbrecht/agent-skillsWrote 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/rolandbrecht/agent-skills/ast-grep)<a href="https://agentmods.dev/skills/rolandbrecht/agent-skills/ast-grep"><img src="https://agentmods.dev/badge/skills/rolandbrecht/agent-skills/ast-grep/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/rolandbrecht/agent-skills/ast-grep"><img src="https://agentmods.dev/badge/skills/rolandbrecht/agent-skills/ast-grep.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.00193 | $0.02018 |
| Opus 5 | $0.00097 | $0.01009 |
| Sonnet 5 | $0.00039 | $0.00404 |
| Haiku 4.5 | $0.00019 | $0.00202 |
Grade A, and why
ast-grep 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 10d 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 — 147 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep — Structural Code Search, Lint, and Rewrite
Content verified against ast-grep 0.45.1. Flags can drift between versions — when a command fails, check ast-grep <cmd> --help.
Overview
ast-grep is a fast, Rust-based CLI tool. It parses code with tree-sitter and matches the syntax tree, not the text. You write patterns that look like the code you search for. Metavariables ($NAME, $$$ARGS) act as wildcards for AST nodes.
Three main modes:
| Mode | Command | Use for |
|---|---|---|
| Search / rewrite | ast-grep run -p '<pattern>' (default command) |
One-time queries and codemods |
| Lint | ast-grep scan |
YAML rule sets, CI checks, complex rules |
| Explore | ast-grep outline |
Symbols, imports, exports of files |
It supports 25+ languages: JavaScript, TypeScript, TSX, Python, Rust, Go, Java, C, C++, C#, Kotlin, Swift, Ruby, PHP, and more. See the language table in references/cli-reference.md.
Installation
Check first: which ast-grep. If it is not installed, run the bundled helper:
bash <SKILL_DIR>/scripts/install.sh
The script tries brew, cargo, npm, pip3, and MacPorts in order, and verifies the result. For manual installation see https://ast-grep.github.io/guide/quick-start.html.
Note: some systems have a different sg binary (shell group). Always use the full name ast-grep.
Tool Selection: grep vs ast-grep vs LSP
| The question is about... | Use |
|---|---|
| Text: strings, error messages, config values, file names | grep / rg / fd |
| Syntax: "all calls that look like X", pattern rewrites, codemods, lint rules | ast-grep |
| Semantics: go-to-definition, find-references across scopes, types, scope-aware rename | LSP / compiler tooling |
| Graphs: transitive callers, circular imports, dead-code detection across a whole codebase | A graph script over ast-grep --json output; ast-grep alone sees only per-file matches |
ast-grep matches syntax, not semantics. It cannot tell two same-named symbols in different scopes apart. A rename with ast-grep is an exact syntactic replace (it skips comments, strings, and oldNameHelper), but it hits every scope. For a true semantic rename, prefer an LSP rename; use ast-grep when no LSP is available and verify the diff.
What ships with it
7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 10d ago First seen · 147 lines · 193 tokens per session scan A dbfe380b9d55
ast-grep is a skill published in the GitHub repository rolandbrecht/agent-skills (4 stars, last pushed 27d ago), licensed MIT. It adds 193 tokens to every session and 2,018 once invoked, about $0.0010 per session on Opus 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-08-31.
Other skills, from other repositories
cocoreview
CocoReview — structured code review with six-severity findings vocabulary, progressive disclosure architecture, and universal anti-pattern baseline. Invoked via $review [file] [--complexity] [--security] [--architecture] [--language ].
meter-reconcile
Skill-native CocoMeter transcript reconciliation and adapter canary. Replaces the former meter-reconcile and adapter-self-test runtime helpers.
stall-reset
Reset CocoStall counters after an operator-approved recovery.
stall-status
Report current CocoStall no-progress and loop state.
stall-thresholds
Show or update CocoStall thresholds.
stall
Show CocoStall loop and no-progress detection status.