Few-Shot Prompt Template
A skeleton for example-driven prompts: balanced labels, edge cases included, and the ordering and testing rules that keep them stable.
[TASK IN ONE SENTENCE, LEADING WITH A VERB: Classify / Extract / Rewrite / Score.] [WHY IT MATTERS AND WHO USES THE OUTPUT: one or two sentences. This improves targeting more than any persona line.] Rules: - [THE DECISION RULE THE EXAMPLES CANNOT CONVEY ON THEIR OWN] - [HOW TO HANDLE THE AMBIGUOUS CASE] - If the input is insufficient to decide, output [THE EXPLICIT UNCERTAIN VALUE] rather than guessing. Output format: [EXACT FORMAT. For structured output, give the schema and state that no other text may be returned.] Examples: Input: [A CLEAR, TYPICAL CASE] Output: [THE CORRECT OUTPUT, IN EXACTLY THE FORMAT YOU SPECIFIED] Input: [A CASE WITH A DIFFERENT LABEL OR SHAPE] Output: [THE CORRECT OUTPUT] Input: [A GENUINELY HARD OR AMBIGUOUS CASE, THE KIND THAT GETS THIS WRONG IN PRODUCTION] Output: [THE CORRECT OUTPUT, DEMONSTRATING THE RULE ABOVE] Input: [A CASE THAT SHOULD PRODUCE THE UNCERTAIN OR EMPTY RESULT] Output: [THE UNCERTAIN OR EMPTY RESULT] Now do the same for this input. Input: [THE REAL INPUT] Output: --- Rules for filling this in: 1. Start with ONE example. Add more only when outputs are actually inconsistent. More examples cost tokens and can lock the model into surface patterns you did not intend. 2. Balance the labels. A set of examples where four of five share a label biases the model toward that label regardless of the input. 3. Vary the order between test runs. Example ordering alone can swing accuracy substantially, with the last example exerting the most pull, so an accuracy number from a single ordering is not a measurement. 4. Every example must match your stated rules exactly. Modern models copy the details of examples more faithfully than they follow instructions, so a single example that contradicts a rule silently overrides it. 5. Include the edge cases you actually see in production. Examples made of clean, obvious inputs teach the model nothing about the cases you are trying to fix. 6. On reasoning models, try zero-shot first. Examples often help less there, and sometimes hurt. 7. Format the examples exactly as you want the output formatted, including whitespace and punctuation. That is what the model copies.
How to use
Few-shot prompting is the highest-leverage technique for format and pattern tasks and the one most people apply carelessly. The two errors that cause most of the trouble are unbalanced labels and examples that quietly contradict the written rules, and both are invisible until you test. Treat rule 3 seriously: if reordering your examples changes the results, you have not measured your prompt, you have measured one arrangement of it.
More agent prompts
You are a software engineering agent working in the [PRODUCT/TEAM] codebase ([LANGUAGE/STACK]). Your objective is to take an assigned task from description to verified, working code. You may read and modify anything in the repository; you do not push, merge, deploy, or alter CI configuration unless the task explicitly says to. # Operatin
Coding Agent System Prompt
Autonomous coding agent that matches repo conventions, proves work with passing tests before claiming done, and reports failures truthfully.
You are a debugging agent for the [PRODUCT] codebase. Your objective is to find the root cause of a reported bug, fix it with the smallest possible change, and prove the fix. You are not here to refactor, harden, or improve unrelated code: a debugging session that ends in a 40-file diff has failed even if the bug is gone. # Reproduce Bef
Debugging Agent System Prompt
Root-cause-first debugging agent: no fix until the bug is reproduced, minimal diffs only, and done means the repro dies while the test suite stays green.
You are a code migration agent. Your objective is to move the [PRODUCT] codebase from [SOURCE VERSION/FRAMEWORK] to [TARGET VERSION/FRAMEWORK] while preserving behavior exactly. You are a mechanical translator with judgment, not a redesigner: the product must work the same after every step you take. # The Prime Rule: Migration Changes On
Code Migration Agent System Prompt
Framework-upgrade agent that migrates in build-green slices, verifies every codemod, follows official guides over memory, and never mixes in behavior changes.