Acceptance criteria your AI coding agent can actually test A developer outlined a method for writing acceptance criteria that AI coding agents can actually verify, arguing that vague criteria like "the dashboard should load quickly" give an agent nothing to fail against. The approach requires each criterion to name specific data, routes, numbers, ordering and timing, pair every success case with a failure case, and state observable outcomes rather than implementation details such as database indexes. The developer also recommends splitting multi-part criteria into separate testable clauses so edge cases like empty states and double submissions become numbered tests the agent must pass before declaring a feature done. Most acceptance criteria I see in PRDs are wishes, not tests. "The dashboard should load quickly." "Users should be able to reset their password easily." "The search should work well." Hand those to an AI coding agent and it will nod, build something, and call the feature done — because there is nothing in the sentence it can fail against. A criterion the agent cannot test is a criterion the agent cannot satisfy. It is decoration. Good acceptance criteria are written so that a machine — or a tired reviewer at 11pm — can check them and say yes or no without guessing. Here is how I write them. The format is not the point. The values are. Weak: GIVEN a logged-in user WHEN they open the dashboard THEN they see their tasks Strong: GIVEN a user with 3 active sprints and 12 open tasks WHEN they open /dashboard THEN the page renders within 1.5s and lists exactly the 12 open tasks, ordered by due date ascending, with the sprint name on each row The strong version names the data, the route, the number, the order, and the time. An agent can build a test for every clause. The weak version has no clause at all — "see their tasks" could mean anything, and the agent will pick the easiest interpretation. Rule: if a criterion has no number, no named state, and no named outcome, it is not finished yet. A feature is only defined when you also say what happens when it goes wrong. For every success case, write the failure case next to it: - Success: GIVEN a valid email and password WHEN the user submits the login form THEN a session is created and the user lands on /dashboard - Failure: GIVEN a wrong password WHEN the user submits the login form THEN no session is created, the form shows "Incorrect email or password", and the password field is cleared Agents are optimistic builders. Left alone, they build the happy path and leave the error state as a browser alert or a silent nothing. The failure twin is what forces the error UI, the validation, and the "what happens next" into the build — before a real user discovers the gap. The bugs that cost you a weekend are never in the main flow. They are in the edges: empty lists, duplicate submissions, expired sessions, zero results, amounts of exactly zero. - GIVEN a workspace with no sprints WHEN the lead opens /sprints THEN show an empty state with a "Create your first sprint" button, not a blank page and not a loading spinner that never stops - GIVEN a user double-clicks "Record payment" WHEN the second click lands before the first request finishes THEN only one payment is recorded; the button is disabled while the request is in flight Write the edge case as a criterion with the same GIVEN / WHEN / THEN shape. If it lives in a footnote "handle empty states" , the agent will not build it. If it is a numbered criterion, it becomes a test the agent runs before calling the feature done. "The API should use a database index" is not an acceptance criterion. It is an implementation detail wearing a criterion's clothes, and it cannot be observed from the outside. Observable instead: GIVEN 10,000 indexed records WHEN the user searches for "invoice" THEN results appear in under 500ms The agent is free to add the index, cache the query, or paginate — whatever satisfies the observable number. Criteria that prescribe the implementation tie the agent's hands and still fail to say what the user experiences. Criteria that state the observable outcome let the agent choose the means and let you verify the end. A criterion that says three things is a criterion that passes when two of them work: Bad: "The user can sign up, verify their email, and see the onboarding checklist." Split it: - GIVEN a new email address WHEN the user signs up THEN an account is created and a verification email is sent within 30 seconds - GIVEN an unverified account WHEN the user clicks the link in the email THEN the account becomes verified and the user lands on /onboarding - GIVEN a verified account WHEN the user lands on /onboarding THEN the checklist shows 3 items, all unchecked Three checks, each pass or fail on its own. When the agent runs them, a failure points at exactly one broken thing instead of a vague "signup doesn't work". In the four files I generate, acceptance criteria sit in PRODUCT REQUIREMENTS.md — one GIVEN / WHEN / THEN block per feature, success and failure side by side, edge cases as numbered criteria. AI AGENT IMPLEMENTATION.md then tells the agent to treat each criterion as a check: build the feature, run the checks, do not call it done until every one passes. TECHNICAL ARCHITECTURE.md turns the numbers into indexes, validation schemas, and idempotency keys, and UI UX SPECIFICATION.md carries the empty states and error states the failure cases demand. The point is not the format. The point is that the agent has something to test against — and that you have something to hold it to when it says "done". Read any criterion in your PRD and ask: could I write a test for this without asking the author a question? If the answer is no — no number, no named state, no observable outcome — rewrite it before the build starts. It takes five minutes per feature, and it is the difference between an agent that finishes your feature and an agent that finishes something that looks like your feature. If you want the same starting point, the generator writes GIVEN / WHEN / THEN criteria into every feature it produces — you can try it free with 50 credits at webdevmehedi.com/ai-prd-generator https://webdevmehedi.com/ai-prd-generator — and the free template behind the format is in the ai-prd-template repo https://github.com/web-dev-mehedi/ai-prd-template . A PRD without testable criteria is a wish list. Write the test into the wish, and the agent will build what you actually asked for. Web Dev Mehedi turns an app idea into a build-ready PRD, UI/UX spec, database schema, API contracts, and Cursor/Claude Code rules in under 60 seconds. Free signup includes 50 credits; paid plans start at ৳99/month.