Borrowing it
Nothing to install: this file belongs to sparq-org/sparq. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/sparq-org/sparq/main/.claude/skills/ast-grep/SKILL.mdgit clone --depth 1 https://github.com/sparq-org/sparqWrote 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/sparq-org/sparq/ast-grep)<a href="https://agentmods.dev/skills/sparq-org/sparq/ast-grep"><img src="https://agentmods.dev/badge/skills/sparq-org/sparq/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/sparq-org/sparq/ast-grep"><img src="https://agentmods.dev/badge/skills/sparq-org/sparq/ast-grep.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 1 finding, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Agent Snooping · line 202 Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
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.00000 | $0.06494 |
| Opus 5 | $0.00000 | $0.03247 |
| Sonnet 5 | $0.00000 | $0.01299 |
| Haiku 4.5 | $0.00000 | $0.00649 |
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 — 409 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep + outline: read STRUCTURE, not whole files
[OPUS-4.8] Internal agent skill. Authored by Opus 4.8 (Fable unavailable — flag
for re-review when Fable returns). Design basis:
research/agent-effectiveness-program.md §2.2 (the query-type → tool map) and
the shared A/B protocol in research/dogfooding-sparq-knowledge-graph.md §5.
The single load-bearing idea: a "where / how is X done" question over a big file
or a 37-crate workspace usually does not need the file's bytes — it needs the
file's skeleton (signatures) or a structural match (all impls of a trait,
all call sites of a function). Reading the whole file to answer it spends tokens
proportional to the file, not the answer. ast-grep gives you the answer-sized
view: tree-sitter structural matching with file:line hits, zero runtime deps.
This is a tool, not a verdict. Whether ast-grep + outline actually beats the
Grep+Readbaseline on agent tokens for this repo is decided by the §5 A/B (see the bottom of this file), not by this skill. Use the recipes; do not cite an unmeasured saving.Honest scope — the verdict splits by the SHAPE of the task (two firm real-token A/Bs settle it; §5). Whether a structural view saves tokens depends on the question class:
- Scoped code-structure LOOKUP ("where / how is X", "every impl of T"): ast-grep
- outline are precision / completeness tools, measured NOT to save tokens — the firm A/B (
bench/pkg-dogfood/RESULTS-astgrep.md) found going outline/ast-grep-FIRST on a lookup is slightly MORE expensive end-to-end than a scopedRead. Their edge over a competentgrep -rnis precision and completeness: they skip the same token inside comments/strings and match shapes a line-regex cannot ($X.map($$$).collect(), a call with a specific arg), and in that A/B that bought a small quality nudge on call-site completeness — not a raw token cut. For a lookup, reach for ast-grep when grep's false positives or its inability to express a structure actually bite, or when you must NOT miss an impl/call-site; do not reach for it to cut tokens.- Whole-file-SHAPE understanding, or a structural edit / codemod over a LARGE file: generating a compacted-AST skeleton FIRST and working over it IS a measured token-saver — a second firm A/B (
bench/ast-compact/RESULTS.md) found the compacted-AST-first arm cheaper at equal quality on the large majority of such tasks, with the win growing with file size / structural breadth. See the recipe in §2.6 and the decision rule below.Decision rule: scoped lookup answerable by a narrow read → just
Read(don't pay the structural-view setup tax; both A/Bs show it slightly hurts on a small, already-narrow task); whole-file shape, or a cross-file structural edit/codemod over a large file → build the compacted-AST skeleton (§2.6) first. The narrow "outline only a very large single file's skeleton to locate a span" lever (§2.1, §4) is the lookup-side floor of this same rule.
What ships with it
1 file 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 · 409 lines · 0 tokens per session scan A e0b6a26a7ffb
ast-grep is a skill published in the GitHub repository sparq-org/sparq (12 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 6,494 tokens. 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
adversarial-reviewer
Adversarial code review that assumes bugs exist and hunts for them. Use when asked to review code, find bugs, audit for correctness, stress-test a PR, or when someone says "tear this apart" or "what's wrong with this". Give no benefit of the doubt — every line is guilty until proven innocent.
gsd-ns-review
Route to the appropriate quality / review skill based on the user's intent. gsd-code-review-fix was absorbed by gsd-code-review --fix in #2790.
issue
Use when starting a chain from a GitHub issue — turning an issue URL or number into a triaged, planned, dispatched, and reviewed pull request. Classifies the thread (bug → root-cause discipline, feature → plan chain, question → drafted reply), synthesizes a spec from the issue's own acceptance criteria, then runs the…
gitnexus
A code-graph analysis add-on for examining an existing codebase, including symbols, call paths, execution flows, and effects across repositories. It can query GitNexus through its command-line or MCP interfaces.
cleanup-code-inspections
Reduce technical debt and improve code quality by systematically resolving static analysis warnings.
dorodango
Polishes working code through successive quality passes in fresh subagents. Use after tests pass when code needs multi-dimension refinement before release.