sparq: Skill for Claude Code

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

ast-grep is a skill for Claude Code from sparq-org/sparq. It costs 0 tokens per session (6,494 once invoked), scanned A, original, MIT.

A guide to understanding large source files by viewing their structure and matching code patterns instead of reading every line. It uses ast-grep, which searches code by its syntax, plus editor outlines and language-server tools.

In plain words
What is it for?
Use it to find how a feature is organised, locate all implementations of a Rust trait, or find callers of a function in a large project.
Why use it?
It reduces the need to load entire files when you only need function definitions, trait implementations, or places where something is called.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions subagents; mentions AGENTS.md.

This is sparq-org/sparq's own configuration. It tells Claude Code how to work on sparq itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything sparq configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is bash bench/ast-compact/compact_ast.sh crates/sparq-engine/src/exec.rs # -> "<line> <signature>" per item.

Part of the sparq plugin — 55 skills, 20 agents, 2 hooks shipped together

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/sparq-org/sparq/main/.claude/skills/ast-grep/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/sparq-org/sparq

Made for: Claude Code.

Or install sparq, the plugin that ships this one along with the rest of its 55 skills, 20 agents, 2 hooks.

Wrote 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.

agentmods badge for ast-grep

README.md
[![agentmods](https://agentmods.dev/badge/skills/sparq-org/sparq/ast-grep/github.svg)](https://agentmods.dev/skills/sparq-org/sparq/ast-grep)
Your own site
<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.

agentmods 80×15 button for ast-grep

Your own site · 80×15
<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>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,494 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
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
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 10d ago against content hash e0b6a26a7ffb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

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.

.claude/skills/ast-grep/SKILL.md · 409 lines

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 + Read baseline 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 scoped Read. Their edge over a competent grep -rn is 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.

Read the full file on GitHub · 409 lines

Files

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.

Changes

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.

  1. 10d ago First seen · 409 lines · 0 tokens per session scan A e0b6a26a7ffb

Subscribe to this mod's changes

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.

Related

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.

emdash-cms/emdash · 71 tokens

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.

open-gsd/gsd-core · 16 tokens

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…

jeremylongshore/tons-of-skills-marketplace · 115 tokens

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.

hashgraph-online/awesome-codex-plugins · 58 tokens

cleanup-code-inspections

Reduce technical debt and improve code quality by systematically resolving static analysis warnings.

flutter/flutter-intellij · 19 tokens

dorodango

Polishes working code through successive quality passes in fresh subagents. Use after tests pass when code needs multi-dimension refinement before release.

athola/claude-night-market · 31 tokens