# Spec-Driven Development Won't Prevent AI Slop. You Need Outcome-Driven Development

By Kartik Gohil · Published 2026-10-23 · Updated 2026-11-03
Source: https://kartikgohil.com/articles/outcome-driven-development/
Tags: #Artificial Intelligence #AI Agents #Software Engineering #Specification-Driven Development #Test-Driven Development #Interface-Driven Development #AI Governance

> How Outcome-Driven Development uses specifications, tests and interface contracts to verify AI-generated software before it is accepted.

## Contents
- [1. Specifications tell the agent what to build. Not whether it got it right.](#1-specifications-tell-the-agent-what-to-build-not-whether-it-got-it-right)
- [2. Writing the tests before your agent starts coding.](#2-writing-the-tests-before-your-agent-starts-coding)
- [3. Setting boundaries that the agent can't change.](#3-setting-boundaries-that-the-agent-can-t-change)
- [4. Outcome-Driven Development = SDD + TDD + IDD.](#4-outcome-driven-development-sdd-tdd-idd)
  - [Diagram 1: Outcome-Driven Development.](#figure-1)

Artificial Intelligence / AI Agents / Software Engineering / Specification-Driven Development / Test-Driven Development / Interface-Driven Development / AI Governance

Your AI agent just finished a feature. It wrote the code, ran the tests, and reported that everything was working great.

But then you spotted a bug. Fixing it would mean combing through 3000 lines of modified code, trying to work out what the agent had done wrong. A 60 minute agent run had just turned into an week of debugging, refactoring, and testing. And it was all on you.

The agent had done the coding, but you were still responsible for making the software work.

That's the real challenge with AI. Writing code is one thing. Delivering software that meets its requirements, behaves as expected, and fits into the wider system is another.

So how do you make an AI agent accountable for the work it produces?

## 1. Specifications tell the agent what to build. Not whether it got it right.

AI agents are great at turning prompts into code. But a prompt alone rarely captures everything that an agent needs to build the right thing.

That's why Specification-Driven Development (SDD) matters. It gives teams a way to create version-controlled specifications that capture the requirements, design decisions, constraints, and context that an AI agent needs to do the job.

But there's a catch. Building the right thing doesn't always mean you've built the thing right.

An agent can be given a comprehensive specification and still produce code that misses a requirement or breaks an existing behaviour, even while telling us that everything works perfectly.

SDD defines what goes in. But it doesn't automatically verify what comes out.

What we need is a way to validate an agent's output against the input specification. That's the gap we need to close.

Further Reading

## Have you read The Probability Engine?

Specifications are required because AI is probabilistic, not deterministic. In The Probability Engine, Kartik Gohil explores AI as a different way of computing, and why its probabilistic nature changes how we work.

Available in paperback and hardcover.

## 2. Writing the tests before your agent starts coding.

Test-Driven Development (TDD) is hardly new. Developers have been using it for decades, writing tests before implementing the code that those tests are designed to verify.

It's a well-established practice, not a new idea invented for AI. But as AI agents take on more of the coding, TDD is finding renewed purpose. It gives us a way to define expected behaviour upfront, then check whether the agent's implementation actually delivers it.

By writing the tests first, we establish clear criteria for success before the agent starts coding. The agent can implement the feature, run the tests, fix failures, and repeat until the code passes. We can also run existing tests to check that new changes haven't broken behaviour that was already working.

Instead of taking the agent's word that the code works, we have evidence that it satisfies the behaviours covered by our tests.

That's a big step forward. But passing tests doesn't necessarily mean we've built the right software.

Tests can only verify the behaviours we've thought to check. We might miss an important requirement, overlook an edge case, or write a test that reflects the wrong interpretation of the specification. The agent can pass every test and still produce an implementation that falls short of what we intended.

And tests don't tell us everything about the finished product. The code might behave correctly in isolation but still fail to follow the agreed design, expose the right API, or support the user journey the feature was meant to enable.

To validate the whole feature, we need to look beyond how the code behaves and at how the software is designed to be used.

## 3. Setting boundaries that the agent can't change.

A feature doesn't exist in isolation. It has to fit into an existing system, work with other services, expose the right APIs, and give users a way to complete their tasks. These aren't details to leave to the agent to figure out as it goes. They're part of the specification from the beginning.

Interface-Driven Development (IDD) makes those boundaries explicit and testable. The specification defines the APIs, request and response schemas, command-line interfaces, MCP tools, and user-facing interactions the feature must support.

Agents are forced to work within those boundaries. They can't simply change the specified interface contracts to make their code work.

If an API is specified to return a particular schema, the agent must implement that schema. If a user journey requires someone to complete a task in three steps, the agent can't quietly remove a step or change the interaction just to make its implementation task easier. The agreed interfaces remain the contract.

By adding automated tests around these interfaces, we can check that the implementation respects the agreed contracts. Contract tests verify API responses, CLI arguments and exit codes, and MCP tool inputs and outputs. UI and end-to-end tests check whether users can complete the journeys laid out in the specification.

The result is a smaller blast radius when an agent makes changes. The agent has room to work, but that freedom exists within a defined boundary. Its implementation can evolve without silently changing the interfaces that the rest of the system may rely on.

This is also a familiar architectural principle. Good software architecture separates components, defines their contracts, and limits how changes in one area affect others. Applying that principle to AI-assisted development gives us a way to contain the impact of an agent's changes rather than hoping that it gets every dependency right.

## 4. Outcome-Driven Development = SDD + TDD + IDD.

Think of an AI agent as an execution engine. It can write code, run tests, investigate failures, and try again. But it shouldn't decide for itself whether the result is good enough.

That's where Outcome-Driven Development (ODD) comes in. SDD defines what to build, TDD verifies how it behaves, and IDD establishes testable interface contracts. Together, they give us a way to constrain the agent's implementation and verify the result against agreed acceptance criteria.

*Figure: Diagram 1: Outcome-Driven Development. SDD defines intent, TDD verifies behaviour, and IDD establishes testable boundaries around AI execution.*

Each practice answers a different question:

- SDD: Does the implementation follow the agreed design? The specification captures the requirements, decisions, and constraints that define what we're building.

- TDD: Does the code behave as expected? Tests verify the required behaviour and help catch regressions.

- IDD: Does the software respect its interface contracts? Automated checks verify that APIs, CLI commands, MCP tools, and user journeys meet their agreed requirements.

Together, these practices give the agent room to implement a solution without giving it control over the conditions for success. It can fix failing tests and change its implementation, but it can't simply rewrite the specification or alter an interface contract to make its work pass. Changes to those boundaries must go through an agreed process.

A feature isn't done because the agent says it is. It's done when there's evidence that the implementation meets the agreed acceptance criteria.

The checks will vary with the work. A small internal script doesn't need the same level of verification as a payment-processing service. What matters is that the criteria are explicit before implementation begins, and that the team can verify the result against them.

This gives us a better way to measure the value of AI-assisted engineering. Instead of counting lines of generated code or tasks completed, we can measure whether the code passes the acceptance criteria, how often the code fails validation tests, and how much human intervention is needed to deliver the end-result.

The goal isn't for agents to write more code or complete more tasks.

It's to make the code they produce predictable, testable, and outcome-oriented, so that there's less human intervention needed.
