← Back to libraryDefine the ask
Turn "it works" into acceptance criteria
Give AI-generated code a finish line instead of endless rewrites
The prompt
I am about to have AI build: {{feature}} Who uses it: {{users}} Before any code, write the acceptance criteria: 1. 5-8 concrete conditions that decide whether this feature is done, each verifiable by actually using it. 2. Phrase each as "when ... then it should ...". 3. Mark which are must-pass (not done without them) and which are nice-to-have. 4. Add the edge cases: slow or dead network, empty input, very long content, double-clicking. What should happen in each? Rules: - Specific enough that someone can click through them. "Feels smooth" is not a criterion. - Do not skip the edge cases - that is exactly where AI-generated code falls over.
Replace the {{}} parts with your own content
Why it works
- The "when ... then ..." form forces actionable steps and blocks unverifiable filler like "smooth UX"
- Listing edge cases before coding plugs the branches AI most often forgets
- Splitting must vs nice-to-have tells AI where to spend effort, and tells you when to stop
- Shared criteria make later testing and rework factual instead of a matter of taste
What it looks like
For a login modal, criteria reach the level of "on wrong password, show the specific reason without clearing the username field" and "double-clicking login fires exactly one request".
Where it bites
- Covering only the happy path, so the code breaks the moment input is empty or oversized
- Writing criteria and never checking against them at delivery, which makes them pointless