Tech AI LabsAI Growth Infrastructure for Business

How to Use Few-Shot Prompting with Real Examples

By the Tech AI Labs teamChecked 22 November 20265 min read
How to Use Few-Shot Prompting with Real Examples: a practical workflow overview

Short answer: Few-shot prompting means showing the AI a few examples of the input and the output you want before giving it the real task. Anthropic's guidance says examples are one of the most reliable ways to steer format, tone and structure, and suggests three to five that are relevant, diverse and clearly separated from your instructions. Test the result on new inputs.

What it means

Instead of describing a style in the abstract, you show it. The AI picks up the pattern and applies it to your new input.

Zero-shot: Classify this customer message as Billing, Delivery or Product.

Few-shot:

Classify each customer message as Billing, Delivery or Product.

Message: "I was charged twice this month." Category: Billing

Message: "My parcel says delivered but it is not here." Category: Delivery

Message: "The zip on the bag broke after a week." Category: Product

Message: "Can I get a copy of last month's invoice?" Category:

Why examples work

Anthropic's best practices page says examples are one of the most reliable ways to steer output format, tone and structure, and that a few well-crafted examples improve accuracy and consistency. It gives three rules for them:

It recommends three to five examples for best results, and says you can ask the model to evaluate your examples for relevance and diversity or to generate more based on your first set. Source: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices

Examples flow into the output
Guide diagram: Examples flow into the output

Step by step

  1. 1Define the task in one sentence.
  2. 2Collect real examples. Use actual emails, tickets or notes, with private details removed.
  3. 3Write the ideal output for each. This is the work, and it pays off.
  4. 4Put them in a clear structure. Label Input and Output, or use tags.
  5. 5Add the new input at the end.
  6. 6Test on cases you did not use as examples.
  7. 7Adjust the examples when the AI gets something wrong.

Good examples

What good examples look like
Guide diagram: What good examples look like

Templates

Tone of voice for emails

Write replies in the style of the examples.

Customer: "Where is my order? It was due yesterday."

Reply: "Sorry for the wait, Sam. I have checked and it is with the courier for delivery tomorrow. I will email you the tracking link in the next hour."

Customer: "The size is wrong."

Reply: "Thanks for letting us know, Priya. I am sorry about that. I have sent a prepaid return label and will ship the right size as soon as it is scanned."

Customer: "[new message]"

Reply:

Cleaning messy data

Convert each line to the format Name | Company | City.

Input: "dr. Anita Rao, works at BrightPath ltd in pune"

Output: Anita Rao | BrightPath Ltd | Pune

Input: "Tom Willis (Acme, Leeds)"

Output: Tom Willis | Acme | Leeds

Input: "[new line]"

Output:

Summaries in a house format

Summarise meeting notes in this format: Decision, Owner, Deadline.

Notes: "We agreed to move launch to March. Dana will update the plan by Friday."

Summary: Decision: Launch moves to March. Owner: Dana. Deadline: Friday.

Notes: "[new notes]"

Summary:

Rewriting in your brand voice

Rewrite the text in our brand voice, shown in the examples. Keep the facts unchanged.

Before: "Our solution leverages synergies to deliver outcomes."

After: "We help your team get the job done faster."

Before: "[your text]"

After:

Mistakes to avoid

Few-shot with other techniques

Use a role to set the voice, examples to show the format and step-by-step reasoning when judgment is needed. See How to Use Role-Based Prompting and How to Use Chain-of-Thought Prompting. For the basics, see How to Write Perfect AI Prompts. To keep your best examples for reuse, read How to Create Reusable AI Prompt Templates.

When to skip examples

For simple tasks, a clear instruction is enough. For creative work where you want a fresh result, examples can pull the AI towards copying. If it keeps repeating your examples, remove some or ask for a different approach.

FAQ

How many examples should I use?

Anthropic recommends three to five for best results. Start there and test.

What is the difference between few-shot and zero-shot?

Zero-shot gives instructions only. Few-shot adds examples of the input and the output you want.

Do the examples have to be perfect?

They have to be correct and consistent, because the AI copies what it sees.

Can the AI write the examples?

Yes. You can ask it to generate more from your first set, then review and fix them.

Does it work in ChatGPT, Claude and Gemini?

The idea works in all of them. Test the exact prompt on the tool you use.

Sources

Checked December 2026. Results vary by model.

Key takeaways

Want a prompt library your team can reuse? Book a free 30 minute call with Tech AI Labs.

FAQ

Quick answers

How many examples should I use?

Anthropic recommends three to five for best results. Start there and test.

What is the difference between few-shot and zero-shot?

Zero-shot gives instructions only. Few-shot adds examples of the input and the output you want.

Do the examples have to be perfect?

They have to be correct and consistent, because the AI copies what it sees.

Can the AI write the examples?

Yes. You can ask it to generate more from your first set, then review and fix them.

Does it work in ChatGPT, Claude and Gemini?

The idea works in all of them. Test the exact prompt on the tool you use.

IN THE DIRECTORY

See how this tool compares, what it costs and what it is best for.

Open the tool page →
How to Create Reusable AI Prompt Templates: article illustration
TUTORIALS

How to Create Reusable AI Prompt Templates

Read →
How to Use Chain-of-Thought Prompting for Complex Tasks: article illustration
TUTORIALS

How to Use Chain-of-Thought Prompting for Complex Tasks

Read →
How to Use Role-Based Prompting to Get Expert-Level Answers: article illustration
TUTORIALS

How to Use Role-Based Prompting to Get Expert-Level Answers

Read →

Keep exploring

Move from research to a useful workflow. Check the source, learn the steps, then discuss implementation.

Discuss your workflow