Use examples (multishot prompting) to guide Claude's behavior - Anthropic (original) (raw)

Examples are your secret weapon shortcut for getting Claude to generate exactly what you need. By providing a few well-crafted examples in your prompt, you can dramatically improve the accuracy, consistency, and quality of Claude’s outputs. This technique, known as few-shot or multishot prompting, is particularly effective for tasks that require structured outputs or adherence to specific formats.

Crafting effective examples

For maximum effectiveness, make sure that your examples are: