-- online Search!

Specs Agents Can Build From

by kirupa   |   30 November 2026   |  filed under Product Thinking

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:

A page from Dana's one-pager titled Settle up. It says: At the end of the month, roommates settle up. Show who owes whom. Keep it simple and fair. Let people mark payments as done. Dana stands beside it, saying That's everything!

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:

A joke picture: a robot holds up a big blueprint that is almost entirely empty grid paper. The only words on it are Settle up, keep it simple and fair. The robot cheerfully says I'll figure it out!

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:

The agent's settle-up screen for March shows six payments, one for each roommate's share of each bill: Oskar pays Pilar $800, Silas pays Pilar $800, Pilar pays Silas $30, Oskar pays Silas $30, Pilar pays Oskar $20, and Silas pays Oskar $20. Every row has a Pay now button. A handwritten note says Six payments?!

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:

A table with three rows. Dana wrote Show who owes whom; the agent guessed every debt, bill by bill, 6 payments; Dana meant the fewest payments, 2 for March. Dana wrote Keep it simple and fair; the agent guessed a Pay now button and a payments library; Dana meant record payments only, with no money moving in the app. Dana wrote Mark payments as done; the agent guessed anyone can tap Paid; Dana meant the person who got the money confirms it.

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:

A spec drawn as one document with five sections from top to bottom. Why: the problem it solves. Examples: real numbers in, exact results out. Acceptance criteria: statements that pass or fail. Constraints: rules for how it gets built. Out of scope: what not to build.

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:

March's bills: rent $2,400 paid by Pilar, internet $60 paid by Oskar, and groceries $90 paid by Silas. Each roommate's share is $850. Settling up takes 2 payments: Oskar pays Pilar $790 and Silas pays Pilar $760.

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 $100.00 internet bill paid by Oskar, split three ways in dollars and cents: Oskar's share is $33.34, and Pilar and Silas owe $33.33 each. The three shares add up to exactly $100.00. A handwritten note says Oskar covers the extra penny.

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:

An example map. At the top, the story card: Settle up at the end of the month. Below it, three rule cards, each with example cards under it. Fewest payments: March takes 2 payments, and all square means no payments. Shares add up to the bill: $100 becomes $33.34, $33.33, and $33.33. The receiver confirms: Oskar sends $790 and it waits for Pilar. A question card says: What if someone pays only part?

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:

March's example written as an acceptance criterion in three parts. Given, the starting situation: Pilar paid $2,400 rent, Oskar paid $60 internet, and Silas paid $90 groceries. When, what someone does: anyone taps Settle up. Then, what should happen: the app suggests exactly 2 payments, Oskar pays Pilar $790 and Silas pays Pilar $760.

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:

Three columns. Always: store money as whole cents, and name a test after each acceptance criterion. Ask first: changing database tables, and adding a library. Never: move real money, and store bank details.

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:

A dashed boundary labeled Settle up holds what this feature does: suggest the fewest payments, record payments, and confirm payments. Outside it is what's out of scope: paying through Venmo or a bank, partial payments, more than one currency, and recurring bills.

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:

Four rows. At the end of the month, roommates settle up, became the Why: pay each other back in as few payments as possible. Show who owes whom became E1 and AC1: March settles in exactly 2 payments. Keep it simple and fair became E2 and AC2, shares add up to $100.00, plus Never: move real money. Let people mark payments as done became AC3: Pilar confirms Oskar's $790.

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:

A checklist of Dana's four acceptance criteria, each tried by hand and checked for a test named after it. AC1, fewest payments: works by hand and has a test. AC2, shares add up: by hand, the $100 bill adds up to $99.99, and there's no test for it. AC3, receiver confirms: both pass. AC4, all square: both pass. A handwritten note points at AC2's missing test: No test!

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 app's screen for a $100.00 internet bill paid by Oskar. Oskar, Pilar, and Silas each get a share of $33.33, and the shares add up to $99.99. A handwritten note asks Where'd the penny go?

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:

A small flowchart. A check fails. Does the spec answer it? If yes, send the failing example back to the agent, and ask for a test named after it. If no, update the spec first, then have the agent rebuild. Either way, run every check again.

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:

  1. Underline every vague word, like simple or fair, and replace it with an example that has real numbers and an exact result.
  2. Put rules, examples, and open questions on separate cards. Answer each question, or move it to Out of scope.
  3. Turn each example into a Given/When/Then acceptance criterion, then add your Always, Ask first, and Never constraints.
  4. 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:

A callback to the earlier joke picture: the same robot now holds a blueprint filled in with Why, Examples E1 to E3, Acceptance criteria AC1 to AC4, Constraints, and Out of scope. It says Now I know when I'm done!

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:

  1. 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! 😇

Kirupa's signature!

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright © KIRUPA 2026 //--