spec-trace-gate
Skill0 starsChanged 5 months agoMITView on GitHub
Machine-checks that every requirement in a spec is covered by a task and every task is verified by a test that actually exists (spec to task to test traceability), failing on any dropped requirement, phantom reference or missing test. Use when writing acceptance criteria, breaking a spec into tasks, checking whether an implementation really closes over its spec, or adding a requirements-coverage gate to CI.
In this repository5 other files it gives its agents.
- adversarial-review-gateSkill
- done-gateSkill
- launch-checkSkill
- proven-code-reviewSkill
- verify-gateSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Find or write the spec: If the user has none, draft one from their request with assets/spec-template.md and show it to them before going on.
- Distinctive: line 59
Never shorten a selector to a generic fragment just to make it match.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Spec ↔ task ↔ test traceability gate
Spec-driven workflows (GitHub Spec Kit, AWS Kiro, BMAD) give you Specify → Plan → Tasks → Implement, but nothing proves the finished code closed over the spec. Drift is caught by a human, if at all. This skill turns that proof into a pass/fail command.
The contract
Three inputs:
- Spec: acceptance criteria, each tagged with a stable id
AC-Nand written in EARS (references/ears.md). Tasks: one block per task:
## T-3 — Race-safe idempotency under concurrent duplicates Serialise the check-then-insert so N concurrent duplicates yield exactly one result. covers: AC-3 verified_by: test_concurrent_duplicate_key_single_posting- Tests directory of the project (Python, TS/JS, Go, Java/Kotlin, Ruby and C# file
conventions are recognised by default; override with
--test-glob).
The gate fails on any of:
| Violation | Meaning |
| UNCOVERED acceptance criterion | An AC-N in the spec that no task covers:. A requirement was dropped. |
| ORPHAN task reference | A task covers: an AC-N that is not in the spec. Phantom work, or a typo. |
| UNVERIFIED task | A verified_by: name that does not appear, as a whole identifier, in any test file. |
Procedure
- Find or write the spec. If the user has none, draft one from their request with
assets/spec-template.mdand show it to them before going on. Each AC states one observable behaviour, uses an EARS pattern, and keeps its id forever (never renumber; retire ids instead). - Write the tasks file with
assets/tasks-template.md. Small, single-responsibility tasks, ordered so earlier ones unblock later ones. If a test does not exist yet, name the exact test that must be written and say so in the task body. Structure check, right after planning (no tests needed yet):
python <this-skill-dir>/scripts/trace_gate.py --spec <spec.md> --tasks <tasks.md> \ --tests-dir <tests/> --structure-only- Full check, after implementation: the same command without
--structure-only. - On FAIL, fix the cause, never the report:
- uncovered AC → add or extend a task; only drop the AC if the user explicitly agrees;
- orphan reference → correct the id, or add the missing AC to the spec with the user;
- unverified task → write the named test, or point
verified_by:at the real test name. Never shorten a selector to a generic fragment just to make it match.
- Report the verdict line exactly as printed (
TRACE: PASS/TRACE: FAIL) together with the violation lines. Do not paraphrase a gate result. - CI (optional, ask the user first):
assets/ci-github-actions.ymlruns the full gate on every push and pull request.
Notes
scripts/trace_gate.pyneeds Python 3.10+ and the standard library only. It reads the three inputs, prints a report and exits 0 or 1. It writes nothing and makes no network calls.- Matching is by whole identifier:
test_replaydoes not matchtest_replay_across_restart. - A spec with no
AC-Nids passes trivially. If you seeacceptance criteria: 0, the spec is not in the expected shape; fix that first. - For non-standard test layouts pass one or more
--test-globpatterns (e.g.--test-glob '*.rs').
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

