# 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.

## Prompt

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.

## Best for

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.

## Compatible tools

- Claude
- ChatGPT

## 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.

## 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.

## 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.
