Build & submit taskBetaintermediate

Engineer an Extraction Prompt and Prove It on a Holdout Set with Headless Claude

Write one prompt that turns messy customer-support emails into strict JSON (intent, urgency, order id, deadline), then prove it on 8 holdout emails it has never seen. You run the cases through your own Claude Code in headless mode (claude -p), score them against hashed ground truth (32 field checks, pass at 27), and iterate on explicit criteria, few-shot examples, and XML structure until the eval goes green. The holdout emails carry real traps: stale order ids in forwarded threads, an urgency flip mid-email, refund wording that is actually a complaint, and relative dates you resolve from the Date: header.

1 hr

Est. time

4

Outcomes

5

Rubric criteria

65%

Pass score

What you'll learn

Skills you'll have real reps in after shipping this.

Explicit criteria make a prompt reproducible: enumerating the allowed values and spelling out the edge rules (which order id is current, what null means) is what turns a flaky extraction into a reliable one.
Few-shot examples are specifications: one worked example teaches the output format and a hard judgment call at the same time, which is why you pick examples that cover the traps.
A holdout set is the honest test of a prompt: the dev cases tune it and the unseen cases prove it, the same split you would use for any model evaluation.
Headless mode (`claude -p`) turns Claude Code into a scriptable pipeline component: a shell loop over files becomes a repeatable eval harness.

The scenario

Your team wants to auto-triage the support inbox: every incoming email should become a JSON record with the customer's intent, how urgent it is, the order id it concerns, and any reply-by deadline. A first attempt ('extract the fields from this email') works on the easy messages and falls apart on the real ones: customers quote old order ids in forwarded threads, write 'no rush' two lines before announcing a hard deadline, and say the word refund while asking for something else entirely.

This task is that job, done properly. You get 4 dev emails with their expected JSON (your few-shot material) and 8 holdout emails with no answers. You engineer the prompt: explicit criteria for every field, worked examples that teach the hard calls, XML structure so instructions and input stay separate, and a strict output format. Then you prove it: a run script pipes each holdout email through your own Claude Code in headless mode, and a local scorer checks all 32 field values against hashed ground truth. The evidence file is written only when the eval genuinely passes.

Your role

You are the engineer who owns the extraction prompt for a support-triage pipeline. Your deliverable is the prompt itself, the real model outputs it produced on the holdout set, machine-generated eval evidence that at least 27 of 32 field checks hit, and a short note on what failed first and how you fixed it, packaged as a single submission.

Start the task to unlock the full brief

You'll get the step-by-step requirements, setup commands, the 5-criterion grading rubric, tips, and the ability to submit your solution for instant AI grading.

Free to start · submit when you're ready

Prove your prompt works before you trust it, hands-on

Anyone can write a prompt that handles the easy cases; this task makes you engineer one that survives a holdout set. You take a messy support-inbox extraction job (intent, urgency, order id, deadline), study 4 dev emails with known answers, and then earn 27 of 32 field checks on 8 emails your prompt has never seen, with the cases running through your own Claude Code in headless mode (claude -p). Along the way you practice the mechanics that make prompts reproducible: explicit per-field criteria, few-shot examples chosen to cover the hard calls, XML structure that separates instructions from input, and a strict output format, plus a scripted eval loop you can reuse on any extraction problem.

Frequently asked questions

Do I need an Anthropic API key to do this task?

No. The run script uses your own Claude Code installation in headless mode (claude -p), so it rides on the login you already have. The kit itself ships no key and makes no network calls of its own; the scorer and self-check are plain std-lib Python.

What exactly gets graded?

Four artifacts: your prompt.md (explicit field criteria, few-shot examples, XML structure, output format), the 8 JSON outputs your prompt produced on the holdout emails, the evidence file check.py generates when at least 27 of 32 field checks pass, and a short notes.md documenting one real failure and the fix. A rubric scores the eval result, the prompt's engineering quality, and the iteration notes.

Can I just look up the holdout answers?

The expected answers exist only as salted SHA-256 hashes inside eval.py, so there is nothing readable to copy. The grader also cross-checks your evidence table against your submitted outputs and your prompt: perfect outputs next to a prompt that could not have produced them is a red flag, and hand-written evidence without the machine-generated table does not hold up.