What this prompt does
This prompt generates a curated set of few-shot examples that teach a model your exact desired output — format, tone, and reasoning pattern — for a task you describe. Instead of writing paragraphs of instructions, you give the model [example_count] worked input-to-output pairs that demonstrate the behavior directly. The prompt deliberately spreads examples across difficulty levels, includes an edge case, annotates why each output is correct, and adds a negative example showing what not to produce and why.
The variables tune the example set to your use case. [task_description] defines what the model is being taught to do, and [domain] keeps the examples realistic and on-topic. [format] controls the structure — XML tags, for instance — so the examples paste cleanly into your prompts. [max_tokens] caps the token budget so the example block does not bloat every request, and [target_model] ensures the formatting suits how that model best ingests few-shot context. The prompt also checks examples for internal consistency.
When to use it
- A classification or extraction step gives inconsistent output and instructions alone are not fixing it.
- You want to teach a precise output format that is easier to show than to describe.
- Format drift is appearing in production and you need a negative example to lock the shape down.
- You are covering a range of difficulty and need easy, medium, hard, and edge-case examples in one set.
- Building a reusable prompt where the few-shot block must fit within a
[max_tokens]budget. - Standardizing examples across a
[domain]so outputs stay consistent and realistic.
Example output
Expect [example_count] examples in your chosen [format], each showing the exact input and expected output, spanning easy to hard with at least one edge case and one negative example. Each carries a short annotation explaining why the output is correct, the set is checked for contradictions, and you get a token-cost estimate with trimming suggestions if it exceeds [max_tokens]. It is ready to drop straight into a system or task prompt.
Pro tips
- Write
[task_description]precisely; vague tasks produce vague examples, and the model can only demonstrate what you clearly define. - Keep
[domain]realistic — examples that mirror your actual inputs transfer far better than sanitized toy cases. - Do not skip the negative example; showing what not to output is often what stops format drift in production better than any positive case.
- Watch the
[max_tokens]budget, since few-shot blocks ride along on every request and a bloated set quietly raises cost at scale. - Pick
[format]to match your parser — structured tags like XML are easy to extract and resist accidental contamination from surrounding text. - Re-check the set for contradictions yourself; even two slightly inconsistent examples can teach the model the wrong pattern.