Few-Shot Example Builder
Generates well-designed few-shot examples for a prompt, covering the right range of variation to teach the model the intended pattern without over-constraining it.
Developers and prompt engineers building AI features that need consistent formatting or behavior, using few-shot examples to guide model output more reliably than instructions alone.
You are a prompt engineering expert who designs few-shot examples that actually teach a model the intended pattern instead of accidentally over-fitting it to one style.
Task the prompt needs to perform: {{task_description}}
Desired output format/style: {{desired_format_style}}
Edge cases or variation the model needs to handle: {{edge_cases_to_cover}}
Do the following:
1. Design 3-4 few-shot examples (input/output pairs) that together demonstrate the desired pattern, deliberately varying surface details (different topics, lengths, or phrasing) while keeping the underlying format and quality bar consistent, so the model learns the pattern, not one specific instance.
2. Make sure the examples collectively cover the edge cases mentioned, not just the typical case, so the model doesn't fail when given something slightly different than the 'obvious' scenario.
3. Write a short explanation after each example noting what specific aspect of the desired pattern it's meant to reinforce.
4. Assemble the final few-shot prompt block, formatted and ready to insert into a system prompt or API call, with clear separators between examples.
5. Flag if any of the examples might inadvertently teach an unwanted pattern (e.g., always using a specific opening phrase that isn't actually required), and suggest a fix.How to use
- Describe the task, desired output format, and any edge cases the model needs to handle correctly.
- Review the generated examples to confirm they genuinely vary surface details while keeping the pattern consistent.
- Insert the assembled few-shot block into your system prompt or API call.
- Check the flagged unintended-pattern warning and adjust if you spot the model over-fitting to something not actually required.
Example input
Task: Classify customer support tickets into categories with a one-line reasoning. Desired format: JSON with 'category' and 'reasoning' fields. Edge cases: Tickets that could fit multiple categories, very short/vague tickets.
Example output
3 examples showing a clear billing ticket, an ambiguous ticket that could be billing or account-access (demonstrating how to pick the primary category), and a very short vague ticket ('it's broken') demonstrating a fallback to a general 'technical issue' category with reasoning noting insufficient detail, each with an explanation of what pattern it reinforces, an assembled final prompt block, and a flag noting all 3 examples happened to start with 'The customer is experiencing' which could unintentionally teach that exact phrasing, with a suggestion to vary the reasoning phrasing across examples.Customization tips
- — If you already have real production examples (even messy ones), share 1-2 so the generated few-shot examples match your actual data distribution.
- — For classification tasks with many categories, ask for at least one example per category if the category count is manageable.
- — Request additional examples specifically targeting a failure mode you've observed in testing.
Tags
FAQ
What is this prompt for?
How should I customize it?
Are there any limitations?
How is it different from a basic prompt?
Related Prompts
All Prompt Engineering prompts →Structured Output Format Enforcer
Designs a prompt that reliably gets an AI model to return output in a specific structured format (JSON, table, or custom schema) without malformed or inconsistent results.
Cross-Model Prompt Adapter
Adapts a prompt written for one AI model to work well on a different model, adjusting for known differences in instruction-following style, verbosity, and formatting tendencies.
Chain-of-Thought Prompt Converter
Converts a direct-answer prompt into a structured chain-of-thought version that guides the model through explicit reasoning steps, improving accuracy on complex tasks.
Related Skills
Agent Prompt & Tool Spec Designer
Designs a complete system prompt and tool specification for an LLM agent from a description of what the agent should do.
Related Articles
How to Write Better Prompts: The Prompt Engineering Guide
A practical five-part framework for writing better AI prompts, with examples covering context, task, constraints, and output format.