Write a One-Page Spec Your AI Can Actually Follow

Say “handle duplicates properly” to an AI and it will pick a meaning and build it. It will not tell you it picked. “Vague specs produce vague code,” as Addy Osmani puts it (O’Reilly, Feb 2026), and the code that comes back looks finished either way. A spec an AI can follow fits on one page, and every line on it is something a test, a command or your own eyes can pass or fail.
What does “handle duplicates properly” turn into?
Here are four small versions of that one line, each a reasonable reading. One quietly keeps a single copy. One replaces the old entry with the new one. One allows the duplicate and marks it. One refuses it with a message. Now the followable version of the line:
WHEN a user adds a book whose title and author are already on the list, THE SYSTEM SHALL refuse to add it and say it is already on your list.
That sentence became one test, written test-first in the TDD way, and it ran against all four:
test("adding the same book twice is refused with a clear message", () => { const list = createList(); list.add("Thinking in Systems", "Donella Meadows"); assert.throws(() => list.add("Thinking in Systems", "Donella Meadows"), /already on your list/); assert.equal(list.toRead().length, 1);});== ignore # pass 0 # fail 1== overwrite # pass 0 # fail 1== allow # pass 0 # fail 1== refuse # pass 1 # fail 0The test checks what a user sees, not how the code is built, which is why it works against four different implementations (why that matters). Three plausible readings fail, and the vague line could not have told you which one you got. The code is on the site, /examples/duplicate-readings/, which lists every file, and runs with Node 22 and no install. This post is about writing the line. For where the spec sits in the whole build, see how to start a new app with AI.
Why one page and not ten?
Markus Eisele describes a U-shaped cost curve: plot the total cost of agent work against how complete the spec is, and the minimum sits around well-structured acceptance criteria, not at zero specification and not at a 40-page requirements document (O’Reilly, Jul 2026). One page is also the size you will keep updated, and a stale spec is worse than none, because the AI trusts it.
What does a one-page spec look like?
# <App name> spec (one page)
## Who and whyOne sentence: who uses this and what it does for them.
## Behaviors- WHEN <user action>, THE SYSTEM SHALL <visible result>.- WHEN <user action>, THE SYSTEM SHALL <visible result>.
## Rules and edge cases- <the duplicates rule, the empty-input rule, the not-found rule>
## Out of scope (v1)- <what the AI must NOT build>
## Stack and constraints- <exact tools and versions>, <anything it must never do>
## Undecided- [NEEDS CLARIFICATION: <the decision you have not made>]The WHEN … THE SYSTEM SHALL shape comes from AWS Kiro’s spec docs (Kiro docs). GitHub’s Spec Kit template uses Given / When / Then scenarios for the same job (spec template). Pick either, or plain “When X, the app does Y”. Each line needs an action and a visible result, because then one line becomes one test. The companion post’s demo spec uses plain bullets; this is the stricter version for the lines that bite.
Two sections do more than they look like.
Pin the stack with versions. Osmani’s example: “React 18 with TypeScript, Vite, and Tailwind CSS,” not “React project.” One likely reason, untested: a model writes against the versions it saw most, so a framework that changed its API recently can come out in the older style. If you are on a newer version, say so, and paste the link to its current docs into the spec.
Mark the undecided instead of letting the AI guess. Spec Kit’s template writes [NEEDS CLARIFICATION: retention period not specified] where the author has not decided. The AI may still resolve it silently, so add one line to your prompt: “Do not start building until every NEEDS CLARIFICATION is answered.”
What about “fast” and “secure”?
“The app should be fast.” No test can check that. The followable version picks one number on one screen: “the to-read list shows 5,000 books in under 10 ms.” A budget is only worth writing if it can go red, so the demo has a fast list and a deliberately wasteful one that returns the same answer. On a laptop the fast one took about 0.5 ms and the wasteful one about 80 ms, so a 10 ms budget has room on both sides. The test also checks that real data came back, so an empty list cannot pass by being quick. npm run test:timing, run three times:
== fast # pass 1 # fail 0== slow # pass 0 # fail 1 took 73.5 ms, budget is 10 msAll three runs gave the same result, with the slow version between 73 and 74 ms. Wall-clock tests can still flake on a busy machine, so keep the budget well clear of the real time and treat a red as a prompt to look.
“Make it secure” is a wish. The followable version names behaviors: “passwords are stored hashed, never in plain text; a logged-out visitor asking for /api/books gets a 401, not data.” Each clause is something a test or a curl command can check.
Should the AI attack the spec?
Before any code, run one more prompt. Eisele’s idea is a second agent that stress-tests the draft for consistency, completeness and testability, because an agent that merely “writes requirements” produces what he calls polished fog. Paste this:
Attack this spec. List the three questions you would ask me before building it. Name lines two engineers could implement differently, contradictions, edge cases with no rule, and lines no test could check. Do not rewrite anything and do not add features.
Its list is also the AI guessing, so ask for questions, not rewrites. The questions you cannot answer in one sentence are the holes. This prompt was not run against a real model for this post.
The one check an engineer does by hand
Read each behavior and rule line and ask: could the AI build two different things that both satisfy this line? If yes, add an example or a number. Osmani suggests small examples inside the spec, such as “All API responses should be JSON, e.g., {"error": "message"} for errors,” because an example anchors the format in a way prose cannot.
When the lines are all checkable, asking the AI for the tests becomes a review job instead of a leap of faith.
The Get AI Native ebook goes deeper on this. It is free, and the expected launch is around Christmas. Join the waitlist on the homepage.