Skip to content
bits
Prompting that works · Lesson 3 of 10

Show, don't tell

Tutor:

Some things are hard to describe and easy to show. Tone is one. “Friendly but not cheesy” means something different to everyone. One good example settles it.

Putting examples in your prompt is called few-shot or multishot prompting. Anthropic calls it one of the most reliable ways to steer the format, tone and structure of Claude's replies.

Tutor:

Say your app shows raw errors like ECONNRESET and you want them in plain English, in your house style. You could describe the style. Or you could show it:

Rewrite error messages for our app's users, in our house style.
<examples>
<example>
Error: 504 upstream timeout
Rewrite: That took too long on our side. Try again in a minute.
</example>
<example>
Error: 401 invalid session
Rewrite: You've been signed out. Sign in again to pick up where you left off.
</example>
<example>
Error: 413 payload too large
Rewrite: That file is over 10 MB. Try a smaller one.
</example>
</examples>
Now rewrite this one:
Error: ECONNRESET
Plain textUTF-8
Tutor:

Notice three things Anthropic recommends. The examples are relevant: real errors from the same app. They're diverse: a server problem, a sign-in problem and a user mistake. And they're wrapped in tags, so Claude can tell the examples apart from your instructions. Three to five is a good number.

Tutor:

There's a catch. Claude copies examples closely, including the things you didn't mean to teach. If every example starts with “Oops!”, every reply will too.

Three look-alike examples vs Three varied examplesillustrative: made-up numbers that show the idea, not output from a real modelcompare

promptError: ECONNRESET

Three look-alike examples

Oops! The connection dropped. Please try again!

Three varied examples

We lost the connection for a moment. Check you're online, then try again.

Tutor:

On the left, all three examples opened with “Oops!” and ended with “Please try again!”, so the reply did too. On the right, the examples varied their openings and each said what to do next, so Claude picked up the real pattern: plain words, then a next step.

If you're stuck, ask Claude to check your examples for variety, or to write a few more like them.

quick check+10 neurons
Tutor:

All three of your examples are under six words and end with an exclamation mark. What will Claude most likely do?

    Type your answer or tap an option · Enter checks

    Tutor:

    Your turn. The draft has one example. Add a second example for a sign-in or password error, keep both in <example> tags, and keep the new error at the end. Run it, then try changing your examples' style and watch the reply follow.

    Your turn

    Run your prompt and the replies land here.

      • Wraps examples in tags, not yet
      • Keeps the first example, not yet
      • Adds a sign-in or password example, not yet
      • Ends with the error to rewrite, not yet
      • Ran at 1.0, not yet
      run at
      ~0 tokens

      Turn on JavaScript to run prompts.