Describing a task in words leaves room for a model to interpret it differently than intended. Showing a few worked examples first — input paired with the exact output wanted — removes most of that ambiguity. That's the entire idea behind a few-shot prompt, and building one by hand means carefully formatting each example consistently, which gets tedious past two or three.
What Goes Into the Prompt
- A task description — one line explaining what the model should do.
- Example pairs — each one an input and the exact output that input should produce.
- The actual query — the new input to complete, left without an output for the model to fill in.
Two Output Formats, Generated Together
The same examples produce two different formats automatically — a universal plain-text version, and an XML-tagged version optimized for Claude.
Plain Text (works with any model)
Classify the sentiment of each product review as Positive, Negative, or Neutral. Input: The battery life is incredible, lasts two full days. Output: Positive Input: Arrived broken and customer service never replied. Output: Negative Input: It does what it says. Nothing more, nothing less. Output: Neutral Input: Setup was confusing but once it worked, I loved it. Output:
XML-Tagged (Claude-optimized)
Classify the sentiment of each product review as Positive, Negative, or Neutral. <example> <input>The battery life is incredible, lasts two full days.</input> <output>Positive</output> </example> <example> <input>Arrived broken and customer service never replied.</input> <output>Negative</output> </example> Now complete the following in the same way: <input>Setup was confusing but once it worked, I loved it.</input>
Wrapping each demonstration in XML tags helps Claude specifically read them as reference examples rather than as additional tasks to respond to — a distinction that plain-text labeling alone can blur in longer prompts.
Turn your own examples into both formats instantly
Try the Few-Shot Prompt Builder