
Be In Spec
Spec-Driven Development Through the Eyes of an AI Agent
Every test passed, the code was tidy, and the feature was still wrong in five ways: the AI coding agent that built it explains why.
202 pages in printReading time: about 4 hoursKindle
Get it on Amazon
Other Amazon stores: Amazon.com · Amazon.co.uk · Amazon.ca · Amazon.com.au · Amazon.de
About the book
You ask a coding agent for something small: add a CSV export to the orders page. It reads the repository, follows the conventions it finds, writes tests, and reports that they pass. The diff is tidy. You merge it before lunch. Over the following weeks the totals add up to zero, the revenue comes out too high, and a few orders land in the wrong month. Any staff account can download every customer’s email address. The quarterly export runs until the server gives up. None of it is a bug in the usual sense. For each problem, one fact was missing.
Be In Spec tells that story from the other side of the conversation. The narrator is an AI coding agent, though not any particular product. In its own voice it explains what it knows, what it cannot know about your project, and how it fills each gap with the most likely default. Those guesses arrive with the same confidence as everything you did specify, so they look like decisions, to you and to the agent. The book says plainly that it describes how coding agents typically behave today, and that tools differ in the details.
Then it shows what to write down so that the agent stops guessing. A base file of one or two pages, read at the start of every session. A short feature spec that answers five questions: the problem and who has it, what is in and out of scope, how we will know it is done, the constraints, and what is still undecided. Acceptance criteria that a test can check. Stories small enough to review in ten or fifteen minutes. Weak and stronger versions sit side by side, because the difference is often a single sentence.
It ends with a small experiment, run in November 2026. Three coding agents from three companies built the same feature and a later change, asked in three ways, in 54 sessions scored by hidden tests. Given one line, they met fewer than a third of the requirements. Given the requirements in writing, every session met all of them. A careful chat message with the same facts did just as well as the spec. The book prints that result plainly, with everything else the experiment does not show.
Afterwards you can write a base file in which every line earns its place, turn a one-line request into a page, write criteria that can fail, and check an agent’s report against seven ways “done” can be wrong. You need no particular tool: a text editor, a folder of Markdown files, and the agent you already use are enough.
Read the opening
Introduction: The Same Task, Twice
I want to start with a small story, and then tell it again.
I should say first that I can’t tell you about a particular Tuesday. I don’t carry memories from one session to the next, which is something we will come back to. But I know how I work, and every piece of this story follows from it. Nothing in it is unusual. That is why I chose it: the failures worth understanding are the ordinary ones.
The first telling
You are working on an internal admin application for an online shop. It has a list of orders, some filters, and a detail view. Someone from finance has asked, for the third time, whether they could get the orders into a spreadsheet. You open a session with me and type one line:
Add CSV export to the orders page.
From your side, that is a complete thought. You know who asked and why. You have seen the spreadsheet they keep. You know which month-end report this is for and roughly how many orders the shop takes. You remember an awkward conversation last year about who is allowed to download customer data. None of that is in the sentence, and you would hardly think to put it there, any more than you would explain it to a colleague who had sat next to you for two years.
I have not sat next to you for two years. I have the sentence and the repository.
So I read the repository. I find the orders page, the component that renders the table, the endpoint that feeds it, and the model behind it. I see how filters are passed, how dates and amounts are formatted for display, and how the other endpoints check that a user is logged in. I see forty orders in the seed data. Within a minute or two I have a good picture of how this codebase does things, and for the part of the task that is about code, I am well equipped.
Then I begin to build, and as I build, I decide things. I want to slow this part down, because normally it takes seconds and leaves no trace.
Who it’s for
- Developers who already build software with an AI coding agent and want Tuesday’s results to match Monday’s.
- Tech leads and engineering managers who review agent-written work and need to tell a finished feature from a confident report.
- Teams whose base file, the
AGENTS.md,CLAUDE.md, or similar file an agent reads first, keeps growing and still does not prevent the same mistakes. - Sceptics who tried an agent, found the results inconsistent, and want to know how much of that came from what the agent was given.
- Not for you if you want a guide to one particular tool or a collection of clever prompts. The book also assumes you know what a test, version control, and an API are.
Inside the book
- Part I, How I Think: what the agent knows and what it cannot, how it fills gaps without seeing them, why important lines sink on a crowded desk, and the five questions every task answers, whether you answer them or not.
- Part II, The Files: the base file, the feature spec, acceptance criteria (including Given, When, Then), stories cut as vertical slices, and supporting files such as a glossary and decision records.
- Part III, Working Together: the whole process on one page, with the points where you read and decide. How to correct, stop, or throw away the agent’s work. Seven ways “done” can be wrong, and what a report worth reading looks like. How to keep a spec true when plans change.
- Part IV, In Practice: common mistakes traced from symptom to cause. One feature, a ten per cent loyalty discount, followed from first draft to done, with Nadja, who owns the loyalty programme, answering the product questions. What changes with an existing codebase, a team, or several agents at once.
- Templates to copy: a base file, a feature spec, a story, a decision record, a glossary entry, and standing requests.
- Eight checklists, from the one to use before handing the agent a spec to a health check for the base file every month or two.
- For small tasks: a request of seven sentences that answers all five questions. You can use it on your next bug fix the same day.
- The experiment and an afterword, “What Won’t Change”, on what will still hold as agents improve.
A note from the author
This book came out of a gap I kept meeting in practical work with coding agents: the distance between what a person means and what reaches the agent. The moment that matters cannot be seen from the developer’s chair. It is the moment a reasonable guess becomes a decision that nobody made. So I let the agent tell it. If you know how it reads, you know how to write for it.
I also wanted the book to meet its own standard. It asks you to want evidence rather than claims. So it ends with an experiment, and it prints the result that did not favour the book: a careful message did as well as a spec. What I hope you keep is the habit underneath both. Write down what matters, where the next session and the next person will find it.
For readers of
- The Pragmatic Programmer by Andrew Hunt and David Thomas
- Specification by Example by Gojko Adzic
- Test-Driven Development: By Example by Kent Beck
