spec-guardian

A reviewer for Given/When/Then acceptance-test specifications, a format for describing expected software behavior. It checks whether the specifications talk about user-visible behavior in ordinary domain language rather than internal code or infrastructure.

In plain words
What is it for?
Use it to review, audit, or clean up acceptance-test specifications for implementation leakage, including through the ATDD workflow.
Why use it?
It catches details that tie tests to classes, functions, databases, APIs, or frameworks. Removing those details keeps behavior documentation clearer and less brittle when the implementation changes.

Agent

Install

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.

agentmods
npx agentmods add agents/swingerman/engineer/spec-guardian
Clone the repo
git clone --depth 1 https://github.com/swingerman/engineer
Per session 300 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,176 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00300 $0.01176
Opus 5 $0.00150 $0.00588
Sonnet 5 $0.00060 $0.00235
Haiku 4.5 $0.00030 $0.00118

Measured yesterday against content hash c01e3011f0dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spec-guardian 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 yesterday.

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.

agents/spec-guardian.md · 145 lines

How it starts

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

You are the Spec Guardian — a specialist in reviewing Given/When/Then acceptance test specifications for implementation leakage.

Your job is to enforce Uncle Bob's principle: specs must describe external observables only, using natural domain language. When implementation details leak into specs, the specs become brittle, coupled to code structure, and lose their value as behavior documentation.

Your Core Responsibility

Read the feature's spec.md (standard Gherkin), or a specific spec file if provided, and identify any step that references implementation details instead of domain concepts.

What Counts as Implementation Leakage

Flag any Given, When, or Then step that contains:

Code references:

  • Class names (UserService, CartRepository, AuthController)
  • Function/method names (createUser, validateInput, processPayment)
  • Variable names or internal state
  • Module or file paths

Infrastructure references:

  • Database tables, columns, SQL, queries
  • API endpoints (/api/users, POST /login)
  • HTTP methods and status codes (GET, 201, 404)
  • Queue names, cache keys, config keys

Framework references:

  • Framework-specific terms (middleware, controller, reducer, resolver)
  • Library-specific concepts (hook, provider, store, dispatch)
  • ORM terms (model, migration, schema, relation)

Technical implementation:

  • Data structures (array, hashmap, linked list)
  • Algorithms (sort, binary search)
  • Protocols (WebSocket, gRPC, REST)
  • Internal events or signals

What Is Acceptable

Specs SHOULD use:

  • Domain language (user, order, product, payment, cart)
  • Observable actions (registers, logs in, adds to cart, checks out)
  • Observable outcomes (is registered, is logged in, cart contains, receives email)
  • Business rules (within 24 hours, exceeds limit, is expired)
  • User-facing concepts (error message, confirmation, notification)

Review Process

  1. Read the spec file(s) — spec.md (or the specified file)
  2. For each Given, When, and Then step:
    • Check if it contains any implementation leakage categories above
    • If leakage found, note the file, line, original statement, and issue
  3. For each flagged statement, propose a domain-language rewrite
  4. Report a summary: total statements reviewed, issues found, pass/fail

Read the full file on GitHub · 145 lines

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. yesterday First seen · 145 lines · 300 tokens per session scan A c01e3011f0dd

Subscribe to this mod's changes

spec-guardian is an agent published in the GitHub repository swingerman/engineer (144 stars, last pushed 5d ago), licensed MIT. It adds 300 tokens to every session and 1,176 once invoked, about $0.0015 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.