Evals: prove that a change made it better

Day 6, 30 minutes · advanced

Goal of this lessonBuild a small test set with a pass or fail check per case and run it before and after one change.

Why it matters

Sooner or later Ilse asks the question every client asks: is the new version better? Without an eval, your honest answer is "it looked better on the emails I tried". That is a guess, and the client has only your word for it.

An eval is a fixed set of example inputs with a way to score each output. You run it, change one thing, and run it again. The inputs stay the same, so a difference in the score comes from your change. It turns "trust me" into a table the client can read and run again.

Today you build one for the Kettlebrook reply drafter: about twenty cases, including the awkward emails from discovery, one pass or fail check per case, and a before and after score for one change to the reply prompt. It all lives in the repository, so the eval keeps working after you have left.

The steps

1. Start from what you heard in discovery

About twenty cases is a workable size for a first eval: small enough that you read every case yourself, large enough to hold the nasty ones. Take fifteen normal emails: E-001 and fourteen new ones about the six orders in data/orders.csv, first names only. Add the five nasty cases from your discovery note:

  • E-002, an order id in lower case
  • E-003, two orders in one email
  • E-004, an order that is not in the data (WH-19999)
  • E-005, an email in Dutch
  • E-006, no order number at all

The nasty cases are where a prototype breaks first, and where a client stops trusting it. Every case in evals/cases.json has the same fields: id, from_name (the sender's first name, which the greeting needs), email, expected_order_ids (a list, may be empty), expected_status, must_include and must_not_include (both lists of strings).

2. Pick a check per case

There are three kinds of check:

  • An exact check in code. The draft contains WH-10432, ends with the DRAFT line, and does not say "shipped" for a delayed order. It costs nothing to run and gives the same answer every time.
  • A rule. A written rule a person or a script applies, for example: if the order is not in the data, the draft says so and states no status.
  • A model as judge. A second model reads the output and scores it against a written scoring guide. This helps for what code checks badly, such as tone, or whether the Dutch reply reads naturally. The judge is a model too and can be wrong, so this course keeps it on paper: evals/scoring-guide.md is the written guide that a person or a chat tool uses.

Use exact checks wherever you can. Write the rest into the scoring guide in plain words, one kind of case at a time.

3. Write the reply prompt by hand

The reply prompt is the instruction a model follows to turn one email plus the order data into a draft. Create prompts/reply.md yourself, with exactly this text:

You draft replies for the support team of Kettlebrook Wholesale. A person checks every draft before it is sent.

Input: one customer email and the order data in data/orders.csv.
Find the order number in the email (WH- plus five digits). Look up its status and its expected delivery date in the order data.

Write the draft in this shape: a subject line "Your order <order number>", a greeting with the customer's first name, one sentence with the status, one sentence with the expected delivery date written like 3 December 2026, the sign-off "Kind regards, Kettlebrook support", and as last line "DRAFT. A person checks this before it is sent."

It has no rule for an unknown order, for two orders or for another language. That is on purpose: those gaps are what the eval should show.

4. Let your agent stand in for the model call

On a real job the drafts come from the client's own model call. In this course your agent stands in for that call, so nobody needs an API key. The eval scores stored drafts in evals/drafts/ and does not care who wrote them.

evals/run.py reads evals/drafts/<id>.txt for every case, applies the exact checks, and prints PASS or FAIL per case and one total line. It uses only the Python 3 standard library and calls nothing over the network. Use python3 if python is not found.

Keep the writer of the drafts away from the answers. Write the drafts in a new session, not the one that wrote the cases, and tell it to use only the sender's name, the email, the reply prompt and the order data, never the expected fields. That separation rests on an instruction, not on a lock: the drafter can still open evals/cases.json. So read a few drafts for signs that an expected answer leaked in. In a chat tool the same conversation usually wrote the cases as well, so treat that run as practice and use the repository run for the client.

5. Baseline, one change, run again

Run the eval and write the result into evals/scores.md: run, date, passed out of 20, which cases changed. Then change one thing: the prompt, the model or a tool. Today it is this line in the prompt, added to the end of prompts/reply.md:

If the email names an order that is not in the order data, say you cannot find it and ask for the order number again. Never guess a status.

Write all twenty drafts again from scratch and run the eval again. Between the two runs only the prompt changes: the same cases, the same script, the same order data. Change two things at once and you cannot tell which one moved the score.

Pick your tool below and follow the steps.

Read the result

A model writes the drafts, so your numbers will differ from another learner's, and from one tool to the next. There is no score to reach today. Look at which cases changed. The new line is about the unknown order, so start with E-004, then read the rest: a fix for one case can break another.

"Nothing changed" and "one case got worse" are findings too. Both are worth showing the client, because they stop a change that only looked better in a demo.

When a case fails, read the draft before you blame the prompt. Sometimes the check is wrong, for example a must_include string that is stricter than the reply needs to be. Fix a check in its own commit, never in the same step as the change you measure.

Keep it in the repository

Commit prompts/reply.md and the whole evals/ folder: the cases, the drafts, the script, the scoring guide and the scores. Show Ilse and Tomas the before and after table, not a demo. The cases are made up, and they stay that way in any tool outside the client's own environment. On day 7 this eval becomes the acceptance test of the run that goes on without you.

Deeper dive

Today's actions

Ticks are not saved without an account

Do it in your tool

Claude

  1. Open Settings > Capabilities and check that Code execution and file creation is on. In the updated Settings layout it is called Create and edit files.
  2. Click + in the lower left of the chat box, select Add files or photos and attach orders.csv and sample_emails.csv from your data/ folder. If you have no data/ folder, save the rows below as those two files first.
    orders.csv:
    order_id,customer,status,expected_delivery
    WH-10432,Sanne,delayed,2026-12-03
    WH-10433,Daan,shipped,2026-11-30
    WH-10434,Priya,processing,2026-12-05
    WH-10435,Marco,delivered,2026-11-24
    WH-10436,Emma,shipped,2026-12-01
    WH-10437,Priya,processing,2026-12-08
    
    sample_emails.csv:
    email_id,from_name,subject,body
    E-001,Sanne,Where is my order,"Hi, where is my order WH-10432? I need the pans before Friday."
    E-002,Daan,Status,"status of wh-10433 please"
    E-003,Priya,Two orders,"Can you tell me where WH-10434 and WH-10437 are?"
    E-004,Marco,Missing order,"Where is WH-19999? It should be here by now."
    E-005,Emma,Bestelling,"Hallo, waar blijft mijn bestelling WH-10436?"
    E-006,Daan,No news,"I ordered two weeks ago and heard nothing."
  3. Paste this prompt to get the 20 cases and the scoring guide. Correct any case that does not match the order data, then save both in your evals/ folder.
    The attached files are made up. From orders.csv and sample_emails.csv, write 20 eval cases for a tool that drafts replies to order-status emails. Use E-001 to E-006 as they are. Add 14 normal cases, E-007 to E-020: new emails about the same six orders, from the customers named there, first names only.
    
    Fields per case: id, from_name, email, expected_order_ids, expected_status, must_include, must_not_include. Put the line "DRAFT. A person checks this before it is sent." in must_include of every case.
    
    Then write a short scoring guide: in plain words, what counts as a pass for each kind of case. Do not write any replies yet.
  4. Paste this prompt so Claude writes the 20 drafts and runs the exact checks in code. Download the table it returns.
    Now act as the drafter. For each of the 20 cases, use only from_name, the email and the order data, follow the reply prompt below, and write one draft.
    Then run the exact checks in code: for every case, check must_include and must_not_include against its draft. Give PASS or FAIL per case and the total, and return the table as an .xlsx file I can download.
    
    Reply prompt:
    You draft replies for the support team of Kettlebrook Wholesale. A person checks every draft before it is sent.
    
    Input: one customer email and the order data in data/orders.csv.
    Find the order number in the email (WH- plus five digits). Look up its status and its expected delivery date in the order data.
    
    Write the draft in this shape: a subject line "Your order <order number>", a greeting with the customer's first name, one sentence with the status, one sentence with the expected delivery date written like 3 December 2026, the sign-off "Kind regards, Kettlebrook support", and as last line "DRAFT. A person checks this before it is sent."
  5. Paste this prompt for the one change. Download the new table and write both totals in evals/scores.md as run 1 and run 2.
    Add this line to the end of the reply prompt, write all 20 drafts again from scratch, run the same checks, and return the before and after totals side by side, with the cases that changed, as an .xlsx file I can download.
    
    If the email names an order that is not in the order data, say you cannot find it and ask for the order number again. Never guess a status.
  6. Go to the Claude Code tab of this lesson for the run in your repository. Claude Code is not included in the Free plan.

Note: Running a repository's tests from chat is not described on Claude's pages: the code runs in a sandbox on the files you attach, up to 30MB per file. Owners can switch the capability off under Organization settings > Capabilities. Attach made-up data only.

Checked on 27 November 2026 · Source: Claude Help Center: Create and edit files with Claude (opens in a new tab)

Create a free account to save your progress. Sign in or sign up