Study guides / CCAO-F / Domain 1

Prompting and Task Execution · Lesson 2 of 5

1.2 — Multishot Prompting for Consistent Output

Use a small set of diverse, worked examples to make Claude's output format and tone consistent when instructions alone aren't enough.

When detailed instructions alone still produce inconsistent formatting, tone, or judgement calls, the most effective next step is almost never more instructions. It's multishot prompting: giving Claude a small number of worked examples of exactly the kind of output you want.

This is one of the most heavily tested ideas in prompt engineering, and for good reason — it's genuinely the highest-leverage fix for output consistency problems, and it generalises across almost every task type: drafting, classification, summarizing, formatting, even judgement calls like tone.

How Many, and How

Use three to five diverse examples, not one repeated pattern and not a huge pile of edge cases. A single example risks Claude locking onto an overly narrow pattern instead of generalising. A long list of examples wastes space without proportional benefit. Wrap each example in its own <example> tag so Claude can clearly tell where instructions end and worked examples begin.

<example>
Customer: My package arrived a week late.
Reply: Hi Sam, I'm really sorry your package arrived late...
</example>

<example>
Customer: This item doesn't match the photos.
Reply: Hi Jordan, thanks for flagging this...
</example>

Diversity matters more than volume: pick examples that cover the range of situations Claude will actually face, not five near-identical variations of the same scenario. If every real input Claude will see is a variation on "angry customer, refund request," your examples should span at least a couple of different emotional registers and request types, not five refund requests with slightly different wording.

Multishot vs. a Role Statement

A role statement (lesson 1.1) and multishot examples solve related but distinct problems. A role gives Claude a consistent perspective to write from. Examples give Claude a concrete pattern to match — structure, format, level of detail. When output is inconsistent in tone, start with a role. When output is inconsistent in structure or format even with detailed written instructions, examples are usually the stronger fix, because showing a pattern is more reliable than describing one in prose.

Key Concept

When plain-language instructions alone haven't produced consistent results, add three to five diverse worked examples wrapped in <example> tags. This is more reliable than writing yet another paragraph of instructions.

Common Exam Distractor

Watch for a tempting-sounding option like "provide one long, detailed example that repeats the same pattern several times." Repetition of a single pattern isn't diversity, and it risks teaching Claude an overly narrow rule rather than the general behaviour you actually want.

Exam traps

Practice question

A developer wants Claude to reliably follow a specific tone and structure when generating customer emails. Plain-language instructions alone haven't produced consistent results. What should they add to the prompt?

  • A Three to five diverse worked examples of the desired email, wrapped in <example> tags Correct

    Multishot prompting with a handful of diverse, tagged examples is the standard, reliable fix for output that stays inconsistent despite detailed instructions.

  • B One long example that repeats the same pattern multiple times within a single block

    A single repeated pattern lacks diversity and risks the model narrowly matching that one case instead of generalising.

  • C A longer paragraph describing the desired tone and structure in more detail, with no example text

    More description is what has already been tried without success; worked examples, not more description, are the next step.

  • D A single comma-separated list of every possible edge case at the end of the prompt

    A compressed list of edge cases isn't a worked example — it doesn't show Claude what a correct output actually looks like.

Build exercise: Fix Inconsistent Output with Worked Examples

Beginner · 20 minutes

You'll practice:

  1. In a claude.ai conversation, ask Claude to summarize three different short articles (paste in three unrelated short news snippets, one per message) using only a plain-language instruction like 'summarize in 2 sentences, bullet the key stat.'

    This establishes the baseline: instructions alone often produce inconsistent structure across different inputs.

    You should see: Summaries that vary in format — sometimes a real bullet, sometimes a dash, sometimes the stat isn't clearly separated at all.

    Hints
    1. Use genuinely different article topics so you can see whether the format holds up across variety.
    2. Look specifically at whether the '2 sentences + bulleted stat' structure is followed identically each time.
    3. If the outputs already look consistent, try a fourth, more unusual article to surface the gap.
  2. Start a new conversation. This time, include three diverse worked examples of the summary format wrapped in <example> tags before asking Claude to summarize the same three articles.

    This is the multishot fix — showing rather than describing the exact structure you want.

    You should see: All three new summaries following the same 2-sentence-plus-bullet structure shown in your examples, even though the source articles differ.

    Hints
    1. Make your three examples cover different topics so Claude generalises the format rather than the subject matter.
    2. Keep each example short — the point is the structure, not exhaustive detail.
    3. Compare the new summaries against the first run side by side to confirm the consistency improvement.
  3. Deliberately make your three examples near-identical variations of one topic, rerun the same task, and see whether the format generalises as well to a very different fourth article.

    This demonstrates the diversity requirement directly — a common exam distractor is assuming any set of examples works equally well.

    You should see: A noticeably weaker or narrower result on the fourth, different article compared to when your examples were genuinely diverse.

    Hints
    1. Pick three examples about the same narrow topic on purpose for this step.
    2. Then test with an article on a completely unrelated subject.
    3. Note in one sentence what went wrong — usually the format either doesn't transfer, or Claude imports irrelevant details from the examples' shared topic.

Sources