All posts

Spec-Driven Development for AI Coding Agents in 2026

Devdatta Narawade10 min read

Teams that start using an AI coding agent often hit the same wall after the first few tasks. The first prompts work well. Then the work grows, the prompts pile up in chat history, and nobody can say later why the code looks the way it does or what the agent was meant to leave alone. The prompt was the wrong unit of work all along.

Spec-driven development is the response to that wall. Instead of prompting an agent and hoping, you write the intent into a structured document that outlives the session, and the agent works from it. The idea is simple. The practice is harder, and the 2026 evidence on the trade-offs is still thin.

This post covers what a spec should contain, what the research says about how teams really use specs, and what to leave out. The last part matters most. A spec that grows without limit becomes a second codebase that nobody reads.

Why the prompt is the wrong unit of work

A prompt is a request made at one moment, by one person, with context that lives in a chat window. When the session ends, the context ends with it. The next agent run, or the next engineer, starts from nothing.

A prompt disappears when the session ends

Chat history is a poor record of decisions. It mixes exploration with commitments, and it rarely says which constraint was agreed and which was an idle suggestion. Weeks later, nobody can tell whether the agent was told to keep the old retry policy or simply did not mention it.

The spec is a source of truth, not a ticket

Many teams treat specs as the ticket that starts the work and then forget them. The useful version is different. The spec stays in the repository, the agent reads it at the start of each task, and it changes when the decision changes. If the spec and the code disagree, one of them is wrong, and someone has to decide which.

That gives you a simple test. Ask whether the spec would tell a new engineer what the system is supposed to do today. If it would not, it is a ticket, not a spec.

Every handoff reinterprets intent

Work usually passes through several hands: the person who wants the feature, the person who writes the change, the agent that writes the code and the reviewer who checks it. Each handoff is an interpretation. AI agents make the implementation step much faster, but they do not remove ambiguity at the handoffs. A fast agent given a vague instruction produces a fast, confident wrong answer, and the speed makes the error harder to spot.

What the 2026 evidence actually says

Spec-driven development has an enthusiasm problem. Vendor material often presents it as settled best practice. The independent evidence is thinner and more mixed, and it is worth knowing where the gaps are.

How the study was built

The most rigorous recent study is "Spec-Driven Development as Prescribed and as Practiced" (arXiv:2608.25202). It combines a thematic analysis of Reddit discussions, interviews with 21 practitioners (eight of them tool makers), and an analysis of 266 active, popular repositories from SpecMine, a corpus of 470,795 spec files from 73,030 public GitHub repositories. The authors note that evidence on the practice has come largely from tool vendors, which is the main reason to read vendor claims with care.

What practitioners agreed on

The findings that matter for a working team are these:

  • Specs should capture intent. Practitioners agreed on this, but many also put implementation details into their specs.
  • Teams used the practice selectively, mainly for new features rather than whole existing codebases.
  • Participants reported more reliable agent behaviour, alongside greater planning and review costs.
  • Individual benefits may come from clarifying intent before delegating work. Team-level benefits depended on the spec becoming a shared process rather than one person's habit.

What the study does not measure

The study's findings describe practice and reported experience. They do not give defect rates, cycle time or maintenance cost, so they cannot tell you that spec-driven work ships fewer bugs or finishes faster. They do show where the practice helps and where it adds cost. Measure both on your own tasks before you rely on either.

What to specify: the four parts that pay off

A useful spec for an AI agent is short. It answers four questions in plain language that a reviewer can check.

The outcome and its acceptance criteria

State what must be true when the work is done. Write acceptance criteria as observable checks. "A user with an expired token gets a 401 and is sent to the login page" is testable. "Handle expired tokens well" is not. An agent can run an observable check. It cannot run a wish.

Keep the list to five to ten items. If you need thirty, the task is probably two tasks.

The boundaries

This is the part most teams leave out, and it is where agents cause the most damage. List the files, modules or behaviour that must not change. An agent asked to fix one bug will often "improve" nearby code, and that adds review load and risk. A line such as "do not modify the billing module or the public API response shape" prevents a whole class of unreviewed changes.

Boundaries belong in your permissions too, not only in the spec. The spec tells the agent what you want. Permissions decide what it can do. The post on where the authorization line sits explains why both matter.

The constraints and the verification steps

Record the rules a new engineer would learn only by breaking them: a dependency that must not be upgraded, a performance budget, a compliance requirement, a retry policy that exists because of a past outage. The agent cannot infer this from the repository alone, and it is the cheapest part of the spec to write.

Then say how the change will be checked. Name the test command, the manual check for the user flow and the person who signs off. A spec without verification steps gives the agent a finish line and no way to know whether it has crossed it. Budget for that check. The why checking output costs real time is the cost you pay at this step.

What to leave out: implementation detail

This is the trade-off the research highlights, and it deserves a clear rule.

Why implementation detail decays

Implementation detail can help an agent on the day it is written. Naming the function to change, or the library to use, reduces guesswork. The study's finding is that the same detail makes specs prone to decay. Weeks later the function may have moved, and the spec still says to edit it. Now the spec actively misleads, and the agent may follow it.

Splitting the spec from the plan

Our working rule is to split the two. The spec holds intent, acceptance criteria and boundaries, and it changes rarely. Any implementation plan lives in a separate, disposable file tied to one task, and it is deleted or archived when the task merges. The spec stays a source of truth, and the plan stays a tool. This split is our recommendation, not a finding of the study.

The noise problem

The study reports that spec-code checks mostly happen when a change is completed, not continuously over time. That gap is where drift builds up. Our own view, not a study finding, is that a spec nobody checks against what shipped is a maintenance burden with no source-of-truth benefit. Review the spec at merge, and retire the ones that no longer match the code.

How to adopt it without drowning in documents

Start small and keep the scope narrow. The approach works best when you can see its cost clearly.

Start with one bounded feature

Choose a new, bounded piece of work, not a rewrite of old code. The study reports that teams used the practice mainly for new features, which makes that the natural starting point. A new endpoint with clear outcomes is a better first test than a refactor of a module that half the team touches.

Make the agent restate the spec first

Before the agent writes code, ask it to restate the acceptance criteria and list the boundaries. A mismatch at this step is cheap to fix. A mismatch after 400 lines of diff is not. If the restatement is wrong, fix the spec before you let the agent continue.

Measure the overhead

Track how long the spec took to write and how much review time it saved. If the numbers do not favour the spec, shrink it or drop it for that type of work. Compare the results with a measured view of success on real tasks, such as the how success varies by task type analysis. This step is the one teams skip, and it is why the approach fails quietly. The study's central caution is that participants reported reliability gains alongside planning and review costs, so you need to see both sides of that ledger.

Where AutoCoder fits

AutoCoder runs on your own Windows machine with your own DeepSeek key. It works a ticket end to end on your machine, then reports the diff and the cost of the run. That structure suits bounded tasks with clear acceptance criteria, which is what a short spec provides.

What a spec gives an agent like this

Write the spec as the brief you hand the run. Observable acceptance criteria and a named verification step give you something to check the output against. Vague instructions leave you judging the result by feel. Each run's cost is reported, so you can compare a spec-driven task with an unstructured one on the same metric.

What a spec does not guarantee

A spec makes the expectation explicit. It does not make the output correct. Whether the result meets the spec is still a question for tests and human review, and the spec is only as good as the person who maintains it.

How to judge a run against its spec

Read the diff against the boundaries first, then walk each acceptance criterion and run the named verification step. Check that nothing outside the boundaries changed. If a criterion cannot be checked, treat the run as unfinished, whatever the agent reports.

Try AutoCoder.dev free on one bounded task from your backlog. Write its four-part spec first, then compare the result and the cost with your last unstructured run.

FAQ

What is spec-driven development for AI coding agents?

Spec-driven development is a workflow in which the intent for a change lives in a durable document, usually kept in the repository, and the AI agent works from that document. The spec records the outcome, acceptance criteria, boundaries and verification steps. It outlasts a single chat session, so the next agent run or engineer starts from the same intent.

How long should a spec for an AI agent be?

Keep it to about one page. Five to ten acceptance criteria, a short list of boundaries and the verification steps are usually enough. If the spec grows past that, the task is probably too large for one agent run, or the spec has picked up implementation detail that will go stale.

Should I put implementation details in the spec?

Keep them out of the spec itself. Implementation detail can help an agent on the day it is written, but it decays as the code changes. Put any plan in a separate file tied to one task, and delete or archive it when the task merges.

Does spec-driven development make AI agents more reliable?

The 2026 study of practitioners reports that participants saw more reliable agent behaviour, but also greater planning and review costs. It does not report defect rates, so it cannot confirm a reduction in bugs. Measure reliability and overhead on your own tasks before you rely on either claim.

Where should a team start with spec-driven development?

Start with one new feature that has clear outcomes. Write the four parts, have the agent restate the criteria before coding, and review the spec at merge. Track the planning time and the review time for a few tasks. That gives you real numbers rather than a general impression.

AutoCoder Premium Brief · daily at 07:00 IST

One AI-coding story a day. Explained.

Every issue starts from a post like this one and condenses it to the part you can act on today — the mechanism, the sources, and what to do about it.

  • The one release, advisory or benchmark that changes how you build
  • The mechanism in four minutes, with every source linked
  • One thing to do today

One email with a full sample issue and the plans. Nothing else unless you subscribe.

Then $9 / 30 days or $90 / year · in India ₹299 / 30 days or ₹2,499 / year · See the plans

TaggedAI Coding AgentsSpec Driven DevelopmentAgent SpecificationsAgentic EngineeringAcceptance CriteriaDeveloper ProductivityAI Development WorkflowPrompt Engineering

Related reading