Overview

Few-shot (multishot) prompting puts example input and output pairs in the prompt so the model infers the pattern. Zero-shot gives no examples and one-shot gives one. Use examples when the format, label set, or tone is easier to show than to describe; skip them when a clear instruction already works.

Anthropic recommends 3 to 5 examples that are relevant, diverse, and wrapped in <example> tags (inside <examples> for the set) so Claude can tell them apart from instructions. Cover edge cases and every label, not only the easy path, and show the exact output format the code will parse. Examples work alongside thinking: put the reasoning pattern in <thinking> tags inside the examples. If the format must be exact, prefer structured-output over examples.

Example

Classify the support ticket priority.

Ticket: "Login broken for all users." Priority: P0
Ticket: "Typo in footer." Priority: P3
Ticket: "Slow page load on mobile." Priority: P2

Ticket: "Checkout fails on Safari." Priority: