Executive Summary
AI coding agents often produce code that looks right but carries decisions nobody approved, because they act only on what you actually wrote down. Spec-driven development with AI fixes this by making a short, version-controlled specification the source of truth that the agent implements. This article explains what goes into a 1-to-3-page spec pack, the four human gates that keep agents on track, how to keep specs current as requirements change, where the approach costs more than it saves, and how enterprises can adopt it in stages.
It is 11:47 p.m. A senior engineer stares at a pull request that looks perfect. Clean code. Green tests. Yet the feature is wrong. The AI agent quietly chose offset pagination instead of cursor-based, invented an extra database column, and “improved” an unrelated helper function two folders away. Three review cycles later, the sprint is late.
Spec-driven development with AI coding agents prevents that failure by making a version-controlled specification, not the chat prompt, the single source of truth. The agent implements the spec. Code becomes the output, and the specification remains the contract.
Key Takeaways
- Source of truth: In spec-driven development with AI, coding agents build from a structured, version-controlled specification rather than from chat history.
- Invented decisions: Ambiguity in a prompt forces the agent to make choices nobody approved, and those choices surface later as review cycles and rework.
- Spec size: A minimum viable spec pack runs 1 to 3 pages and lives in the repository beside the code.
- Human gates: Four checkpoints (spec review, plan review, task gate, and final acceptance) stop an agent from jumping from a request straight into code.
- Trade-off: Specs cost planning time and tokens, so they pay off most on multi-file features and least on one- or two-file fixes.
- Enterprise value: A shared spec gives parallel agents one plan, keeps architecture consistent, and traces every commit to an approved requirement.
The late-night scene is no longer rare. It is the default when teams treat AI coding agents like extremely fast junior developers who somehow understand intent. They don’t. They understand only what you actually wrote down. The cost shows up in three places: engineering hours lost to review and rework, delivery dates that slip because nobody defined “done,” and production risk when plausible-looking code ships with decisions nobody approved.
This is not a return to heavyweight waterfall documentation. A good spec is a short chain that connects product intent, architectural constraints, acceptance criteria, and verification evidence. When that chain holds, agents stop inventing and start executing. To see why the chain matters, start with what happens without one.
Vibe Coding Breaks Down Once Tasks Get Serious
For the first year of capable coding agents, many teams lived in “vibe coding” mode. You typed a hopeful sentence like “add pagination to the users API,” and the agent produced something that felt right. Then reality arrived in six forms:
- Context loss: Context windows filled with half-remembered earlier decisions.
- Missed edge cases: Edge cases the agent never heard about broke in production.
- Architecture drift: The design drifted because nobody had recorded the real constraints.
- Subjective review: Review turned into theater, with reviewers asking, “Does this feel correct?”
- Repeated decisions: Parallel agents and later sessions reinvented choices the team had already made.
- Rising cost: Token costs climbed while progress stalled.
Early evidence supports a narrower and more credible version of the spec-driven case than the hype suggests. In a 2026 benchmark by Uvik Software on 50 production Python tickets, the best spec-driven workflow merged 90 percent of feature and data-pipeline tickets, against 60 percent for a no-spec control. Blind reviewers also found fewer defects per merged ticket with a spec (0.46 versus 0.86). The direction is consistent: the more precise the contract, the less the agent has to invent.
Vibe coding optimizes for the first response. Spec-driven development with AI optimizes for the correct response, and for every change that comes after. That shift starts with a different answer to a basic question: where does the truth about a feature live?
What Is Spec-Driven Development With AI Coding Agents?
Spec-driven development with AI coding agents is a workflow in which a structured, version-controlled specification becomes the primary artifact. The agent reads the spec, derives a plan and tasks, implements them, and reports progress against the same document. Code becomes the build output, exactly as a compiler turns source into binaries.
In classic development, code is the source of truth, and comments and tickets try (and usually fail) to explain it. With agents, the hierarchy flips.
Spec-First, Spec-Anchored, and Spec-as-Source
Practitioners describe three levels of commitment to the spec:
- Spec-first: Write the spec once to guide generation, then maintain the code.
- Spec-anchored: Spec and code evolve together, and tests and CI keep them honest.
- Spec-as-source: Humans edit only the specification, and the agent regenerates the code.
Most production teams settle in the middle. The decisive insight is this: every ambiguity you leave in a prompt becomes a decision the agent must invent. A clear specification removes those accidental decisions before they cost review cycles.
The Specify → Plan → Tasks → Implement Loop
Tools such as the open-source GitHub Spec Kit and AWS Kiro follow a similar practical loop: Specify → Plan → Tasks → Implement, with a human gate at each boundary. As of November 2026, Spec Kit’s project site lists more than 106,000 GitHub stars and 30 agent integrations. Kiro expresses the same idea as requirements, design, and tasks.
The method does not depend on any single toolkit. Open frameworks such as the BMad Method show one way teams apply the same principles at scale. Whichever tool you choose, the loop starts with the same artifact: a short spec pack.
A Minimum Viable Spec Pack Fits on Three Pages
You do not need a 40-page requirements document. You need a pack short enough for a human to review in minutes and structured enough for an agent to parse without guessing. A minimum viable spec pack usually contains nine sections:
- Outcome and intent: One or two sentences that answer, “What does success look like for the user and the business?”
- Scope and non-goals: What is in and, just as important, what is deliberately out.
- Workflows: The happy path plus the alternate flows that usually cause rework.
- Edge cases and error handling: The situations that previously created 2 a.m. incidents.
- Data and API contracts: Concrete schemas, examples, status codes, and invariants.
- Constraints: Tech stack, performance budgets, security rules, “do not touch” zones, and explicit context and token budgets.
- Non-functional requirements: Latency, accessibility, observability, and compliance.
- Acceptance criteria: Testable statements, preferably written in EARS (Easy Approach to Requirements Syntax) or classic Given/When/Then.
- Open decisions: Questions still unresolved, which the agent may not answer on its own.
Keep each feature pack to 1 to 3 pages. If it grows longer, split it. Store it in the repository beside the code, so every agent session reads the same contract. Of the nine sections, acceptance criteria do the most work, and the next example shows how to write them.
Turning a Vague Request Into Testable Acceptance Criteria
Consider an anonymized request from a SaaS support platform:
“Support agents spend almost half their day just classifying and prioritizing inbound emails. Can we make that go away?”
That sentence is pure product intent. In a vibe-coding workflow, the agent would immediately start writing classifiers, inventing database tables, and choosing models. In a spec-driven workflow, the team first expands the intent into architecture, interfaces, and acceptance criteria. Here are 3 of the 4 criteria the team wrote in EARS style:
- Classification: When an email arrives whose subject matches
/order #\d+/, the system shall classify it as Order Issue and place it in the priority queue within 30 seconds. - Low confidence: If classification confidence falls below 0.85, the system shall leave the original email untouched and send a single Slack notification to the triage channel.
- Human approval: The system shall never send an auto-draft without explicit human approval.
With criteria like these, the agent no longer guesses what “done” means. Product language stays human, while the criteria become precise enough for reliable implementation. Behavior-Driven Development (BDD) scenarios map cleanly onto this layer and become the executable half of verification.
Precise criteria help only if nobody lets the agent skip past them. That is the job of review gates.
Four Human Gates Keep AI Coding Agents Honest
The most important discipline is also the simplest: never let an agent leap from a high-level request straight into code. Insert four explicit human gates:
- Spec review: Product and engineering confirm the pack is complete and unambiguous.
- Plan review: The agent proposes architecture and a task breakdown, and humans approve it.
- Task gate: The team sizes each atomic task and confirms it is testable before implementation begins.
- Final acceptance: Reviewers judge the output solely against the original acceptance criteria.
These gates change the human role from “prompt engineer and cleanup crew” to “intent steward and quality gatekeeper.”
Run This Checklist Before Implementation Begins
Teams that have internalized the practice clear eight checks at the spec review gate:
- Outcome: The outcome is clear and measurable.
- Scope: Scope and exclusions are explicit.
- Edge cases: Every edge case has defined handling.
- Contracts: Contracts include concrete examples.
- Constraints: Constraints and non-functional requirements, including context budgets, are stated.
- Acceptance criteria: Criteria are testable and numbered.
- Open decisions: Open decisions are flagged, and the agent is instructed not to invent answers.
- Version control: The specification is committed to the repository.
Try it on your next feature: Run these eight checks on the next task your team hands to an AI coding agent, and count how many decisions the agent would otherwise have to invent.
Five Operating Rules for the Agent During Implementation
Once a pack clears the gates, the agent receives it as its primary context, along with five operating rules:
- Scope: Implement only what the specification requires.
- Ambiguity: Surface any gap instead of inventing an answer.
- Progress reporting: After every task, report which acceptance criteria are now satisfied and which remain open.
- Commits: Prefer small, reviewable commits that reference the relevant section of the specification.
- Context budget: Respect declared context and token budgets, and retrieve only what is necessary.
When the agent hits a gap, it stops and asks. That single behavioral change removes the most common cause of “looks right but isn’t” failures. The rules hold, however, only while the spec stays current, and requirements rarely stay still.
How to Keep the Spec Current When Requirements Change
The rule is absolute: change the specification first. Edit the pack, re-plan if the change is material, and adjust only the affected code and tests. Keep a short change log, so future readers, human or agent, understand why the current version exists. Because everything lives in Git, drift becomes visible the moment code no longer satisfies the current acceptance criteria.
Four Failure Modes That Need Explicit Handling
- Partial completion: Tasks 1 to 5 succeed, but task 6 reveals that an earlier assumption was wrong. Treat it as a specification change. Update the open-decisions section, re-plan the remainder, and mark previously generated code as “to be reconciled.” Never allow silent rewrites.
- Context-window and token budgets: Declare the maximum context size and preferred retrieval strategy in the Constraints section. Instruct the agent to use targeted retrieval or multi-stage planning rather than loading entire repositories into every prompt. For multi-repository work, maintain a lightweight context map that points to authoritative contracts.
- Recursive loops and runaway cost: Cap autonomous retries. Require escalation after a fixed number of failures or when cumulative token cost exceeds a threshold.
- Cross-repository dependencies: Keep interface contracts (OpenAPI, protobuf, and event schemas) in a shared location. Agents implement against the contract, never against another repository’s internal details.
Handled this way, each change strengthens the link between what the business asked for and what runs in production.
The Continuous Chain of Evidence From Spec to Production
A mature workflow creates one unbroken chain in five stages:
- Specification: A human writes and reviews the spec.
- Plan and tasks: The agent produces a plan and tasks, which pass a human gate.
- Implementation: The agent implements task by task and reports deviations.
- Verification: CI verifies the acceptance criteria and non-functional requirements.
- Deployment evidence: Observability data and SLO checks map straight back to the original specification.
BDD scenarios written inside the pack become the executable verification layer, and deployment pipelines can surface the same criteria as release gates. Intent and production finally speak the same language. For one team, that chain improves one feature. For an enterprise, it changes how the organization governs AI-written code.
Spec-Driven Development Gives Enterprises Control Over AI Delivery
A single developer can get by on vibe coding through memory and luck. An enterprise running many agents across many repositories cannot. At that scale, spec-driven development with AI turns the spec into a coordination layer in five ways:
- Agent orchestration: When several agents work in parallel, each takes atomic tasks from the same approved plan. Because task boundaries come from the spec, agents stop overwriting or re-deciding each other’s work.
- Architectural consistency: Project-wide rules, such as approved frameworks, data-handling policies, and “do not touch” zones, live in one versioned file that every agent session reads. Spec Kit calls this file a constitution.
- Code quality: Reviewers judge pull requests against numbered acceptance criteria rather than taste, which makes defects easier to name and faster to fix.
- Governance and auditability: Every commit references a spec section, and every spec change carries a dated change-log entry. Auditors can trace AI-written code back to an approved requirement.
- Production readiness: Non-functional requirements, such as latency, accessibility, and compliance, become CI checks and release gates instead of a late-stage scramble.
A Staged Path to Enterprise Adoption
Enterprises rarely succeed by mandating spec-driven development with AI everywhere at once. Adoption works better in three stages:
- Pilot: One team applies the full workflow to one bounded feature and records review cycles, rework, and defects against a recent vibe-coded feature.
- Standardize: The organization adopts a shared spec template, a shared constitution file, and the four gates as a required part of the pull-request process.
- Scale: Teams move interface contracts into shared locations, so agents in different repositories build against the same source of truth.
None of this comes free, and an honest rollout plan accounts for the cost.
Where Spec-Driven Development Costs More Than It Saves
Spec-driven development with AI adds work before any code exists. The Uvik benchmark recorded a median spec phase of 18 minutes per ticket, and the spec phase consumed 35.1 percent of all tokens in spec-driven runs. Independent evidence is also thin. A peer-reviewed study presented at ESEM 2026 analyzed 88,052 merged open-source pull requests and found that specification artifacts did not reduce defects. The authors also noted that no vendor had published empirical evidence for these tools’ quality claims.
Those findings point to four situations where a full spec pack is the wrong tool:
- Small changes: One- or two-file fixes showed little merge-rate advantage in the Uvik benchmark. A clear ticket and a test are enough.
- Exploratory prototypes: When the goal is to learn what to build, a spec written too early locks in guesses.
- Stale specs: A spec nobody updates is worse than no spec, because agents follow it with confidence.
- Upfront investment: Planning time and token spend rise before delivery speed improves, so the first weeks may look slower.
The practical rule: use a full pack for multi-file features, shared interfaces, and anything with compliance or performance constraints. Use a lighter ticket for everything else. The email triage project from earlier shows a case where the trade-off clearly favored the full pack.
Email Triage Case Study: From One-Line Request to Measured Result
This is an anonymized implementation on a SaaS support platform. The client and the repository remain confidential.
The Problem and the Constraints
Support agents were losing roughly 40 percent of their day to classification and prioritization. The team needed automated triage that classified emails, drafted routine replies, and escalated high-priority items. It also had to stay inside the existing mail infrastructure and meet a strict 30-second classification budget.
How the Team Delivered the Feature
The team wrote a one-page spec pack covering outcome, scope, workflows, edge cases, API contracts, constraints (including context budgets), and four EARS acceptance criteria. The product owner and two senior engineers reviewed it in 45 minutes.
The agent produced a plan with 11 atomic tasks, and humans approved it with two small architecture adjustments. The agent then implemented task by task and raised two clarifications, which the team answered by updating the open-decisions section. When task 6 revealed a subtle schema nuance, the team treated it as a specification change, re-planned the remaining work, and continued. The final pull request referenced every acceptance criterion, and CI ran the new integration suite.
Results and How They Were Measured
The team measured results 2 weeks after release:
78 s
down from about 4 minutes
Average triage time per email
96.4%
measured 2 weeks after release
Classification accuracy
0
on the new path
Production incidents
What the Spec Did After Launch
The same specification later served as onboarding material for two new engineers and as the regression baseline when the team added multi-language support months later. The structure is reproducible with GitHub Spec Kit, Kiro, or plain Markdown plus CI, and the template below gives you a starting point.
Start With One Feature Using This Reusable Spec Template
Copy this skeleton into specs/NNN-feature-name/spec.md and fill it in:
# Feature: [Name]
## Outcome
[One or two sentences describing user and business success]
## Scope
- In: [What this feature covers]
- Out: [What this feature deliberately excludes]
## Workflows
- Happy path: [Main user flow]
- Alternate and edge paths: [Flows that usually cause rework]
## Edge Cases and Error Handling
- [Situation]: [Expected handling]
## Data and API Contracts
[Schemas, examples, and status codes]
## Constraints
- Tech and architecture: [Stack, patterns, do-not-touch zones]
- Performance, security, and compliance: [Budgets and rules]
- Context and token budget: [Maximum context and retrieval strategy]
## Non-Functional Requirements
- [Latency, accessibility, observability, compliance]
## Acceptance Criteria
1. [EARS or Given/When/Then statement]
2. [EARS or Given/When/Then statement]
## Open Decisions
- [Question]: [Owner], [Target date]
## Change Log
- YYYY-MM-DD: Initial versionRun the review-gate checklist before implementation begins. Then hand the pack to the agent and compare its first pull request with your last vibe-coded one.
A Living Spec Replaces the Hidden Tax of Rework
Spec-driven development with AI adds a short planning step, and that step has a real cost. In return, it replaces the hidden tax of repeated clarification, silent drift, and subjective review with a short contract that both humans and agents can trust. The agents stay fast, and the outcomes stay correct.
Start with one bounded feature. Write the minimum viable pack. Install the gates. Explicitly address partial completion, context limits, and cost controls. Let the agent work against the specification instead of against a chat history.
The 11:47 p.m. pull-request disasters become rare. As agents write a growing share of enterprise code, the spec stops being documentation and becomes the control layer that decides whether AI delivery is predictable or merely fast.
FAQs
Spec-driven development with AI is a way of building software with coding agents in which a written, version-controlled specification defines what to build before any code exists. The agent turns the spec into a plan, tasks, and code, and humans review the result against the spec’s acceptance criteria rather than against a chat conversation.
Vibe coding starts with a prompt and judges the output by whether it feels right. Spec-driven development starts with an agreed specification and judges the output against numbered, testable acceptance criteria. The difference shows up in rework: a vague prompt leaves the agent to invent decisions that a spec would have settled in advance.
No. Waterfall freezes long requirements documents before development starts. A spec pack for an AI coding agent is 1 to 3 pages, lives in the repository beside the code, and changes whenever requirements change. The team edits the spec first, re-plans, and updates only the affected code and tests.
GitHub Spec Kit is an open-source toolkit that works with 30 agent integrations through a Specify, Plan, Tasks, and Implement workflow. AWS Kiro builds the same idea into an IDE through requirements, design, and task files. Teams can also run the practice with plain Markdown specs in the repository plus CI checks.
Start with a pilot on one bounded, multi-file feature, and measure review cycles and rework against a recent feature built without a spec. Then standardize a shared spec template, a project-wide constraints file, and the four human gates, before moving interface contracts into shared locations that every team’s agents can read.
Get a spec-readiness review
Share one upcoming feature spec, and a Net Solutions engineering lead will review it against the 8-point gate checklist and show where an AI coding agent would have to guess.