I wrote a 3 page spec for my invoicing tool in a Google doc, pasted it in, and Claude built something that is maybe 60% of it, with its own ideas for the rest. Clearly I'm doing something wrong. What does a spec look like that works?
What I’ve tried
Made the spec longer with more detail. Result got slightly better but it still invented things like a 'dashboard' I never asked for.
Numbered, testable requirements instead of prose. Not "users can manage invoices" but "R3: an invoice has status draft/sent/paid; only drafts can be edited". Claude can check itself against R1–R12; it can't check itself against a vibe.
An explicit out-of-scope list. "Not in this version: dashboard, multi-currency, PDF templates." That's what stops the invented dashboard.
Put it in the repo (docs/SPEC.md) and build it in phases: "Build R1–R4 only. When done, list which requirements are covered and how to test each."
Then after each phase: "Compare the code against SPEC.md. List anything built that isn't in the spec and anything missing." It's surprisingly honest when asked that way.
Add examples for anything with rules: "Invoice INV-2024-001 for €100 with 21% VAT shows €121." Concrete examples are the part of a spec models follow most reliably.