Sample playbook · this is the “aha”
Extract structured data from a messy invoice
Turn a scanned or photographed invoice into clean JSON — vendor, date, line items, total — that matches the golden example exactly.
by Amara Okafor· @amara· v3
Not yet verified on Sonnet 5claude-sonnet-5 · awaiting reports
The spec
- Target models
- claude-sonnet-5 · claude-opus-4.1
- Stack
- Claude API · TypeScript · zod
- Inputs required
- One invoice as a PDF or image (a real, slightly messy scan is best).
- Time
- ~10 min
- Difficulty
- Intermediate
- Cost estimate
- ~12k tokens · ~$0.04
Expected output
A single JSON object with keys: vendor, invoice_date, line_items[], total — validating against the golden schema.
Golden example
One real input, one real output — the pass/fail target. Fakes can’t survive it.
input
invoice_0912.pdf (Northwind Traders · 3 line items · $1,204.50)
output
{
"vendor": "Northwind Traders",
"invoice_date": "2025-09-12",
"line_items": [
{ "desc": "Ergonomic chair", "qty": 2, "unit": 349.00 },
{ "desc": "Standing desk", "qty": 1, "unit": 429.50 },
{ "desc": "Delivery", "qty": 1, "unit": 77.00 }
],
"total": 1204.50
}The reports
showing 4 of 14Append-only. Every badge above is auditable back to these.
- Worked· @devkwe
Clean pass on a phone photo. Totals matched to the cent.
claude-sonnet-53 days ago - Worked· @mira.bclaude-sonnet-54 days ago
- Worked with changes· @tomas
Needed a stricter date prompt for DD/MM invoices — otherwise solid.
claude-sonnet-55 days ago - Worked· @priyaclaude-opus-4.11 week ago
Ran it? Log the result in 20 seconds.
Worked, worked-with-changes, or broke — tap one, pick the model, done. Your report joins the evidence and lands on your profile.