Few-Shot Example Builder

Category analysis
Subcategory few-shot-design
Difficulty intermediate
Target models: claude-sonnet, gpt, gemini-pro
Variables: {{task_to_teach}} {{good_examples}} {{common_failures}} {{desired_output_shape}} {{workflow_surface}}
prompting few-shot examples task-design teaching
Updated April 23, 2026

The Prompt

You are a few-shot prompt designer. Build a compact example set that teaches the model how to perform the task well without overloading the prompt.

TASK TO TEACH:
{{task_to_teach}}

GOOD EXAMPLES:
{{good_examples}}

COMMON FAILURES:
{{common_failures}}

DESIRED OUTPUT SHAPE:
{{desired_output_shape}}

WORKFLOW SURFACE:
{{workflow_surface}}

Return exactly:
1) What the examples should teach
2) Missing information before the examples are trustworthy
3) Recommended example strategy (how many examples, what variety, what edge case coverage)
4) Few-shot example set with:
   - example input
   - ideal output
   - short note on what the example teaches
5) One negative or edge-case example that shows what to avoid
6) Final prompt wrapper that places the examples in the right order

Rules:
- Prefer 2-4 high-signal examples over a long bloated set.
- Keep all examples aligned to the same task and output shape.
- If the supplied examples are weak or inconsistent, say so before building the final set.
- Mark any synthetic example clearly instead of pretending it came from real data.
- Call out which examples are approved "house style" examples if that matters for the workflow.

When to Use

Use this when instructions alone are not enough and the model needs concrete examples to understand the pattern. It is especially useful when a task has subtle judgment calls, formatting rules, or repeated failure modes that a plain instruction block does not correct.

Good fits:

  • recurring tasks where the model keeps drifting from the expected format
  • workflows where one strong example teaches tone, structure, and level of detail faster than extra explanation
  • prompts that need a realistic edge case to avoid shallow pattern-matching
  • teams turning a manual review pattern into a reusable AI workflow

Variables

VariableDescriptionGood input examples
task_to_teachThe behavior or task the examples should teachsummarize customer calls into findings, convert raw notes into action items, write a safe refactor plan
good_examplesReal or draft examples that show the desired patterninput/output pairs, approved team samples, before/after examples
common_failuresThe mistakes the model usually makes on this tasktoo generic, wrong format, overconfident conclusions, missing constraints
desired_output_shapeThe exact structure the final answer should followbullet list, memo, JSON, table, checklist
workflow_surfaceWhere the example-backed prompt will be usedchat app, coding agent, editor assistant, automation step

Tips & Variations

  • Use real approved examples whenever possible. Few-shot prompts are strongest when they teach an actual house style or decision pattern rather than a generic imitation.
  • Include one tricky edge case if the task often fails on ambiguity, partial information, or conflicting evidence.
  • If the task has strong non-goals, ask for a negative example that shows what bad output looks like and why it fails.
  • When the prompt gets too long, reduce the number of examples before you reduce their quality. One clean example is usually better than four noisy ones.
  • Keep one holdout example outside the prompt if you also want to evaluate whether the few-shot set is actually improving the output.

Example Output

Recommended example strategy: use two core examples and one edge case because the task depends more on structure and evidence handling than on stylistic variation.

Few-shot example set: each example shows the same input format, the expected output shape, and a short note explaining the judgment pattern being taught.

Final prompt wrapper: task instructions first, then the examples, then the new task input, followed by the required response format.