Skip to content

techniques few-shot advanced

Prompting techniques made simple, with examples

Four prompting techniques made simple, with examples: few-shot, asking for steps, splitting tasks, and getting the AI to ask questions before it answers.

By BibliotecaPrompts editorial team · · 9 min read

Once you know how to write a clear prompt, there are a few prompting techniques that give you a jump in quality without making things complicated. They have technical-sounding names (few-shot, chain-of-thought, prompt chaining), but the idea behind each one is simple. Here we explain them with examples, with what the official guides from OpenAI, Anthropic, and Google say, and with an important warning about models that "reason."

If you're missing the basics, start with how to write a prompt and the parts of a prompt.

1. Give examples (few-shot)

What it is

Few-shot means "with a few examples." Instead of only describing what you want, you show the AI one or more solved cases so it follows the pattern. When you give no examples, it's called zero-shot, and with just one, one-shot. Google uses these same terms in its prompting strategies guide.

The idea is grounded in research: the paper "Language Models are Few-Shot Learners" (Brown et al., 2020) showed that a large model could do new tasks from instructions and a few demonstrations, without retraining it.

When to use it

When tone, style, or shape matter more than content: product descriptions, customer replies, classifying comments, headlines with a distinctive style.

What the guides say

  • Anthropic describes examples as one of the most reliable ways to steer format, tone, and structure, and suggests three to five for best results, in its best practices guide. It asks that they resemble your real case and be varied.
  • Google recommends always including examples in prompts, with consistent structure and formatting, and warns that too many can make the model stick to them too closely.
  • OpenAI, in its guide to reasoning models, says those models often don't need examples: it advises trying without them first and adding them if needed.

A good middle ground, which Anthropic also suggests in its blog: start with one example and add more only if the result still isn't right.

Before-and-after example

Prompt
Before:
Write short descriptions for these products from my store: {{list of products}}.
Prompt
After:
Write short descriptions for my store's products, in the same style as these examples.

<examples>
Product: Nariño coffee, 1 lb
Description: Medium roast, notes of brown sugar and orange. For your everyday drip coffee.

Product: Handmade dulce de leche, 8 oz
Description: Made in a copper pot, no preservatives. For spreading, filling, or eating by the spoonful.
</examples>

New products:
{{list of products}}

Two sentences max per product. Don't make up ingredients or origins that aren't in the list.

Notice that the examples are wrapped in a tag. Anthropic recommends wrapping them like this so the AI doesn't mistake them for instructions.

2. Ask for steps (and when you don't need to)

What it is

It's asking the AI to show the path, not just the final answer. The technique became popular with the paper "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models" (Wei et al., 2022), which showed that giving examples with intermediate reasoning steps improved results on arithmetic, common sense, and logic problems.

The warning: models that reason

Many current models already "think" internally before answering. That's why the official guides add nuance to the technique:

  • OpenAI advises against asking its reasoning models to think step by step: they reason internally, and those instructions may not help and can even make the result worse.
  • Google says its Gemini 2.5 and 3 models generate internal reasoning, so you usually don't need to ask them to write it out in the answer.
  • Anthropic explains that, with extended thinking turned on, Claude decides on its own how much to think, and that asking for written-out reasoning is a tool for when that feature is off.

So what's it good for today?

Asking for steps is still very useful for another reason: so you can check the work. If the AI shows the calculation, the formula, or the order of a process, you can spot the mistake. You're not asking it to "think," you're asking it to "show me."

Prompt
Before:
How much do I have left each month if I earn $2,800 and pay $950 in rent, $400 for groceries, and $180 for utilities?
Prompt
After:
Calculate how much I have left each month with this data: {{income and expenses}}.
Show each operation on its own line so I can check it and, at the end, the result in one sentence.

Catalog prompts like Resuelve un problema de matemáticas entendiendo cada paso (solve a math problem understanding every step) use this idea to learn, not just to get the number.

3. Split the task into parts (prompt chaining)

What it is

Instead of one giant message asking for everything, you send several, and each one's answer feeds the next. Anthropic calls this prompt chaining and sums it up as each prompt doing one thing well. Google suggests it for complex tasks: one prompt per instruction, or steps in sequence where the output of one is the input of the next.

When to use it

When the task has stages worth reviewing separately: research, compare, decide, and write. Also when you want to correct course halfway through.

A very useful pattern: draft, review, final version

Anthropic's guide describes self-correction as the most common chaining pattern: generate a draft, ask for it to be reviewed against some criteria, and then ask for it to be improved based on that review.

Prompt
Message 1:
Write a draft cover letter for this position: {{job description}}. My experience: {{experience}}.
Prompt
Message 2:
Review the draft against these criteria: Does it repeat my resume instead of explaining why I'm a good fit? Does it have any generic phrase any candidate could use? Is it over 250 words? List the problems, without rewriting it yet.
Prompt
Message 3:
Now rewrite the letter fixing the problems you found.
Three chained messages: the first asks for a draft; the second asks for a review against criteria and returns a list of problems; the third asks for a rewrite fixing those problems and gives the final version.Three chained messages: the first asks for a draft; the second asks for a review against criteria and returns a list of problems; the third asks for a rewrite fixing those problems and gives the final version.
Draft, review, and final version

If you'd rather not build the chain yourself, Una carta de presentación que no repite tu hoja de vida (a cover letter that doesn't repeat your resume) already includes similar rules, like using only your real experience and avoiding worn-out phrases.

Ask for a review at the end

A shorter version of the same idea: at the end of the prompt, ask it to check its own answer. Anthropic suggests adding something like "before you finish, verify your answer against these criteria," and explains that this catches errors, especially in code and math.

Prompt
Before giving me the answer, check that the numbers add up to the total and that you haven't used any data I didn't give you.

4. Get the AI to ask questions before it answers

What it is

Instead of the AI filling in what you didn't tell it with assumptions, you ask it to ask you questions first. It's the simplest technique on this list and one of the most noticeable.

Why it works

Anthropic's guides stress not assuming the model will infer goals you didn't mention, and giving it explicit permission to express uncertainty instead of guessing. Asking it to ask questions follows that same line: you give the AI a way out so it doesn't make things up.

Prompt
Before:
Plan a five-day trip to Cartagena.
Prompt
After:
I want to plan a five-day trip to {{destination}}. Before suggesting anything, ask me up to five questions about what you need to know to make the plan work for me (budget, pace, who I'm traveling with, what I like). Wait for my answers and then put together the plan day by day.

Two tips to make it work:

  • Set a limit on questions. Without a limit, it might hand you a twenty-question survey.
  • Ask it to wait. If you don't say so, it sometimes asks and answers in the same message.

Many catalog prompts include a variation of this idea. For example, Un viaje a tu ritmo (a trip at your own pace) asks the AI to state what assumptions it's using before the itinerary and to flag if any of them changes the plan a lot.

How to combine the four techniques

You don't need to use them all every time. A quick guide:

  • Does style matter a lot? Give an example.
  • Are you going to check numbers, dates, or steps? Ask it to show them.
  • Does the task have several stages? Split it into messages.
  • Are you unclear about what you need? Ask it to ask you first.
Four techniques and when to use them: give examples if style matters a lot (start with one); ask for steps if you'll check numbers ("show each operation"); split the task if it has several stages (one message per stage); and have it ask first if you're unclear (five questions max).Four techniques and when to use them: give examples if style matters a lot (start with one); ask for steps if you'll check numbers ("show each operation"); split the task if it has several stages (one message per stage); and have it ask first if you're unclear (five questions max).
Which technique to use in each case

And if a technique doesn't improve the result, drop it. More instructions aren't always better; we explain why in common mistakes when writing prompts. When a combination works for you, save it as a template: we show you how in prompt templates with blanks.

Frequently asked questions

What is few-shot prompting?

It's giving the AI a few solved examples inside the prompt so it follows that pattern. It's mainly useful for controlling tone and format. With just one, it's called one-shot, and with none, zero-shot.

Does writing "think step by step" still help?

With models that already reason internally, OpenAI and Google say it's usually not needed, and OpenAI warns it can make the result worse. What's still useful is asking it to show the calculations or steps so you can check them.

What is prompt chaining?

It's splitting a big task into several consecutive messages, where each answer serves as the basis for the next. That way you can review and correct each stage.

How do I get the AI to ask me questions before answering?

Tell it explicitly: "before you answer, ask me up to five questions and wait for my answers." Setting a maximum and asking it to wait avoids long surveys or rushed answers.

Sources

Related articles

techniquesChatGPTClaudeGemini

How to adapt a prompt for ChatGPT, Claude, and Gemini

How to adapt a prompt for ChatGPT, Claude, and Gemini based on the official OpenAI, Anthropic, and Google guides: what they share and where they differ.

· 8 min read