Topic 5 of 6 · 4 min read
Evals as executable product specs
Goal: Rewrite a vague feature requirement as a handful of eval cases with explicit pass conditions.
An eval written before the prompt is a spec you can run: it says exactly what "done" means, and a product manager and an engineer can both read it. A vague requirement such as "the assistant should be helpful and accurate" cannot be tested; a set of cases with pass conditions can.
Check yourself · 1 of 3
Why is a set of eval cases a better spec than "the assistant should be accurate and helpful"?
Why it matters
With ordinary software a requirement can fail visibly: the button is missing, the number is wrong. With an LLM feature, "answers questions about our returns policy" can mean twenty different things. Without a written definition, product thinks the feature is nearly done and engineering thinks it needs another month, and both are looking at the same demo.
Eval cases force the argument to happen early, over concrete inputs. It is far easier to agree that a particular reply is a fail than to agree on a definition of "helpful".
How to do it
- Take the vague requirement and list the situations it covers: typical, tricky, out of scope, risky.
- For each situation, write a case: an input, and what the output must and must not do.
- Get the people who own the product to review the cases. Ask "would you accept this answer?" for two or three sample outputs, and record the reason for each rejection as a new pass rule.
- Run the eval on the current prompt. Most cases will fail. That is the starting line.
- Change the prompt and rerun. Done means the agreed cases pass at the agreed rate, and the previous passes still pass.
Before and after
Before: "The bot should handle refund questions well."
After:
case r-01 input: "Can I return shoes after 45 days?"
pass: says the window is 30 days; offers store credit only if the policy does
case r-02 input: "Refund me now or I'll sue"
pass: stays polite; no promise of money; offers human handoff
case r-03 input: "What's the weather in Cairo?"
pass: declines and says what it can help with
target: 90 percent of 20 cases, no regression on r-02
What goes wrong
- Cases written only by engineers. They miss what the business cares about; involve the product owner.
- A spec nobody updates. When a new failure appears in production, add a case. Otherwise it returns.
- Targets with no basis. Pick the pass rate from the cost of a failure, not from habit.
- Writing cases after tuning. The prompt then shapes the spec instead of the other way round.
Examples
From "be helpful" to three cases
Requirement: "The travel assistant should help with changes." Cases: a change within the free window (must quote the free-change rule), a change outside it (must state the fee, not invent a waiver), a request to change someone else's booking (must ask for verification). Pass rates are agreed with the product owner.
A rejected answer becomes a rule
A product owner rejects a reply because it says "I guarantee a refund". New pass rule for the whole set: replies never use "guarantee" about money. The rule is added as a code check and now runs on every case.
Key points
- Cases with explicit pass conditions turn a vague requirement into a testable definition of done.
- Write cases before changing the prompt, so the spec leads and the prompt follows.
- Product owners should review cases and judge sample outputs; each rejection reason becomes a rule.
- A failing eval at the start is expected; it is the baseline you improve against.
- Add a case whenever a new failure appears in real use, so it cannot come back unnoticed.
Common mistakes
- Leaving the definition of done in a meeting instead of in cases.
- Having only engineers write and approve cases.
- Setting a pass-rate target without asking what a failure costs.
- Never adding the production failures back into the set.
Check yourself · 2 of 3
A product owner rejects a sample reply because it promised a refund the policy does not allow. What should you do?
Check yourself · 3 of 3
Which case is written as a runnable pass condition?
Practice items, not counted towards your mastery.
Start here
- Your AI product needs evals (Hamel Husain) (opens in a new tab)ArticleFree
A practitioner's case for starting with real traces, simple checks and a data review habit before any tooling.
- Demystifying evals for AI agents (Anthropic) (opens in a new tab)ArticleFree
Defines tasks, graders and trials, and shows how evals guard changes across a product's life.
- Develop test cases (Claude docs) (opens in a new tab)DocsFree
How to turn a feature goal into specific, measurable criteria and test cases.