Prompt engineering is structured communication. What the research and the vendor documentation say works, what stopped working on newer models, and how to test your own prompts.
Prompting Is Structured Communication
You ask a model for something, get an answer that is nearly right, and wonder which magic phrase you missed. There isn’t one. What separates a good prompt from a weak one is mostly whether it tells the model what a smart stranger would need to know: who the output is for, what it should look like, and what to avoid.
Anthropic’s prompting guide puts this as a test. Think of the model as a brilliant new employee who lacks context on your norms. Then follow its golden rule: show your prompt to a colleague with minimal context on the task, and ask them to follow it. If they would be confused, the model will be too. That is structured communication, and the habit transfers to emails, bug reports and feedback.
The fundamentals are plain: be specific, give context, show examples, state constraints. The rest of this page covers what the research and the vendor documentation say about each, including the parts that stopped being true as models changed.
The Techniques That Actually Matter
Six techniques account for most of what is worth knowing. Each comes with the evidence behind it and a note on where it breaks.
System prompts set the ground rules, the job description you give the model before it starts. Anthropic’s guide says a role set in the system prompt focuses the model’s behavior and tone, and that even a single sentence makes a difference. Instead of asking “Write me a product description,” tell the model who it is, what its constraints are and what tone to use.
The catch is that conventions differ by model. The DeepSeek-R1 model card advises the opposite: “Avoid adding a system prompt; all instructions should be contained within the user prompt.” Read the card or documentation for the model you are using.
Few-shot prompting means showing the model examples of what you want before asking for output. Anthropic’s guide says to make them relevant, diverse and clearly marked, and suggests three to five for best results. OpenAI adds a counterweight. Its guidance for reasoning models says to try zero-shot first, then few-shot if needed, and its general prompt guide says to show a diverse range of inputs when you do.
Chain-of-thought prompting asks the model to write out intermediate steps before the answer. The original 2022 paper showed that prompting a 540-billion-parameter model with just eight worked examples reached state-of-the-art accuracy on GSM8K, a set of math word problems. A follow-up needed no examples at all: appending “Let’s think step by step” lifted InstructGPT’s accuracy on MultiArith from 17.7% to 78.7%, and on GSM8K from 10.4% to 40.7%, which is 61 and 30 percentage points. Those were 2022 models. The next section explains why the trick has aged.
Role-playing gives the model a persona, and it works on tone and audience more than on knowledge. “Write like a Bloomberg columnist” encodes a register: formal, data-driven, skeptical of hype. But a study of 162 roles across four model families and 2,410 factual questions found that personas did not improve accuracy compared with no persona. Use a role to shape how the answer reads, not to make it more correct.
Constraints narrow the output: word limits, banned phrases, forbidden topics. Attach the reason and the model can generalize. Anthropic’s example replaces “NEVER use ellipses” with an explanation that the reply will be read aloud by a text-to-speech engine, and notes that the model can generalize from it.
Structured output solves the problem of getting data a program can read. OpenAI’s Structured Outputs promises responses that adhere to your supplied JSON Schema, which plain JSON mode does not, and the guide recommends it over JSON mode where possible. Its limits matter in code: only a subset of JSON Schema is supported, a refusal does not have to follow your schema, and a response cut off at the token limit can be incomplete, so check for both.
| Technique | Best for | What the evidence says | Where it fails |
|---|---|---|---|
| System prompt | Standing rules, tone, role | One sentence of role already changes behavior (Anthropic) | Some models want everything in the user prompt (DeepSeek-R1 card) |
| Few-shot examples | Format and style consistency | Three to five diverse examples (Anthropic); start zero-shot (OpenAI, for reasoning models) | Near-identical examples teach unintended patterns |
| Chain-of-thought | Math and multi-step logic on non-reasoning models | MultiArith 17.7% to 78.7% in 2022 tests | Marginal on reasoning models, and slower |
| Role | Audience, register, tone | No accuracy gain over no persona across 2,410 questions | Does not add knowledge |
| Constraints with reasons | Narrowing output | An explained rule generalizes better than a bare one (Anthropic) | A rule with no reason gives the model less to work with |
| Structured output | Extraction, API integration | Schema adherence is guaranteed (OpenAI) | Refusals and truncation break the schema |
Reasoning Models Changed the Advice
The advice that dominated 2023 and 2024, “think step by step,” was written for models that answered immediately. Many current models reason before they answer, and the vendors now say so in their documentation. OpenAI’s reasoning best practices call prompting such models to “think step by step” or “explain your reasoning” unnecessary. Its prompt engineering guide adds that reasoning models do better with high-level guidance, while GPT models benefit from very precise instructions.
Anthropic says much the same. On Claude Fable 5.1 and Claude Opus 5.5, thinking is always on, and the guide advises preferring general instructions over prescriptive steps: “A prompt like ‘think thoroughly’ often produces better reasoning than a hand-written step-by-step plan.” The older manual setting for thinking tokens is gone too: on Claude 4.7 and later, setting it returns an error. Prompt habits and API options expire together.
The research agrees. A Wharton team tested chain-of-thought prompting and found it generally improved average performance of non-reasoning models by a small amount while adding variability, and often produced only marginal gains for reasoning models while significantly increasing the time and tokens needed. There are exceptions: the DeepSeek-R1 card still recommends a directive for math, “Please reason step by step, and put your final answer within \boxed{}.” That is the point. The right wording depends on the model, so the rule is to read its documentation before trusting a trick.
Anatomy of a Good Prompt
The difference between a mediocre prompt and a good one is not cleverness. It is completeness. A good prompt answers the questions the model would ask if it could.
Here is the pattern applied to a real task. Compare these two prompts for the same job:
The second prompt is longer, and it should be. Length is not the target, though; the test is the colleague check from the start of this page. If a person with no context could follow it and produce something usable, the model probably can. If your prompt tries to do three jobs at once, split it into three requests.
What Most Guides Get Wrong
They overvalue clever phrasing. “You are the world’s foremost expert in…” does not make the model smarter, and the persona study above is the evidence. Clarity beats cleverness. If your prompt reads like marketing copy, rewrite it.
They ignore iteration. No prompt works perfectly on the first try. The skill is reading the output, naming what went wrong and adjusting, and OpenAI’s guide recommends building tests and evaluation suites that measure prompt behavior so you can monitor performance as you iterate. That is debugging, not engineering magic, and the fastest way to learn is to look at the failures.
They skip the uncertainty instruction. Anthropic’s guide on reducing hallucinations lists first: explicitly give the model permission to say “I don’t know,” which it says can drastically reduce false information. Add something like “If you are unsure of a fact, say so instead of guessing.” The same page is careful to add that these techniques do not eliminate hallucinations, so verify anything that matters.
They treat prompting as static. A prompt tuned for one model can behave differently on another, and Anthropic says to treat a technique measured on one named model as measured on that model only, and to re-check it against your own evaluations before applying it to another. Versions help: OpenAI recommends pinning production applications to specific model snapshots for consistent behavior, and Anthropic states that every Claude model ID is a pinned snapshot, with retirement dates published (not sooner than September 2027 for its current lineup). Pin the version, then re-test before you move.
They forget that simpler is usually better. OpenAI’s guidance for reasoning models is to try zero-shot first, then add examples if needed. Start with a clear instruction and constraints. Add an example only if the output misses the format, and add reasoning instructions only if the model is not already reasoning.
Test Your Own Prompt in Ten Minutes
Everything above is evidence about other people’s tasks. This experiment tells you what holds on yours, using step-by-step reasoning as the test case.
- Write ten word problems whose correct answers you know, such as multi-step discounts, schedules or unit conversions.
- Run all ten with a plain prompt, in a fresh chat each time. Record how many answers are right.
- Run the same ten with “Think through this step by step before answering” added. Change nothing else, and record the score again.
- Note how long each version took and how long the answers were. The Wharton report found the time cost is real even when accuracy barely moves.
- Repeat on a second model if you have access. If the gap flips, you have just seen why one prompt trick does not carry across models.
If both versions score the same, drop the extra words and keep the faster one. That is the one habit this page recommends: change one thing at a time, and let your own ten examples decide.
Frequently Asked Questions
It makes them sound different, not more accurate. In a study of 162 roles, four model families and 2,410 factual questions, adding a persona did not improve performance over no persona. Anthropic’s guide recommends a role for focusing behavior and tone, so use it for audience and style (“a first-year student explaining taxes to a friend”), and put accuracy work elsewhere: provide the source text, allow “I don’t know,” and check the result.
It depends on the model. For older or fast models without a thinking mode, it helped a lot in 2022 tests. For reasoning models, OpenAI calls it unnecessary and a Wharton study found only marginal gains at a real cost in time and tokens. Check whether your model reasons by default, then run the ten-problem test above on the one you actually use.
Start with none. If the format or tone misses, add examples: Anthropic suggests three to five that are relevant and varied, and OpenAI suggests showing a diverse range of inputs. Differences between models are real but mostly about convention, such as the DeepSeek-R1 card’s advice to skip the system prompt. Keep the fundamentals constant (clarity, context, examples, constraints), adjust the conventions per model, and re-test whenever the provider changes the model.