Claude Certification
Prompt Engineering & Structured Output
Lesson 3 · 6 min

Few-Shot Examples

How many examples, in what order, of what shape.

3–5 examples typically peaks. Make them diverse and structurally identical to the desired output. Put the hardest example last — recency bias means Claude weights it most.

Production scenario

Real-world example: Email triage at a customer-success team

A CS team auto-routes inbound mail. The triage prompt uses five carefully chosen examples:

  1. Newsletter (easy)
  2. Refund request (common case)
  3. Partnership pitch (edge case — looks like a customer email but isn't)
  4. Urgent outage report (the high-stakes one)
  5. Ambiguous "is this an upsell?" (the hardest)

The hardest is last. Within a week, the accuracy on the ambiguous bucket climbs 11 points — recency bias is doing the work.

Why this matters: three to five diverse examples, hardest last. Don't pack twenty similar examples; the model overfits to the shape, not the judgment.

Knowledge points in this lesson
  • 3–5 examples is the typical sweet spot
  • Examples should be structurally identical
  • Put hardest example last (recency bias)
  • Diverse examples beat similar ones
  • Too many examples can confuse the model
Quick check
Prompt EngineeringSelect all that apply
Which of these maximize prompt cache hit rate? (Select all that apply)