Skip to content
Back to skills

Spec Conformance

ASecurity

Checks on the bdk:verifier agent that the product after a Change - its code and its E2E results - keeps the spec in the Change''s issue (its local copy issue.md under .bdk/runs: acceptance scenarios, acceptance criteria and key decisions), that nothing a user can observe is missing from it, and that the diff left no ADR, module-map or glossary change behind (bdk arch check and bdk adr check at close); writes close/spec-conformance.md with a PASS or FAIL verdict, carrying the scenario and AC t...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
developmentgobashgitdocumentation

Works with

  • cli

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add broneq/bdk --skill spec-conformance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spec Conformance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spec Conformance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/broneq-spec-conformance/badge)](https://www.skillsdirectory.com/skills/broneq-spec-conformance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: spec-conformance
description: 'Checks on the bdk:verifier agent that the product after a Change - its code and its E2E results - keeps the spec in the Change''s issue (its local copy issue.md under .bdk/runs: acceptance scenarios, acceptance criteria and key decisions), that nothing a user can observe is missing from it, and that the diff left no ADR, module-map or glossary change behind (bdk arch check and bdk adr check at close); writes close/spec-conformance.md with a PASS or FAIL verdict, carrying the scenario and AC trace of the last review round over when nothing changed after it and its check passed; with --round it runs as a worker of a review round, writes the round''s report and logs each problem as a finding the review loop fixes. Use when a Change is about to close, when /bdk:close checks its spec, when a review round checks the spec, or when asked whether the issue still matches what the product does.'
argument-hint: "[<change>] [--base <ref>] [--round <round dir>]"
allowed-tools: Bash(${CLAUDE_PLUGIN_ROOT}/bin/bdk *) Bash(git diff *) Bash(git log *) Bash(git show *) Bash(git symbolic-ref *) Bash(git rev-parse *) Bash(git hash-object *) Read Grep Glob Write Agent
---

Current BDK configuration of this project:

!`"${CLAUDE_PLUGIN_ROOT}/bin/bdk" config show`

Arguments: $ARGUMENTS

# Spec conformance

The spec of a Change is its issue: `/bdk:close` opens the pull request and closes the issue with the body as the record of what was built. Check that every scenario, acceptance criterion and key decision of that body is true of the product after the Change, and that nothing a user can observe is missing from it. You read and report; you never fix the spec or the code, and you never run the product, its tests or a command that writes a project file.

When the block above says `BDK not configured` or `BDK configuration invalid`, reply with that line and stop: write nothing. If it shows the command instead of its output, run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" config show` first.

## 0. Run as `bdk:verifier`

This block runs on the `bdk:verifier` agent, whose instructions start with "You are `bdk:verifier`". The conversation that built the Change must not judge its own spec. When you are not that agent (a user typed the command, or `/bdk:close` invoked the skill in the main thread), do not check anything yourself: start the agent with the Agent tool in the foreground (`run_in_background: false`), `subagent_type: "bdk:verifier"`, prompt `Run the skill bdk:spec-conformance with the arguments: <the arguments above>`, `model` set to `models.verifier.model` and `effort` set to `models.verifier.effort`, each only when the configuration above sets it; wait for it, reply with its verdict and report path, and stop. Keep its agent ID: after a fix, `SendMessage` to the same agent checks again.

Done when you are `bdk:verifier`, or the agent has answered.

## 1. Find the Change, the base and the report

- Change: the first argument. Without one, the `current` Change of `.bdk/runs/run.json`, else the only directory under `.bdk/runs/` other than `pr-<N>/` holding an `issue.md`; with none or several, name what you found and stop. `R` is `.bdk/runs/<change>/`.
- Base: `--base <ref>` when given; else the branch `git symbolic-ref --short refs/remotes/origin/HEAD` names; else `main`.
- Round: `--round <round dir>` when given (a review round's lead passes it, `R/review/round-<N>`). It makes this a **round check**: the same check, run while the review loop can still fix what it finds, so close does not stop on it later. Its log is `<round dir>/findings.jsonl`.
- Report: `<round dir>/spec-conformance.md` in a round check; else `R/close/spec-conformance.md`. At close, when the report exists, read it first: its open IDs carry over (step 4). A round check starts a fresh report: the round's findings log carries what is open across rounds.
- Carried trace (at close only): every review round ran this check on the whole Change, so when nothing changed after the last finished round and its check passed, that trace still holds and is not paid for again (ADR-0015). Run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" git scope <base> --rounds R/review --json` and carry the trace over only when all of these hold:
  1. `anchor.kind` is `round` and the result has no `fallback`; `N` is `anchor.round`;
  2. `files`, `binary`, `deleted` and `dirty` are all empty: no commit and no uncommitted change since round `N`;
  3. the frontmatter of `R/review/round-<N>/spec-conformance.md` says `verdict: pass`;
  4. `R/issue.md` and `R/scope-log.md` are the ones that report checked (they are not in git, so step 2 does not see an edit): its `- Spec read:` line under `## Checked` names a hash for each, and `git hash-object R/issue.md` and, when the scope log exists, `git hash-object R/scope-log.md` print the same hashes (`none` for a scope log that is still missing). A report without that line fails this condition.

  Otherwise, and on any `bdk` error, check the whole Change as below.

Done when you know the Change, the base, the round if any, whether an earlier close report exists, and at close whether the trace is carried over from round `N`.

## 2. Read

1. `R/issue.md`, the spec:
   - `## Proposal`: the intent, used to say which side of a disagreement it supports; its `### Acceptance` (every AC that no `By: user` entry of `R/scope-log.md` dropped is a promise the product keeps, as a scenario is), `### What changes` (a **BREAKING** bullet removes or alters behaviour) and `### Out of scope`.
   - `## Acceptance scenarios`: each `### <name>` with its WHEN and THEN lines. `None.` means no behaviour to test: the ACs are then met through the `### Acceptance` list that ends `## Key decisions`.
   - `## Key decisions`: each `### D<n>` and what it binds in the code.
   - When `R/design/gate.md` names `parent: <parent>`, this is a sub-issue: also read `## Key decisions` of `.bdk/runs/<parent>/issue.md`, which bind it too.
   Also `R/scope-log.md` and `R/source/issue.md` when present.
2. The code: `git diff --stat <base>...HEAD`, then the changed files and every file a scenario runs through from its entry point (a command's dispatch, a route, a page, a configuration loader).
3. The latest E2E results, when there are any (skip this in a round check: the round's E2E tester runs after you and logs its own failures): of `R/e2e/verdict.md` and `R/review/round-*/e2e/verdict.md`, the file modified last (Glob lists the newest first); read its verdict and every path file next to it (`<process>--<path>.md`) whose first line is not `Result: pass`. When that verdict is a review round's (`review/round-<N>/e2e/verdict.md`) and a path failed, also run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" findings list .bdk/runs/<change>/review/round-<N>/findings.jsonl --json`: the round's judge levelled each `e2e-check` finding there, and its evidence starts with the path file it is about.
4. In a round check, `R/explore/design.md` when present, as intent only: it says where a fix goes (step 5), never what the code does.
5. In a round check, the fingerprint of the spec you read: `git hash-object R/issue.md` and, when `R/scope-log.md` exists, `git hash-object R/scope-log.md`, with `R` written out. Close compares them to decide whether your trace still holds (step 1).

With a carried trace, read only `R/issue.md` (for the place of an item), the report of round `N`, item 3 and the files the E2E paths name; skip item 2.

Judge from the code and the E2E results only. What a design note, a plan part or a commit message says the code does is a claim, not evidence.

Done when every scenario, AC and key decision is on your list and you know the files that implement them.

## 3. Check

With a carried trace, check only items 2 (E2E failure) below and step 3a; take every other verdict from the report of round `N`: nothing it traced has changed since.

For each scenario, take its own WHEN, follow it from the entry point through the code, and compute the THEN value by value: the text printed, the exit code, the status and body, what the page shows, the file written. The question is whether the sentence is true of the product, not whether the code is good.

Then read each AC's own text. An AC promises every input it names, and a scenario shows only one example: when an AC says "a path absolute or relative to the current directory" and its scenario uses `books/2026.json`, compute the absolute case too (an absolute `$HOME/ledger.json` wrongly joined to the current directory gives `<cwd>/<home>/ledger.json`). Do the same for each class the sentence names: absolute and relative, empty and missing, one and many, "any" or "every" command.

These six problems make the issue a false record of what was built, or ship less than the source asked for. Each one is a `Must address` item:

1. **Contradicted scenario.** The code does not produce the THEN for the WHEN, or no entry point reaches the scenario.
2. **E2E failure** (not in a round check). An E2E path file starts with `Result: fail`: the product breaks a promise of the proposal. The item names the issue line of its `Proposal:` line instead of a scenario. One exception, because close fails only on what changed after the last review round: a failed path of a round verdict is **cleared by the review** when that round's log holds at least one `e2e-check` finding whose evidence names the path file (`<process>--<path>.md`) and every such finding has the level `not-a-problem` - the judge traced the path through the code and the observation does not hold. A cleared path is no item; list it under `Checked` (step 4). Any other failed path stays an item: no finding names it, one is unleveled or at another level (a `blocker` deferred or accepted too: it holds, so shipping it would break the promise), or the verdict is not a round's (`R/e2e/`, which no judge levels). Match by the path file, not by the proposal line: several paths share one line.
3. **Removed but present.** Behaviour a **BREAKING** bullet of `### What changes` removes is still in the product.
4. **Undocumented behaviour.** The diff adds or changes something a user can observe - a command, an option, an output such as an error message, an exit code, an endpoint, a page, a configuration key - that no scenario states, or that `### Out of scope` excludes. The scenarios are what the acceptance tests check, so an AC or a `### What changes` bullet that names the behaviour without a scenario stating it ("a one-line error", with no scenario giving the text and the exit code) does not document it; only when `## Acceptance scenarios` says `None.` do an AC and the `### Acceptance` of `## Key decisions` count. Internal code (a refactor, a helper, a test) never needs a scenario.
5. **Key decision not kept.** The code contradicts a decision of `## Key decisions` (its own or the parent's): another format, another module, an alternative the decision rejected.
6. **Acceptance criterion not kept.** An AC of step 2 that the product does not meet, traced from its entry point through the code with its own example as a scenario is; an AC the product or the scenarios narrow or change with no `By: user` entry of `scope-log.md` naming it (an entry `By: setting ...` or `By: needs-user` does not count); an AC whose only coverage is a deferred finding of a review round (`## Deferred` of `R/review/result.md`, or a finding decided `defer`) with no `By: user` entry for it: deferred without the user is not coverage. The item names the AC id and quotes it; its `Evidence:` is the code line, or the deferred finding.

Everything else you notice goes to `Should consider`: wording a test cannot check, a scenario no user can observe, a class or function name inside a scenario. Not a problem: code quality, test coverage, style; reviews own those.

Done when every scenario, AC and key decision has a verdict and the diff's user-visible behaviour is matched to the issue or listed.

## 3a. Check the living documentation

The diff must not leave the project's ADRs, module map and glossary behind (ADR-0028, rule `BDK-ARCH-8`). Read the ADR index at `docs.adr.index`, the module map of `docs.architecture` (its `yaml bdk-architecture` block) and the glossary at `docs.glossary` of the configuration above, each when it exists, and `### Living documentation` of `## Key decisions` (the parent's too for a sub-issue).

1. **Checks** (at close only; in a round check `bdk check` runs them): run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" arch check` when the architecture doc exists, and `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" adr check` when the ADR directory `docs.adr.dir` exists. Exit 1 is a red check: a `Must address` item, because a red check is a `blocker` (ADR-0006); its `Evidence:` is the problem line the command printed (`src/export belongs to no module`).
2. **Left behind.** Compare `git diff --name-status <base>...HEAD` and the changed code with the three documents. Each of these is an `L<n>` item:
   - **New module**: the diff adds, moves or removes a module, or changes the modules one uses (a new import across module paths), and the module map does not say so.
   - **New term**: the diff introduces a domain term (a new concept in names a user or domain expert would recognise, in user-facing text, in the scenarios) the glossary lacks, or uses a word the glossary lists under `_Avoid_`. Only when the glossary exists or the diff adds the project's first domain term; general programming terms never count.
   - **New decision**: the diff takes a decision that meets the ADR bar (hard to reverse, surprising without context, the result of a real trade-off: a storage format, a protocol, a new dependency, a boundary) that no ADR records, or contradicts an ADR in force.
   - **Promised, not made**: a bullet of `### Living documentation` the diff does not carry out (a module-map or glossary change missing, an ADR still `proposed` or missing).

Each `L` item names the kind, what the diff does (file and line) and where the knowledge goes (the map entry, the glossary entry, an ADR through `/bdk:adr`). An `L` item does not fail the verdict: a missed update is a maintenance cost, `should-fix` by ADR-0006, never a product defect; only a red check of item 1 is.

With a carried trace, run item 1 and copy the `L` items of the report of round `N` for item 2: the diff they compared is the same.

Done when both checks ran (at close) and every module, term and decision of the diff is matched to its document or listed.

## 4. Sort and write

Write the report of step 1 in the report body of your agent instructions:

```markdown
---
verdict: fail
---

## Must address
- M1 issue.md "Empty notebook": the scenario says `notes export` prints `[]` and exits 0; the code exits 3 when the notebook has no entries. The proposal asks for an empty export, so the code is the side that disagrees.
  Evidence: src/export.js:18 `if (entries.length === 0) process.exit(3)`
- M2 no scenario of issue.md states `notes export --gzip`, which this Change adds (src/cli.js:41).
  Evidence: src/cli.js:41 parses `--gzip`; no scenario states it

## Should consider
- S1 issue.md "Two notes": the scenario names the function `serializeNotes`; a reader of the issue needs the command only.

## Living documentation
- L1 new module: src/export/ (src/export/csv.js:1) is a module the module map of docs/architecture.md does not list; add `export` (path `src/export`, uses `ledger`) and run bdk arch render.

## Checked
- "Two notes": src/export.js:12 prints both notes as a JSON array, exit 0.
- AC-1: met by "Two notes".
- D1 (JSON, not CSV): src/export.js:12 writes JSON.
- E2E: `Verdict: PASS`, 2 processes, 7 paths (review/round-1/e2e/verdict.md).
```

- Each `Must address` item names the place in the issue (the scenario's `###` name, the AC id, the decision `D<n>` or the `### What changes` bullet), what the issue says, what the product does, and, when the proposal settles it, which side disagrees with the intent. Its `Evidence:` line is a file and line with what the code does there, or the E2E path file.
- With a carried trace, `Checked` starts with `- Trace carried over from review/round-<N>/spec-conformance.md (verdict: pass): no commit, issue or scope-log change since round <N>.`, followed by the `Checked` items of that report as written, without its `E2E: not read (round check)` and `Spec read:` lines; its `Should consider` items go under `Should consider` as written.
- `Checked` lists each scenario, AC and decision that holds, with where it holds, and states the E2E input: the verdict read with the path of its file under `R`, or `no E2E results` when no E2E verdict exists (a `SKIPPED` or `BLOCKED` verdict is stated the same way); in a round check, `E2E: not read (round check)`, followed by `- Spec read: issue.md <hash>, scope-log.md <hash or none>` with the hashes of step 2. Each failed path cleared by the review goes on that `E2E:` line, with the path file, the finding id and the judge's `levelReason`, e.g. `E2E: Verdict: FAIL (review/round-1/e2e/verdict.md); cleared by the review: see-total--empty-ledger.md (f-4d2e8a1c7b90, not-a-problem: load() returns [] without a ledger)`; `/bdk:close` copies that line into the pull request.
- `verdict: fail` if and only if `Must address` holds an item; `L` items never change it. An empty section holds `- None.`
- IDs: at close, when step 1 found an earlier report, keep the ID of every problem still open, give a new problem the next unused number, and list them as `closed: [<IDs>]` (or `closed: []`) in the frontmatter. Then replace the file: there is one report per Change, read by `bdk run status`. A first report has no `closed` key.

Change no other file; a round check also appends to its log (step 5).

Done when the report exists and its frontmatter holds the verdict.

## 5. Log the findings (round check only)

Skip this step at close. In a round check, the round's judge, triage and fix planning act only on what is in the log, so append one finding per `Must address` item, each command on its own:

```
"${CLAUDE_PLUGIN_ROOT}/bin/bdk" findings add <round dir>/findings.jsonl --source spec-conformance --file <path> --line <n> --summary "<one line: what is wrong>" --evidence "<the item's ID (M1), its place in the issue, what the issue says, what the product does, and which side the proposal supports>"
```

`--file` is repository-relative. `--file` and `--line` are where the fix goes, because the fix planner plans a change there:

- The code breaks what the proposal asks for (a contradicted scenario, a broken AC or key decision, behaviour that is still there, behaviour the proposal does not ask for): the code line, as in the item's `Evidence:`.
- The issue misses or misstates behaviour the proposal or a key decision settles, and neither contradicts (an undocumented error message every command prints): `.bdk/runs/<change>/issue.md`, at the scenario it belongs to, else the line of `## Acceptance scenarios`.
- The proposal settles neither side: `issue.md` at the same place, and say so in the evidence; the fix planner leaves it to the user.
- An AC not kept: the code line where the AC is not met; for an AC changed or deferred without the user, the line of the AC in `issue.md`, and say in the evidence that only the user can change it (a `scope-log.md` entry `By: user`).

Then one finding per `L` item, with its own source and the rule, so the judge levels it as a broken rule (`should-fix`), not as a spec mismatch:

```
"${CLAUDE_PLUGIN_ROOT}/bin/bdk" findings add <round dir>/findings.jsonl --source living-docs --rule BDK-ARCH-8 --file <path> --line <n> --summary "<one line: what the diff left behind and where it goes>" --evidence "<the item's ID (L1), its kind, what the diff does and the document entry to write>"
```

`--file` and `--line` point at the document to change (the architecture doc, the glossary, the ADR directory's index) when it exists, else at the code that needs it.

Then run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" findings list <round dir>/findings.jsonl` and check that each `M` item has its finding with the source `spec-conformance` and each `L` item one with the source `living-docs`.

Done when every `Must address` item is in the log.

## 6. Reply

Reply with four lines at most: the verdict, the report path, the `Must address` IDs and the `L` IDs (in a round check, the ids of the findings you added).

At close, when continued after a fix, go back to step 1: read the report you wrote, check again, and replace it with the next one.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.