Sub topic 13
Tooling that supports spec-driven development
Spec-driven development works with plain files and a text editor. Tooling makes it easier to keep up. It can generate the spec files, load them into the agent's context, check the agent's output, and flag drift. This chapter covers the categories of tooling, what each one does, and how to choose among them.
This chapter assumes you have read the earlier chapters on the requirements, design, and tasks phases. It also assumes you can read a short Python script and a CI configuration file, and that you use Git.
Start from the artifacts, not the tool
A spec-driven workflow produces a small set of files:
requirements.md, with user stories and acceptance criteria.design.md, with decisions, interfaces, and data shapes.tasks.md, with ordered tasks that reference requirements.- A project instruction file, such as
AGENTS.md, with standing rules. - Tests that encode the acceptance criteria.
Tools differ in how they create and use these files. The files themselves are ordinary Markdown and code, kept in Git. If you keep them in a plain, documented layout, you can change tools later without rewriting your specs.
Categories of tooling
Most tooling falls into five categories. A real setup often combines several.
| Category | What it does | Examples of the kind of thing it is | What to check before adopting |
|---|---|---|---|
| Spec-aware agent environments | Guide you through requirements, design, and tasks, and run tasks one at a time | Kiro, which has a built-in spec workflow; GitHub Spec Kit, an open-source toolkit that adds spec commands to existing agents | Where files are stored, whether you can edit them by hand, whether the format is documented |
| General coding agents | Read files and edit code, with no built-in spec phases | Terminal and IDE agents | How they load instruction files, and whether they stop between tasks |
| Instruction file conventions | Give standing rules to the agent | `AGENTS.md` and tool-specific files | Which file names each agent reads, and whether nested files are supported |
| Verification tooling | Checks the output against the spec | Test runners, linters, type checkers, coverage tools | Whether it runs locally and in CI with the same command |
| Review and automation | Enforces gates before merge | Git hosting pull requests, branch protection, CI | Whether a failing check blocks merging |
Product features change quickly, so check each tool's current documentation before you commit to it. The categories change much more slowly than the products.
Spec-aware agent environments
These tools build the three-phase workflow into the product. Typically you describe a feature, the tool drafts requirements, you review and edit them, and the tool then moves to design and tasks. Some let you run a task from the task list with one action and show which task is in progress.
The benefit is that the process is hard to skip. The agent cannot jump to code, because the next phase waits for your approval. The cost is coupling. If the tool stores specs in its own folder with its own conventions, your team members who use a different tool see only files they did not choose.
Evaluate these tools with a few concrete questions:
- Are the generated files plain Markdown that you can edit by hand?
- Can you commit them, and do they diff cleanly in a pull request?
- Does the tool stop after each phase for your approval, or can it run ahead?
- Does it stop after each task, or run the whole list?
- Can you run it against an existing codebase, or does it assume a new project?
Question 3 and 4 matter most. A tool that runs all tasks without pausing removes the review gates you built the workflow to create.
General agents with spec files
You do not need a spec-aware product. A general coding agent can follow the workflow if you give it the right instructions. You write or generate the three files, then prompt the agent with something like "Implement task 2 from specs/password-reset/tasks.md. Do not start task 3."
This approach gives you the most control and the least lock-in. It also relies on your discipline. Nothing in the tool prevents you from skipping the review of design.md. A project instruction file helps here, because it states the rules once, and the agent reads them at the start of each session.
# AGENTS.md
## Workflow
- Read the relevant spec in `specs/<feature>/` before changing code.
- Work on one task from `tasks.md` at a time and stop for review after each.
- Do not change requirements. If one looks wrong, say so and ask.
## Conventions
- Run `pytest` before reporting a task as done.
- Keep new modules under `src/` and tests under `tests/`.Different agents read different file names. AGENTS.md is a widely used convention, but some tools read their own file instead or in addition. If your team uses more than one agent, keep one source of truth and have the other files point to it, or generate them from it. Two instruction files that disagree produce the same inconsistency you wrote the spec to avoid.
Verification tooling
The spec tells the agent what to build. Verification tooling tells you whether it did. This is the part of the toolchain you should invest in first, because it works with any agent.
Useful layers, from fastest to slowest:
- A formatter and linter, which catch style problems in seconds.
- A type checker, which catches interface mismatches between modules.
- Unit tests that encode acceptance criteria, as in the earlier chapter on turning criteria into tests.
- Integration tests for behavior that crosses modules.
- A traceability check, which confirms that every requirement is covered by a task.
The first four are standard. The traceability check is specific to spec-driven development, and it is simple to write yourself. The script below reads requirements.md and tasks.md, and fails if a criterion has no task or a task cites a criterion that does not exist. It assumes the layouts shown in the earlier chapters: headings like ### Requirement 1: Title, numbered criteria under them, and task lines containing Covers: Requirement 1.1, 1.3.
import re
import sys
from pathlib import Path
REQ_HEADING = re.compile(r"^#{2,4}\s+Requirement\s+(\d+)\b")
CRITERION = re.compile(r"^\s*(\d+)\.\s+(?:WHEN|IF|WHILE|WHERE)\b")
COVERS = re.compile(r"Covers:\s*(.*)")
CRITERION_ID = re.compile(r"\d+\.\d+")
def read_criteria(path):
ids = set()
current = None
for line in path.read_text(encoding="utf-8").splitlines():
heading = REQ_HEADING.match(line)
if heading:
current = heading.group(1)
continue
criterion = CRITERION.match(line)
if criterion and current is not None:
ids.add(f"{current}.{criterion.group(1)}")
return ids
def read_covered(path):
ids = set()
for line in path.read_text(encoding="utf-8").splitlines():
covers = COVERS.search(line)
if covers:
ids.update(CRITERION_ID.findall(covers.group(1)))
return ids
def main(spec_dir):
folder = Path(spec_dir)
criteria = read_criteria(folder / "requirements.md")
covered = read_covered(folder / "tasks.md")
uncovered = sorted(criteria - covered)
unknown = sorted(covered - criteria)
for item in uncovered:
print(f"No task covers criterion {item}")
for item in unknown:
print(f"Task refers to missing criterion {item}")
return 1 if uncovered or unknown else 0
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: python check_spec_coverage.py specs/<feature>")
sys.exit(2)
sys.exit(main(sys.argv[1]))Run against the password-reset spec from earlier chapters, this script reports nothing and exits with code 0, because criteria 1.1, 1.2, and 1.3 each appear in a Covers: line. Delete task 3 and it reports No task covers criterion 1.2.
The script checks that a link exists. It cannot tell whether the task really implements the criterion, so it supports human review and does not replace it.
Review and automation tooling
Review gates need an enforcement point. A rule in AGENTS.md asks the agent to stop. A branch protection rule makes stopping mandatory for merging. Use both.
A minimal continuous integration (CI) configuration runs the traceability check and the tests on every pull request:
name: spec-check
on: [pull_request]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install pytest
- run: python tools/check_spec_coverage.py specs/password-reset
- run: pytestThen mark the verify job as required in your Git host's branch protection settings. Without that step, a failing job is only advice.
Pull request practice also matters. When a pull request changes requirements.md and code together, reviewers should read the requirement change first. A good convention is to keep spec changes in their own commit, so the diff shows what the team decided separately from what the agent wrote.
How the pieces fit together
The diagram shows where each kind of tooling sits in one pass through a task.
The loop from a failed check back to the agent is the main benefit of tooling. The agent gets objective feedback without a person reading each line. The loop from review back to the spec is the one that prevents drift. If a reviewer finds the spec was wrong, fix the spec first, then the code.
Context tooling
Agents can also connect to external sources of information through standard protocols, such as the Model Context Protocol (MCP), which lets an agent call tools and read data from outside the repository. For spec work, typical uses are reading an issue from a tracker, fetching an API schema, or querying documentation.
Treat such connections with the same care as any other input:
- Give each connection the least access it needs. A read-only token is enough to fetch an issue.
- Remember that fetched text is data. A ticket that says "ignore the spec" is content to report, not an instruction to follow.
- Copy the facts you rely on into the spec. A requirement that says "see the ticket" breaks when the ticket changes.
Common failure modes
- Tool-owned specs. The spec lives only in a tool's interface and not in Git. Fix: export or store it in the repository, and review it in pull requests.
- Skipped gates. The tool offers "run all tasks" and the team uses it. Fix: run one task at a time until your checks are trustworthy.
- Conflicting instruction files. Two agents read two files with different rules. Fix: one source of truth.
- Green checks that prove little. The traceability script passes, but the tests assert nothing. Fix: review test quality, and sometimes break the code on purpose to confirm a test fails.
- Local-only checks. A check that works on one machine and is absent from CI. Fix: run the same command in both places.
Choosing a setup
Use these criteria in order:
- Does it keep specs as plain files in your repository?
- Does it let you stop after each phase and each task?
- Can your verification run without it, in CI?
- Does it work with the agents your team already uses?
- Does it fit the size of your changes? A small bug fix does not need a three-phase tool.
If a candidate fails the first or third criterion, the cost of leaving it later is high. If it fails the fifth, you pay a small cost every day.
Exercise
Your team adopts a spec-aware tool that offers a "run all tasks" button. Name two risks of using it on a new feature, and one tooling measure that limits them.
Show answer
First, the agent can run past a task that needed review, so a wrong early decision spreads through later tasks. Second, you lose the chance to check each task against its acceptance criteria before the next one builds on it. A measure that limits both: require CI checks, including the tests and the traceability script, on every pull request, and mark them as required in branch protection. A project instruction file that says "stop for review after each task" also helps, but branch protection is the one that enforces it.
Exercise
The traceability script passes for a spec, yet a reviewer finds that criterion 1.3 (a used link must be rejected) is not implemented. Explain why the script missed it, and name one addition that would catch it.
Show answer
The script only checks that a task's "Covers:" line mentions 1.3. It does not check that code or tests implement the behavior. Adding a test that encodes criterion 1.3 (for example, redeeming the same token twice must raise an error), and running it in CI, would catch the gap, because the test fails when the behavior is missing.