How to Write Better AI Prompts: 12 Techniques That Actually Work
What actually makes a prompt work? Most of the advice circulating, “act as an expert”, offering the model a tip, telling it to take a deep breath. Is folklore that spread because someone saw it help once.
The techniques below are different. Each one has a documented mechanism, and several come from papers that measured the effect. Here’s the short version: you can give the model information it lacked, constrain what it considers, or get it to spend more computation before answering. Everything that works does one of those three.
Why most AI prompting techniques don’t survive contact with testing
A language model predicts text. Any prompt technique that doesn’t change the information available, narrow the output space, or buy more computation is decoration.
“Act as a world-class expert” doesn’t hand the model knowledge it lacked. It nudges style. That’s occasionally useful and mostly noise. Judge every technique you read about by which of the three levers it pulls, and you’ll discard most of them in seconds.
Show examples instead of describing what you want
This is the best-evidenced technique there is. The GPT-3 paper, Language Models are Few-Shot Learners, established that models handle new tasks from examples given in the prompt. The authors note that “for all tasks, GPT-3 is applied without any gradient updates or fine-tuning, with tasks and few-shot demonstrations specified purely via text interaction with the model.”
Two or three examples communicate tone, format and edge-case handling at once, and far more precisely than a paragraph of description. If you can show it, don’t explain it.
One caution. Models pattern-match hard on examples. If all three of yours are short, you’ll get short outputs even when the input deserves a long one. Vary your examples along any dimension you don’t want copied.
Ask for the reasoning before the answer
Ordering changes quality, and the effect is well documented. In Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, a Google Research team reported that “prompting a 540B-parameter language model with just eight chain of thought exemplars achieves state of the art accuracy on the GSM8K benchmark of math word problems, surpassing even finetuned GPT-3 with a verifier.”
Read that again, because the comparison is the interesting part. Eight examples in a prompt beat a model that had been fine-tuned for the task. The intermediate steps weren’t decoration, they were where the work happened.
The practical consequence: “give your answer, then explain” produces worse answers than “work through it, then answer.” In the first case the explanation is generated to justify a conclusion already committed to.
Newer reasoning models do some of this internally. DeepSeek’s R1 paper describes reasoning behaviour emerging from reinforcement learning alone, “obviating the need for human-labeled reasoning trajectories”. The principle still applies to anything you’re asking for in one pass.
Give it a rubric, not just a role
A role on its own is weak. A role plus explicit criteria is strong, because the criteria become something the model can check its output against.
The second version below is doing real work. Each constraint eliminates a large class of outputs, which is exactly what the model needs to narrow its search.
| Weak | Strong | Why |
|---|---|---|
| “You are an expert copy editor. Edit this.” | “Cut any sentence that doesn’t advance the argument. Replace abstract nouns with concrete ones. Under 60 words. Don’t change quoted material.” | Four checkable constraints beat one job title |
| “Don’t be verbose.” | “Maximum three sentences.” | Positive constraints are easier to satisfy and verify |
| “Summarise this document.” | “Summarise in five bullets, each naming one decision and who made it.” | Specifies the shape, not just the task |
| “Answer, then explain.” | “Work through it, then give the answer.” | Reasoning generated after a commitment only justifies it |
Position matters more than people expect
Where you put things in a long prompt affects whether they’re used. Nelson Liu and colleagues at Stanford tested this directly in Lost in the Middle: How Language Models Use Long Contexts.
Performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly degrades when models must access relevant information in the middle of long contexts.
Liu et al., Lost in the Middle
They tested this by moving the same relevant passage to different positions and measuring what came back. The position of the text changed the answer, with the content held constant.
That has a direct implication. When your prompt contains a long document, put the document first and the instruction after it. An instruction buried above 20,000 words of context sits in the weakest position available.
There’s a cost benefit too. Most providers cache stable prompt prefixes, so a fixed document followed by a varying instruction is cheaper across repeated calls than the reverse. Our piece on context windows covers why long inputs cost what they do.
Tell it what to do when it doesn’t know
Models default to answering. If the answer isn’t in the material you supplied, you’ll often get a plausible one anyway.
Giving it a licensed exit changes that: “If the answer isn’t in the provided document, reply exactly: NOT FOUND.” One line, and it removes a large share of invented answers in extraction and retrieval work. It works because you’ve made “I don’t know” a valid, low-cost completion rather than a failure.
Constrain the output format properly
Specify the shape you want. “Return JSON with keys title, summary and confidence (0-1). No prose outside the JSON.”
If you’re parsing output programmatically, don’t ask politely. Use your provider’s structured-output or tool-calling mode. That enforces the schema during decoding rather than hoping the model complies.
Split multi-step tasks into separate calls
A prompt that says “extract the claims, verify each against the source, then write a summary” does all three badly. Three prompts, each doing one thing, beat it. And you can inspect the intermediate output to find where things went wrong.
Debuggability is the underrated benefit. A single mega-prompt that fails gives you no information about which stage broke.
Say what to do, not what to avoid
“Don’t be verbose” is weaker than “maximum three sentences.” Negative instructions require the model to represent the thing you don’t want. Positive constraints are easier to satisfy and easier for you to check.
Test on your hard cases
Keep ten inputs representing the messy reality of your task. Ambiguous ones, ones with missing fields, adversarial ones. Every prompt change runs against all ten.
Without that you’re tuning on impressions, and prompt changes that help one case routinely break another. This is the difference between prompt engineering and prompt superstition.
The counter-case: AI prompting techniques are the weakest lever
Here’s the argument against everything above. Prompting is fragile. A change that helps one model can hurt the next version, and none of it transfers reliably between providers.
OpenAI’s InstructGPT paper is the evidence. They report that “outputs from the 1.3B parameter InstructGPT model are preferred to outputs from the 175B GPT-3, despite having 100x fewer parameters.” That gain came from training, not from a cleverer prompt.
The honest reading is that prompting is what you reach for when you can’t change the model. That’s most people, most of the time, which is why it matters. It’s still the weakest of the available levers.
What would change the conclusion
Prompting has a ceiling, and three signs tell you you’ve hit it.
If the model lacks information, no phrasing conjures it. You need retrieval or tools, and our guide to retrieval-augmented generation covers when that’s the right move. The original RAG paper framed this as combining “pre-trained parametric and non-parametric memory for language generation”. The model’s own knowledge plus a searchable index.
If you need one specific format across thousands of calls, fine-tuning is cheaper and more consistent than an ever-growing prompt.
And if three consecutive changes move nothing on your test set, the task is probably underspecified in a way you haven’t articulated. Stop editing the prompt and go work out what you’re actually asking for.
Get the daily rundown
One email each weekday with the AI news that matters, every claim linked to its primary source.
Free, one email each weekday, unsubscribe in one click. We never sell or share your address.
