Skip to content
mentoor

Topic 4 of 5 · 4 min read

Checkable acceptance criteria for agent tasks

Goal: Write acceptance criteria for an agent task that the agent itself can verify with commands and tests.

Write acceptance criteria as things the agent can observe by running a command: a test that passes, an output that matches, a check that exits with code 0. If the agent has to judge "good enough", it will say yes.

Check yourself · 1 of 3

Which acceptance criterion can an agent verify itself?

Choose one answer

Why it matters

An agent that cannot check its work will report success based on how the code reads. Anthropic's own guidance for Claude Code names verification as the single most useful thing you can give an agent: tests, screenshots or expected outputs it can compare against. Criteria like "should be fast and clean" give it nothing to compare. Criteria that run give it a loop: change, run, read the failure, fix.

What a checkable criterion looks like

Each one has three parts: a situation, an observable result and a way to run it.

  • Weak: "Handle invalid input properly."
  • Checkable: "POST /signup with an empty email returns 400 and body {"error":"email_required"}. Test: pnpm test signup -t 'empty email'."

Cover these kinds:

  1. Behaviour. Inputs and expected outputs, including the failure cases.
  2. Regression guard. "All existing tests in src/billing still pass."
  3. Boundaries. "No files outside src/signup/ change." The agent can check this with git diff --stat.
  4. Quality gates. Type check, linter and build commands from your project, run exactly as CI runs them.
  5. Not-done signals. "If a test cannot be made to pass without changing its expectation, stop and report."

Before and after

Before:

Add rate limiting to the login endpoint. Make sure it works well.

After:

Add rate limiting to POST /login.
Done when:
1. The 6th failed attempt from one IP within 60 seconds returns 429.
   Test: new test in auth/login.rate.test.ts.
2. A successful login resets the counter. Test in the same file.
3. pnpm test auth and pnpm typecheck both pass.
4. git diff --stat shows changes only under src/auth/.
Do not edit existing tests. If one fails, stop and tell me.

The numbers in item 1 are your product decision, not a universal rule.

What goes wrong

  • Subjective words. "Robust", "clean" and "efficient" cannot be run.
  • A check the agent can edit away. If it may change the tests, a passing suite proves little. Say which tests are fixed.
  • Only the happy path. Agents often test what they built. Ask for failure and edge cases by name.
  • Criteria you never run. Run the key command yourself before approving. The agent's "all passing" is a claim.

Examples

Criteria for a bug fix

Bug: invoices over 999.99 show the wrong total.

Done when:

  1. A new failing test reproduces it first: formatTotal(1234.5) returns "1,234.50".
  2. After the fix, that test passes.
  3. pnpm test invoices passes with no existing test edited.
  4. Only src/invoices/format.ts and its test changed.

The unfixable criterion

A task says "page loads fast". The agent cannot measure that, so it adds caching, reports success, and the page is no faster. Rewritten as "the /reports route returns in under 300 ms in the local benchmark script, run with pnpm bench reports", it gives the agent a number to work against. The 300 is an example target.

Key points

  • A checkable criterion has a situation, an observable result and a command that verifies it.
  • Words such as "robust", "clean" and "works well" cannot be verified by an agent and invite premature success claims.
  • Include regression guards, scope boundaries and the same quality gates CI runs.
  • Say which tests the agent may not change, and tell it to stop and report if it cannot pass them.
  • Run the key check yourself before approving, because the agent's report is a claim, not proof.

Common mistakes

  • Using subjective goals such as "make it robust" that no command can check.
  • Letting the agent edit the tests that define success.
  • Listing only happy-path behaviour and leaving error and edge cases to the agent.
  • Accepting "all tests pass" without running the command yourself.

Check yourself · 2 of 3

Why tell an agent which existing tests it may not edit?

Choose one answer

Check yourself · 3 of 3

A task says "make the report page fast". What is the best rewrite?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic