Home / Insights / Architecture and Modernization

Architecture and Modernization

Spec-Driven Development with AI Coding Agents: Making Specifications the Source of Truth

AI coding agents write code quickly, but they guess when intent is vague. Spec-driven development moves the effort to a reviewed specification that the agent, the reviewers and the tests all work from. This guide explains when that pays off and how to adopt it without drowning in documents.

TopicsArchitecture and ModernizationAI Agents and Automation

Key takeaways

  • Spec-driven development (SDD) means agreeing a written specification before an AI agent writes code, then using that spec to plan, implement, review and test the change.
  • There are three levels: spec-first (a spec per change), spec-anchored (the spec is kept and maintained with the feature) and spec-as-source (humans edit only the spec). Most teams should aim for spec-anchored, not spec-as-source.
  • SDD pays off for multi-file features, integrations, regulated logic and modernisation work; it is overkill for small fixes, where a plan-then-code prompt is enough.
  • The specification is only a source of truth if something enforces it: acceptance criteria turned into tests, review against the spec, and a rule that behaviour changes start with a spec change.
  • Start with one team, one template and one class of work, measure review time and rework, and keep the documents short enough that people actually read them.

Over the past year, AI coding agents have moved from autocomplete to tools that read a repository, edit many files and run tests. The bottleneck has shifted. Producing code is no longer the slow part; deciding exactly what should be built, and checking that the agent built that and nothing else, is. When the instructions are a few lines in a chat window, the agent fills the gaps with plausible guesses, and those guesses surface late, in review or in production.

Spec-driven development is the response that has gained momentum in 2025. GitHub released its open-source Spec Kit in September, AWS launched the Kiro IDE around a requirements-design-tasks workflow, and practitioners have started to compare the approaches critically. This article is for CTOs, engineering managers and architects who are deciding whether to formalise specifications for agent-assisted work, and how far to take it.

What spec-driven development actually means

At its simplest, spec-driven development means writing a specification before using AI to write code. Birgitta Böckeler of Thoughtworks, in her October 2025 analysis of Kiro, Spec Kit and Tessl, notes that the term is still loosely defined, and that the tools on the market interpret it differently. What they share is a sequence: capture intent, turn it into a technical plan, break the plan into small tasks, then let the agent implement task by task with human checkpoints in between.

GitHub’s announcement of Spec Kit describes four phases:

  1. Specify: describe what you are building and why, including user journeys and success criteria, without choosing a technology stack.
  2. Plan: supply the stack, architecture, constraints, internal standards and compliance needs; the agent proposes a technical plan.
  3. Tasks: the agent breaks the spec and plan into small units that can be implemented and tested in isolation.
  4. Implement: the agent works through the tasks while the developer reviews focused changes rather than large code dumps.

The GitHub post frames the shift as intent becoming the source of truth. Kiro takes a similar route with three Markdown files per feature: requirements.md for user stories and acceptance criteria, design.md for architecture, data flow, error handling and testing strategy, and tasks.md for discrete implementation steps, as its specs documentation sets out.

Why agents need it more than people do

Agents lack the unwritten context experienced developers carry unless it is written down. Anthropic’s Claude Code best practices make the same point from the tool side: plan before coding when the approach is uncertain or several files will change, keep a short project instruction file for conventions the agent cannot infer, and give the agent a check it can run so it can verify its own work. A specification is the structured version of that advice.

Three levels of commitment: spec-first, spec-anchored, spec-as-source

Böckeler’s analysis distinguishes three levels, and choosing deliberately between them is the most important architectural decision in adopting SDD.

LevelWhat happens to the specWho edits codeBest fitMain risk
Spec-firstWritten for one change, may be discarded after mergeAgent and developersFeature work, prototypes moving to production, one-off integrationsKnowledge lost after merge; specs drift from reality
Spec-anchoredKept in the repository and updated as the feature evolvesAgent and developers, with spec updated firstLong-lived products, regulated logic, modernisation programmesMaintenance effort; requires a review rule to stay honest
Spec-as-sourceThe only artefact humans edit; code is regeneratedAgent onlyNarrow, well-bounded components; experimental todayNon-deterministic regeneration; hard debugging; rigidity

According to Böckeler, the tools she examined are all at least spec-first, few go further, and only Tessl was explicitly exploring spec-as-source, where generated files carry a do-not-edit header. She observed that regenerating from the same spec produced varying output. She also draws a parallel with model-driven development, which used models as specifications for code generators and never took hold for business applications because of overhead and rigidity. Large language models remove some of that overhead but add non-determinism.

My recommendation

For most product teams, the target should be spec-anchored. Spec-first alone gives you better changes but no lasting record; the next agent session starts without the reasoning. Spec-as-source asks you to trust regeneration in a way that today’s tools do not justify for business-critical systems. Spec-anchored keeps a short, living description of each significant capability beside the code, which helps the next human and the next agent, and it fits naturally with architecture decision records that many teams already keep.

When spec-driven development pays off, and when it does not

SDD has a real cost: writing and reviewing specs takes time. Böckeler reports that Kiro turned a small bug into four user stories with 16 acceptance criteria, and that Spec Kit felt like overkill for a modest feature she could have built with ordinary AI-assisted coding. She also found Spec Kit’s many Markdown files repetitive and tedious to review. Those are useful warnings. The approach should be applied where ambiguity is expensive, not everywhere.

Type of workRecommended approachWhy
Typo, small bug with a clear reproductionPrompt with a failing test; no specIntent is unambiguous; a spec adds only overhead
Small feature in a familiar modulePlan-then-code in the agent session; short plan reviewedLightweight planning catches most misunderstandings
Multi-file feature, new API or data model changeSpec-first with acceptance criteria and a design noteSeveral components must agree; errors surface late
Integration with an external systemSpec-anchored, contract includedBehaviour must stay stable as both sides change
Regulated or financial logicSpec-anchored with traceability to testsAuditors and reviewers need to see intended behaviour
Legacy modernisationSpec-anchored, starting from extracted current behaviourThe spec captures what must not change

The modernisation case

Modernisation is where I see the strongest fit for architecture work. When you replace a component, the hardest question is what the old one actually does. Writing the existing behaviour down as a specification, with explicit statements of what must stay the same, gives the agent a target and gives reviewers a checklist. It pairs well with the techniques in our article on using AI to reverse-engineer legacy applications, and with incremental replacement as described in modernising a monolith with the Strangler Fig pattern.

What a useful specification contains

A good spec is short, testable and separates intent from implementation. Spec Kit deliberately keeps the technology stack out of the first phase; Kiro separates requirements from design. I recommend the same split, with a template that fits on two or three screens.

Part 1: intent (owned by product)

  • Problem and outcome: who has the problem, what success looks like, and how it will be measured.
  • User journeys: the main paths, written as numbered steps.
  • Acceptance criteria: Given/When/Then statements that can become automated tests. Böckeler notes Kiro uses this format.
  • Out of scope: what the change must not do. Agents are prone to helpful additions; this list is how you stop them.
  • Invariants: behaviour that must not change, especially in existing systems.

Part 2: design (owned by engineering)

  • Affected components and the interfaces between them; a small C4 container or component view is often enough.
  • Data changes: schema, migrations, backward compatibility.
  • Non-functional requirements: performance budgets, security controls, logging, accessibility.
  • Constraints and standards: libraries to use and avoid, error-handling conventions, compliance rules. GitHub suggests embedding security, compliance and design-system requirements so the agent applies them from the start.

Part 3: tasks (generated, then reviewed)

Tasks should be small enough that each produces a pull request a person can review in one sitting, and each should name the acceptance criteria it satisfies. Generated task lists are the cheapest place to catch a wrong plan, so read them before any code is written.

Project-wide rules

Spec Kit uses a “constitution” of core principles that apply to every spec. Whatever you call it, keep one short file of project-wide rules alongside an agent instruction file. Anthropic’s guidance is to include only what the agent cannot infer from the code and to remove lines whose absence would not cause mistakes, because long files get ignored. Böckeler observed agents over-applying constitution rules, which is another reason to keep them few and precise.

How to keep the specification the source of truth

A spec is only a source of truth if the system punishes divergence. Without enforcement, specs become stale documents within weeks, and stale specs are worse than none because agents will follow them. Böckeler found that, despite research notes describing existing classes, Spec Kit’s agent regenerated those classes and created duplicates. The lesson is that writing a spec does not guarantee the agent obeys it; verification does.

Enforcement mechanisms

  1. Acceptance criteria become tests. Each Given/When/Then statement maps to at least one automated test, ideally written before implementation. The agent can then run the tests and iterate until they pass, which is the kind of runnable check Anthropic recommends.
  2. Review against the spec, not just the code. The pull request template asks: which criteria does this satisfy, does it touch anything listed out of scope, does it break an invariant?
  3. Spec change before behaviour change. Any change to externally visible behaviour starts with a spec edit in the same pull request. Reviewers reject behaviour changes without one.
  4. Specs live with the code. Keep them in the repository, versioned and reviewed like code, not in a separate wiki.
  5. Contract checks in CI. Where the spec includes an API contract, validate it automatically, as discussed in our guide to planning a zero-downtime migration for compatibility concerns.

A step-by-step rollout for an engineering team

The 2025 DORA research on AI-assisted software development describes AI as an amplifier that magnifies an organisation’s existing strengths and weaknesses, and says the largest returns come from improving the underlying system rather than the tools alone, according to the DORA report page. SDD is a system change, so introduce it the way you would any process change: small, measured and reversible.

  1. Pick one team and one class of work. Medium-sized features or one integration stream are good candidates. Avoid starting with bug fixes, where the overhead is most visible.
  2. Agree a template. Use the three-part structure above. Set a soft length limit; if a spec runs past three screens, the change is probably too big.
  3. Choose tooling last. Spec Kit, Kiro or a plain Markdown template with your existing agent can all work. The workflow matters more than the tool, and a plain template avoids lock-in.
  4. Define the review gates. Product signs off intent; an engineer signs off design and tasks; code review checks against acceptance criteria.
  5. Baseline and measure. Before starting, record a few numbers you already have: pull request size, review time, rework after review, defects found after release. Compare after six to eight weeks.
  6. Hold a retrospective. Ask where specs prevented a misunderstanding and where they were pure overhead. Adjust the threshold for when a spec is required.
  7. Expand deliberately. Add teams once the template and gates have settled, and move important long-lived features to spec-anchored.

Illustrative example

For example, a 30-person SaaS company adding a billing integration might write a two-page spec: intent and acceptance criteria from the product manager, a design note covering the payment provider’s webhooks, idempotency and retries from the tech lead, and a generated list of eight tasks. The agent implements task by task; each pull request references the criteria it satisfies. The numbers here are assumptions for illustration, not results from a specific project.

Governance for the agents themselves still applies; our article on rolling out AI coding assistants across an engineering team covers access, policy and measurement.

Risks, costs and how to contain them

RiskWhat it looks likeMitigation
Review overloadReviewers face long, repetitive Markdown plus codeShort templates; review specs at the intent and task stage, code at the end; skip SDD for small work
Agent ignores the specDuplicated classes, out-of-scope changesTests from acceptance criteria; explicit out-of-scope list; small tasks
Spec driftSpec no longer matches behaviourSpec-change-first rule in review; specs in the repository
False confidenceA polished spec hides missing edge casesEngineer-owned design review; exploratory testing; production monitoring
Tool lock-inSpecs only readable by one IDE or vendor formatPlain Markdown; tool-neutral templates
RigidityTeam avoids iterating because changing the spec feels heavyTreat specs as living; allow small spec edits without ceremony

The main cost to budget for is product-owner time to write intent and acceptance criteria, plus engineering time for the template, review gates and CI checks. Against this, the expected savings are fewer rewrites after review, smaller and more focused pull requests, and faster onboarding of new people and agents to existing features. GitHub’s announcement asserts benefits such as less guesswork but does not quantify them, so measure in your own context rather than relying on vendor claims.

Checklist: are you ready to make specs the source of truth?

  • We have identified which classes of work require a spec and which do not.
  • We have a template of no more than three screens with intent, design and tasks separated.
  • Acceptance criteria are written so they can become automated tests.
  • Each spec has an explicit out-of-scope list and, for existing systems, invariants.
  • Specs live in the repository and are reviewed in pull requests.
  • Behaviour changes require a spec change in the same pull request.
  • We have baseline measures for pull request size, review time and rework.
  • Product owners have time allocated to write and review intent.
  • We have chosen a target level (usually spec-anchored) and know why.

If you can tick most of these, a pilot will tell you quickly whether SDD helps. If not, start with the template and the review rule; the tooling can wait. Where the work involves significant architecture decisions or a modernisation roadmap, our software architecture consulting team can review existing systems, design target architectures and produce the diagrams and prioritised plans that make good specifications possible.

Frequently asked questions

Is spec-driven development only useful with a specific tool such as Spec Kit or Kiro?

No. The tools provide templates and commands, but the core practice of agreeing intent, design and tasks before implementation works with any capable coding agent and a plain Markdown template. Choosing tool-neutral formats also reduces lock-in.

Will writing specs slow my team down?

For small changes, yes, which is why they should be excluded. For multi-file features, integrations and modernisation work, the time spent on a short spec is usually recovered through fewer rewrites and faster reviews. Measure review time and rework before and after to check this in your context.

Who should write the specification?

Split ownership: product owners write the problem, user journeys and acceptance criteria; engineers write the design, constraints and test strategy; the agent drafts tasks for an engineer to review. Letting the agent write the whole spec unreviewed defeats the purpose.

Can we regenerate code from the spec instead of editing it?

That is the spec-as-source model. It is still experimental; Thoughtworks’ review observed varying output when regenerating from the same spec. For business-critical systems we recommend keeping specs maintained alongside code rather than treating code as disposable.

How do we stop the agent ignoring the spec?

Turn acceptance criteria into tests the agent must pass, keep tasks small, list out-of-scope behaviour explicitly, and review pull requests against the spec. Verification, not the document itself, is what makes the spec authoritative.

Sources and methodology

Guidance reflects PoliteTech delivery experience. The external references below informed specific points in this article.

  1. GitHub Blog: Spec-driven development with AI: Get started with a new open source toolkit (2 September 2025) — accessed 9 November 2026. Spec Kit’s four phases, intent as source of truth, embedding security and compliance requirements, and the absence of quantified benefits.
  2. martinfowler.com: Understanding Spec-Driven-Development: Kiro, spec-kit, and Tessl, Birgitta Böckeler (15 October 2025) — accessed 9 November 2026. The spec-first, spec-anchored and spec-as-source levels; observations on review overhead, agents ignoring specs, problem-size fit and the model-driven development parallel.
  3. Kiro documentation: Specs — accessed 9 November 2026. Kiro’s requirements, design and tasks files and the requirements-design-tasks workflow.
  4. Anthropic: Claude Code best practices — accessed 9 November 2026. Planning before coding, short project instruction files, and giving agents runnable checks to verify their work.
  5. DORA: State of AI-assisted Software Development 2025 — accessed 9 November 2026. AI acting as an amplifier of existing organisational strengths and weaknesses.

Want a second opinion on how to structure specs for your agent-assisted delivery?

We can review your current workflow and architecture and propose a spec template, review gates and a pilot plan that fit your team.