You edit a prompt, run two or three sample inputs, and the answers look sharper. How do you know whether the change improved overall behavior or only fixed the exact examples on your screen? Relying on gut feel after a few spot checks makes regressions easy to miss. This post explains how to build representative evaluation sets and verify iterative changes against held-out test cases.

At a Glance

  • An evaluation set pairs realistic task inputs with grading rules; a useful eval separates stronger configurations from weaker ones and produces stable scores across repeat runs.
  • Inside Claude Code’s claude-api skill, /claude-api build-eval interviews you to assemble an eval inside your project, and /claude-api hillclimb tests one targeted edit at a time.
  • Splitting examples into a train set (used to inspect failures) and a held-out test set catches overfitting, where edits memorize the examples you read without helping unseen requests.

About the Original Post

Lance Martin published this playbook on the claude.dev blog on September 28, 2026. It is written for developers maintaining LLM applications or skills who want a structured way to measure whether prompt, tool, or model changes actually move the needle.

What Makes a Good Eval, and How build-eval Works

An eval tests how well an application or skill handles a defined job. For a customer support agent, for example, real incoming tickets serve as the test cases (the eval set), and code or a judge model scores whether the agent made the right routing or refund decision (the grader). The original post highlights four properties of a reliable eval:

  1. Representative of real work. Cherry-picking inputs that are easy to write or easy to grade distorts the mix of requests your system actually sees in production.
  2. Able to separate capability tiers. Stronger models or higher effort budgets should generally score higher. Flat scores across tiers usually point to vague task prompts or flawed grading criteria.
  3. Headroom to improve. Even the strongest setup should score well below 100% so future gains remain visible. That gap is the eval’s headroom, though items that every run fails should be checked for impossible or contradictory instructions.
  4. Repeatable across runs. Drifting effort settings or leftover files and Git history leaking answers from earlier runs invalidate score comparisons. Clean, identical run conditions are what let you attribute score deltas to your edit.

Building an eval solely out of cases the current model gets wrong skews the benchmark toward one model’s blind spots. Instead, the author recommends collecting cases where a domain human can articulate why the problem is hard, supplemented by real failures from production logs, bug reports, and support tickets.

Running /claude-api build-eval launches an interactive interview that builds an eval inside your repository. It gathers test cases in priority order: production logs first, then bug reports and tickets, 5–10 hand-written examples, and finally synthetic cases derived from your codebase. Claude surfaces every candidate case for your review before locking the set in.

For grading, build-eval starts with the cheapest reliable check. Exact numbers or structured outputs get deterministic code assertions, while open-ended text responses use an LLM judge against explicit criteria. It then runs sample grades and shows them to you so you can spot cases where the grader disagrees with your own judgment.

Next, it records a baseline score before any edits begin, checking whether repeat grading produces consistent verdicts and whether timeouts or output-length caps truncated any responses. Catching execution-environment glitches early keeps you from mistaking harness bugs for model failures.

Human review happens at two explicit checkpoints: right after assembling candidate inputs, and right after inspecting sample grader outputs.

Hillclimbing: One Change at a Time Against a Held-Out Split

Hillclimbing means making one small adjustment, re-running the benchmark, keeping the edit if scores improve, and repeating. Changing five things at once hides which edit helped and which hurt, so each round isolates a single hypothesis.

The main trap is overfitting. Hardcoding rules tailored to the exact wording of known eval questions lifts benchmark numbers while failing on fresh phrasing. Overfitting can creep into any part of the harness: prompts, tool definitions, or the orchestration code wrapped around the model.

To guard against that, /claude-api hillclimb randomly partitions your eval into train and test splits. “Train” here does not mean updating model weights; it simply marks the subset of failures Claude is allowed to read when diagnosing errors and proposing prompt or harness edits. The held-out test split stays unseen during diagnosis and checks whether each edit generalizes to unfamiliar cases.

Each round reads failure logs from the train split, proposes a single patch, applies it, and re-scores both splits. A patch stays only when both train and test scores improve; if only the train score climbs or either score drops, the loop reverts the change.

When scores flatten for two or three rounds, the tool categorizes the remaining failures to check whether ambiguous test prompts or harness bugs are capping performance. Once the run finishes, it leaves your repository at the highest-scoring test checkpoint. If the net gain falls inside run-to-run noise, it flags that no real improvement was confirmed and advises against merging.

Hillclimbing loop diagram showing a fixed model and harness, failure analysis restricted to the train split, and keep-or-revert gating across train and test scores

Figure 1. From left: editable target, fixed model and execution harness, train and test evaluation splits, and the keep-or-revert gate. The analyzer reads failures from the train split only. A patch stays only when both scores improve; if only the train score rises or either score drops, the loop reverts it. Source: Original post .

Whenever train accuracy rises while test accuracy stalls, the loop treats the patch as overfit and rolls it back. Sustained plateaus pause patch generation altogether to weed out broken eval items before starting another round.

Two Case Studies

In the customer support benchmark, 44 tickets were split into 30 train tickets and 14 held-out test tickets, measuring how often the system reached the right handling decision. Across the 30 train tickets, iterative changes moved accuracy and cost through four steps:

Configuration and changeDecision accuracyCost per ticket
Baseline: Opus 4.8 default (high) effort74.4%4.6¢
Cleaned-up prompt on Opus 5.5 low effort87.8%1.9¢
Sonnet 5 low effort88.9%1¢
Refined prompt linking routing rules to refund limits98.9%1¢

Evaluating the final setup on the 14 held-out test tickets confirmed the gain: test accuracy reached 90.5% compared to 78.6% at baseline, while per-ticket cost dropped to roughly one-fifth of the starting point. Checking the held-out split is what shows the prompt fixes generalized beyond the 30 tickets inspected during tuning.

Customer support benchmark chart plotting cost per ticket against decision accuracy across four steps

Figure 2. Horizontal axis shows cost per ticket (log scale) and vertical axis shows decision accuracy on the train split. Moving up and to the left means higher accuracy at lower cost. Source: Original post .

Steps 1 through 4 trace the optimization path across model tiers and prompt edits. Moving from step 2 to step 3 held accuracy nearly flat while halving cost, and step 4 jumped accuracy via a targeted prompt clarification. Because Figure 2 plots the 30-ticket train split, always read it alongside the 14-ticket test split above.

The second case study evaluated the claude-api skill itself, a bundle of reference instructions Claude loads for API tasks, climbing from 66% to roughly 88%. Filling eight missing feature sections lifted the score to 74%, and fixing an inaccurate type-definition table pushed it to 77%.

When progress stalled, failure classification revealed the model was generating deprecated API patterns. Adding a migration mapping table from old syntax to current syntax brought the score to 80%. From there, repairing flawed eval prompts and grading logic alongside further skill edits took the final number to around 88%. Because that last jump includes fixes to the test questions and grader themselves, do not read the entire jump from 80% to 88% as pure skill improvement.

Takeaways

The notes below are this blog’s own interpretation, not part of the original post.

  1. When benchmark scores stop climbing, audit your eval questions and grader before churning through more prompt or model tweaks. Vague prompts or brittle grading logic penalize valid answers, just as the claude-api skill case uncovered. Keep score increases caused by fixing a broken grader separate from genuine quality gains in your system.

  2. Evals are just as useful for cutting cost as for chasing higher accuracy. Once your baseline meets quality targets, the same eval set tells you quickly whether a smaller model or lower effort tier holds accuracy steady at a fraction of the spend.

  3. Even on a small dataset, separate the examples you read while editing prompts from the examples you use to judge the edit. In the support benchmark, held-out test accuracy (90.5%) landed well below train accuracy (98.9%), a gap you would never see without a split. Small held-out sets still warrant follow-up checks on broader production traffic.

Verify that your yardstick works before swapping models or rewriting prompts; otherwise you cannot tell why a score moved.

What to Try First

  • Pick one prompt running in production, pull a sample of real inputs from request logs, and write down what counts as a passing output for each case.
  • Run your grader on a handful of responses and read the input, model answer, and grader verdict side by side to catch false passes or false failures early.
  • Split those cases into two buckets: read failure details only from the train bucket when revising your prompt, and log both train and held-out test scores before and after each edit.

Original post: Automating eval design and hillclimbing with Claude