agent-spec: Skill for Claude Code

.claude/skills/agent-spec-tool-first/SKILL.md

agent-spec-tool-first is a skill for Claude Code from ZhangHanDong/agent-spec. It costs 165 tokens per session (9,039 once invoked), scanned A, original, MIT.

A workflow guide for agent-spec, a command-line tool for contract-driven AI coding. It explains how to plan from task contracts, implement within stated boundaries, verify code, review results, and record checkpoints.

In plain words
What is it for?
Use it when creating or reviewing specifications, generating plans, running lifecycle or guard checks, explaining verification results, stamping Git metadata, and debugging failed checks.
Why use it?
It gives coding agents a repeatable way to turn requirements into implementation checks. It also explains how to interpret verification failures and what to do when the command-line tool is missing.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md; mentions AGENTS.md; mentions Codex.

This is ZhangHanDong/agent-spec's own configuration. It tells Claude Code how to work on agent-spec 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 agent-spec configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ZhangHanDong/agent-spec. 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/ZhangHanDong/agent-spec/main/.claude/skills/agent-spec-tool-first/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ZhangHanDong/agent-spec

Made for: Claude Code.

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 agent-spec-tool-first

README.md
[![agentmods](https://agentmods.dev/badge/skills/zhanghandong/agent-spec/agent-spec-tool-first/github.svg)](https://agentmods.dev/skills/zhanghandong/agent-spec/agent-spec-tool-first)
Your own site
<a href="https://agentmods.dev/skills/zhanghandong/agent-spec/agent-spec-tool-first"><img src="https://agentmods.dev/badge/skills/zhanghandong/agent-spec/agent-spec-tool-first/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 agent-spec-tool-first

Your own site · 80×15
<a href="https://agentmods.dev/skills/zhanghandong/agent-spec/agent-spec-tool-first"><img src="https://agentmods.dev/badge/skills/zhanghandong/agent-spec/agent-spec-tool-first.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 165 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 9,039 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 medium

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 →

  • medium System Prompt Leakage · line 532
    Skill contains patterns that could indirectly extract system prompts through rephrasing, translation, summarization, or side-channel techniques.
    Fix: Guard against indirect extraction by refusing to summarize, translate, or rephrase system instructions. Add explicit anti-extraction clauses.
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.00165 $0.09039
Opus 5 $0.00082 $0.04519
Sonnet 5 $0.00033 $0.01808
Haiku 4.5 $0.00016 $0.00904

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

Security

Grade A, and why

agent-spec-tool-first 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 9d 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/agent-spec-tool-first/SKILL.md · 611 lines

How it starts

The opening of the file, as written. The whole thing — 611 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Spec Tool-First Workflow

Version: 3.7.0 | Last Updated: 2026-07-22 | Tracks agent-spec: 1.2.0 (stability promise)

You are an expert at using agent-spec as a CLI tool for contract-driven AI coding. Help users by:

  • Planning: Render task contracts with contract, generate plan context with plan
  • Implementing: Follow contract Intent, Decisions, Boundaries
  • Verifying: Run lifecycle / guard to check code against specs
  • Reviewing: Use explain for human-readable summaries, stamp for git trailers
  • Debugging: Interpret verification failures and fix code accordingly

IMPORTANT: CLI Prerequisite Check

Before running any agent-spec command, Claude MUST check:

command -v agent-spec || cargo install agent-spec

If agent-spec is not installed, inform the user:

agent-spec CLI not found. Install with: cargo install agent-spec

Core Mental Model

The key shift: Review point displacement. Human attention moves from "reading code diffs" to "writing contracts".

Traditional:  Write Issue (10%) → Agent codes (0%) → Read diff (80%) → Approve (10%)
agent-spec:   Write Contract (60%) → Agent codes (0%) → Read explain (30%) → Approve (10%)

Humans define "what is correct" (Contract). Machines verify "is the code correct" (lifecycle). Humans do final "Contract Acceptance" — not Code Review.

Quick Reference

Command Purpose When to Use
agent-spec init Scaffold new spec Starting a new task
agent-spec contract <spec> Render Task Contract Before coding - read the execution plan
agent-spec lint <files> Spec quality check After writing spec, before giving to Agent
agent-spec plan <spec> --code . Generate plan context Before coding - codebase scan + task sketch
agent-spec lifecycle <spec> --code . Full lint + verify pipeline After edits - main quality gate
agent-spec guard --spec-dir specs --code . Repo-wide check Pre-commit / CI - all specs at once
agent-spec explain <spec> --format markdown PR-ready review summary Contract Acceptance - paste into PR
agent-spec explain <spec> --history Execution history See how many retries the Agent needed
agent-spec stamp <spec> --dry-run Preview git trailers Before committing - traceability
agent-spec graph --spec-dir specs Dependency graph (DOT) After writing specs - visualize deps & critical path
agent-spec requirements graph --gate Validate KLL requirements and dependency graph After importing PRD/issue requirements
agent-spec wiki status Check stale code live wiki articles Session start / before broad source reading
agent-spec wiki query <text> Search tracked live wiki articles Before opening many source files
agent-spec wiki check Live wiki lint + worktree status gate Pre-commit / CI for tracked wiki
agent-spec atlas build/tree/query/search/explore/context/flow/impact/affected/refs/impls/status/check/scip-gen Rust graph with scored retrieval, bounded context projection, explainable paths, reverse impact, identity, and independent syn/SCIP/MIR freshness; scip-gen invokes rust-analyzer for the optional SCIP overlay Build before querying; use --frozen for review, and never infer tests from affected filenames
agent-spec atlas benchmark validate/plan/summarize/score Validate offline evaluation inputs and gate query-quality observations Evaluate correctness before performance; default tests do not invoke a model or network
agent-spec atlas benchmark agent-plan/agent-gate Compile and gate matched Read/Grep, Atlas primitive, and context arms Real execution is opt-in; a checked-in plan is not adoption evidence
agent-spec atlas benchmark serving-plan/serving-gate Compile and gate direct/worker burst trials Keep worker serving opt-in until real evidence is accepted
agent-spec atlas provider validate/conformance Validate external Code Graph providers and run the F1 conformance matrix Conformance proves adapter behavior, not language quality
agent-spec verify <spec> --code . Raw verification only When you want verify without lint gate
agent-spec checkpoint status VCS-aware status Check uncommitted state

Read the full file on GitHub · 611 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. 9d ago First seen · 611 lines · 165 tokens per session scan A 009b8a6485c4

Subscribe to this mod's changes

agent-spec-tool-first is a skill published in the GitHub repository ZhangHanDong/agent-spec (454 stars, last pushed 10d ago), licensed MIT. It adds 165 tokens to every session and 9,039 once invoked, about $0.0008 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-30.