TL;DR
Before a coding agent builds a feature, write down what it should do: real examples with exact results, statements that pass or fail, rules for how it gets built, and what to leave out. That document is a spec. When the agent says it's done, try each example by hand and look for a test named after each criterion.
- Dana's four-sentence one-pager got six payments and a Pay now button nobody asked for, because the agent filled every gap with its own guesses.
- Examples with real numbers, like March settling in 2 payments, replace words like fair and bring out questions like who pays the extra penny.
- Acceptance criteria in Given/When/Then form name the starting situation, one action, and an exact result that passes or fails.
- Always, Ask first, and Never constraints plus an Out of scope list keep the agent from building extras, like moving real money.
Dana has done a lot of homework in this series. Dana talked to roommates in shared apartments, figured out what they are really trying to get done, tested the riskiest assumption, and watched people try a prototype of the settle-up flow (the part where roommates pay each other back). All of that learning lives in Dana's head and in a one-page doc. Now it is time to build the real thing, and Dana builds with a coding agent.
There is a problem, though. A coding agent can build a feature in minutes, but it can only build what it was told, and a one-pager tells it a lot less than we think. In this article, we'll help Dana turn that one-pager into something an agent can actually build from, and then we'll check what the agent hands back.
Onwards!
What Does a One-Pager Leave Out?
Dana's one-pager covers the problem, what the interviews turned up, and the feature to build first. That feature is settle up, the moment at the end of the month when roommates pay each other back. Here is the part of the one-pager that describes it:

To Dana, this is plenty. Dana sat through every interview and every usability test, so each line carries a bunch of unwritten details. A coding agent gets only the words and our code. It is tempting to hand the page over anyway and hope the agent fills in the blanks:

And it will! It just fills them in with its own guesses, and it doesn't tell us which parts it guessed. We'll use one apartment for all of our examples. Pilar, Oskar, and Silas share a place. In March, Pilar paid the $2,400 rent, Oskar paid the $60 internet bill, and Silas paid $90 for groceries. Here is what the agent's settle-up screen shows for them:

Where did six payments come from? The agent settled every bill separately, so the math isn't wrong, but nobody wants to send six payments when two would do. To build those Pay now buttons, the agent also pulled in a payments library. If we line up what Dana wrote next to what the agent guessed, we get the following:

Look at the middle column. Each guess is reasonable on its own, and none of them is what Dana meant. This means the gaps will only show up after something gets built, one surprise at a time.
What Is an Agent-Ready Spec?
What Dana needs is a document that answers these questions before the agent starts, clear enough that someone who has never met our three roommates could build the feature and know when it is finished. That kind of document is called a spec (short for specification). We looked at why specs matter, and at the tools built around them, in Spec-Driven Development. Here, we are going to focus on the craft of writing one.
A couple of terms will come up a lot. Examples are real situations with real numbers in them (like March's bills), along with the exact result we expect. Acceptance criteria are statements about the finished feature that are either true or false, so a test or a person can mark each one pass or fail. Here are all of the parts of an agent-ready spec:

The Why at the top is a sentence or two about the problem. It helps the agent make the small calls nobody wrote down the way Dana would have. We will fill in the other parts, starting with the examples.
Why Start With Examples?
Words like simple and fair feel precise while we're writing them. They aren't. If we ask our three roommates what fair means, we may get three different answers. A number doesn't have that problem, so the first example we write down is March:

Each roommate's share is $850, a third of all three bills. Pilar paid $1,550 more than her share, Oskar paid $790 less, and Silas paid $760 less. That means Oskar sends Pilar $790, Silas sends her $760, and everyone is square in 2 payments. The agent will be able to check its work against these numbers, and so will we.
Examples also drag hidden questions into the open. When we try a $100 internet bill, a third of it is $33.333...and so on forever, which doesn't fit into dollars and cents. Somebody has to pay the extra penny, and Dana decides it should be the person who paid the bill:

A penny sounds silly, but an agent will decide details like this on its own without telling us, and then every total in our app ends up a cent off.
Matt Wynne, who leads the Cucumber testing project, has a low-tech way to dig up more questions like this called Example Mapping. We write the feature on one card, each rule on its own card, the examples for each rule under it, and any question nobody can answer yet on a card of its own.
For settle up, our map looks like this:

Look at the question card at the bottom. Dana hadn't thought about someone paying only part of what they owe. Wynne's advice is that when we can't say what the outcome should be, we don't have an example yet. We have a question, and its answer (from a few roommates, or a decision to leave it out) goes into our spec.
How Do We Write Acceptance Criteria?
Each example turns into one or more acceptance criteria. A handy way to write one is in three parts: the starting situation, the thing someone does, and what should happen. That shape is called Given/When/Then. Daniel Terhorst-North and Chris Matts came up with it as part of behavior-driven development, a way of describing what software should do through examples. Here is our March example in that shape:

Notice how specific the Given part is. It lists every bill, who paid it, and how much, so there is nothing left for the agent to guess. The When part is one action, and the Then part is an exact result that will be either true or false once the feature exists. If we ever get stuck writing a Then, we are looking at a question card.
What About Constraints and Scope?
Examples and acceptance criteria describe what the feature does. Constraints are the rules for how it gets built. Remember the Pay now button? Nothing in the one-pager said our app doesn't move money, even though three of the five people in Dana's usability test worried that Settle up would. So the agent added a library that does. Addy Osmani's guide to writing a good spec for AI agents has a sample spec that sorts limits like these into what the agent should always do, what it should ask about first, and what it should never do.
Here are the ones we picked for settle up:

Storing money as whole cents is a rule we would never think to tell a person. Computers store a decimal like 0.10 in a slightly fuzzy way, and over enough bills, that fuzziness can make a penny go missing. Counting in whole cents (3,334 instead of 33.34) keeps every total exact.
Next to the constraints sits a list of things this feature won't do. An agent that is trying to be helpful will happily build more than we asked for, and an Out of scope list tells it where to stop:

Partial payments made the list because of our question card, since Dana decided they can wait until real roommates ask for them. Writing that down is a lot cheaper than finding out later that the agent decided for us.
Putting the Spec Together
Here is our whole spec for settle up in one place:
# Spec: Settle up
## Why
At the end of the month, roommates want to pay each other
back in as few payments as possible, and trust the math.
## Examples
E1 March: Pilar paid rent, $2,400. Oskar paid internet,
$60. Silas paid groceries, $90. Each share is $850.
Oskar pays Pilar $790. Silas pays Pilar $760.
E2 Oskar pays a $100.00 internet bill, split three ways:
Oskar $33.34, Pilar $33.33, Silas $33.33.
E3 Everyone has paid exactly their share: no payments.
## Acceptance criteria
AC1 Given the E1 bills, when anyone taps Settle up,
then the app suggests exactly the two E1 payments.
AC2 Given the E2 bill, when the app splits it, then the
shares match E2 and add up to exactly $100.00.
AC3 Given Oskar marked his $790 payment as sent, when
Pilar confirms it, then it shows as Paid. Until
then, it says "Waiting for Pilar."
AC4 Given the E3 month, when anyone taps Settle up, then
the app says "You're all square" and suggests nothing.
## Constraints
Always: Store money as whole cents. Name a test after
each acceptance criterion.
Ask first: Changing database tables. Adding a library.
Never: Move real money. Store bank details.
## Out of scope
Paying through Venmo or a bank, partial payments, more
than one currency, and recurring bills.
Compare that with the four short sentences we started with. Each vague line from the one-pager turned into something exact:

Every acceptance criterion points back at an example, and nothing says which files to change or how to work out the fewest payments. Those decisions are the agent's job.
How Do We Check What the Agent Built?
A little while after Dana hands over the spec, the agent reports that it's done and all of its tests pass. This is the moment to be a little suspicious! A passing test only tells us about the things somebody thought to test, so we go down the acceptance criteria one at a time and check each one:
- We type the criterion's example into the app by hand and see whether the result matches.
- We look for a test named after the criterion, so it gets checked again on every future change.
Here is how our checklist turns out:

Look at the AC2 row. There is no test named after it, and when we enter the $100 internet bill by hand, this is what we see:

The agent split the bill into three shares of $33.33 and let the extra penny vanish. Our spec answered this question, and the agent skipped it anyway. The fix is to send AC2 back with its example and ask for a test named after it. Once that test fails and then passes, AC2 turns green.
Not every failure is the agent's fault, though. While trying things by hand, we delete the grocery bill after Oskar's $790 payment was already confirmed, and the balances stop making sense. Our spec never said what should happen there, so who should fix that one, the agent or us? Here is how we decide:

If the answer only lived in a chat message, the next agent to touch settle up would never see it. In the spec, every future build is going to start from the same answer.
Try It This Week
Grab a one-pager (or a feature idea you've been meaning to hand to an agent) and try this:
- Underline every vague word, like simple or fair, and replace it with an example that has real numbers and an exact result.
- Put rules, examples, and open questions on separate cards. Answer each question, or move it to Out of scope.
- Turn each example into a Given/When/Then acceptance criterion, then add your Always, Ask first, and Never constraints.
- When the agent says it's done, try each example by hand and look for a test named after each criterion.
Conclusion
Ok! It is time to wrap things up. We started with Dana's four-sentence one-pager and an agent that built six payments and a Pay now button nobody asked for. The agent wasn't being careless. It filled every gap with its best guess, which is what agents do when we leave gaps. Here is our robot from earlier, now holding a blueprint it can actually build from:

Our spec closes those gaps with examples, acceptance criteria that pass or fail, constraints, and a list of things to leave alone. If I had to pick one part of the spec to write first, it would be the examples, since nearly every hard question Dana answered (from the extra penny to partial payments) showed up while writing one. A spec won't stop an agent from skipping a rule now and then, so we still check every criterion when the work comes back.
That also wraps up Dana's trip through Discovery. Dana started with no users and a hunch, and now there's a settle-up feature built on what real roommates said and did. Go build something your roommates will actually use...and make sure it adds up to the penny!
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, Prioritization Frameworks and Their Limits, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

