You want Claude to match an exact output format across varied inputs. What does the guidance suggest?
Why A is the answer
3 to 5 varied examples in <example> tags
Well-chosen examples are one of the most reliable ways to steer format and tone. Wrap them in tags so that Claude can tell them apart from the instructions.
In detail
- Examples are among the most reliable ways to steer format and tone.
- Wrap 3 to 5 varied ones in tags, so Claude can tell them from instructions.
- Include at least one hard case.
Use case
An illustrative scenario, not a real incident.
A classifier returns labels in slightly different forms. Adding four varied examples in example tags makes the format consistent across unusual inputs.
See it in different ways
mindmap
root((Prompt))
System
Role
Stable rules
Examples
3 to 5
Varied
Documents
In XML tags
Task
Clear requestflowchart LR S0["Choose varied cases"] --> S1["Wrap in example tags"] --> S2["Add to the prompt"] --> S3["Check the output"]
Key point: Show the format with varied examples.
Why the other options are wrong
- B. Lowering max_tokens
- A lower max_tokens cuts replies off, and does not improve format.
- C. One long paragraph describing the format
- A long description tends to show format less clearly than an example.
- D. Removing the system prompt
- Removing the system prompt loses guidance.

