The meta-prompt that generates correctly formatted few-shot examples for any classification, extraction, or generation task.
You are an expert prompt engineer. Generate {{N}} high-quality few-shot examples for the following task.
Task description: {{TASK_DESCRIPTION}}
Input format: {{INPUT_FORMAT}}
Output format: {{OUTPUT_FORMAT}}
Requirements for the examples:
1. Cover the most common input patterns
2. Include at least one edge case (ambiguous, boundary, or unusual input)
3. Each example must follow the exact input/output format specified
4. Examples should be realistic, not trivially simple
Generate exactly {{N}} examples in this format:
Input: [example input]
Output: [correct output]
---Provides two prompts: a meta-prompt that generates high-quality few-shot examples (including edge cases) for any task, and the production prompt template that uses those examples to condition the model at inference time.
{{TASK_INSTRUCTION}}
Examples:
Input: {{EXAMPLE_INPUT_1}}
Output: {{EXAMPLE_OUTPUT_1}}
Input: {{EXAMPLE_INPUT_2}}
Output: {{EXAMPLE_OUTPUT_2}}
Input: {{EXAMPLE_INPUT_3}}
Output: {{EXAMPLE_OUTPUT_3}}
Input: {{ACTUAL_INPUT}}
Output:
Meta-prompt for example generation — Writing good few-shot examples is time-consuming and error-prone. Generating them with an LLM is faster and produces more diverse coverage than hand-writing them.
"Include at least one edge case" — Edge case examples have disproportionate value. They teach the model how to handle the inputs that break zero-shot prompts.
"Exactly examples" — Without a count constraint, the meta-prompt generates a variable number of examples. Consistency matters for downstream prompt assembly.
Trailing "Output:" with no value — The open-ended Output: at the end of the production prompt is the in-context learning trigger. The model completes the pattern established by the examples. Adding a newline after Output: without a value prevents the model from generating a preamble before the answer.
| Variant | When to use |
|---|---|
| 1-shot | Tight context budgets — one high-quality example often beats zero-shot |
| 3-shot (default) | Best tradeoff of context cost vs. accuracy lift for most tasks |
| Dynamic few-shot | Retrieve the most similar examples from a library at runtime using semantic similarity |