Before you start
Pick a prompt you already use, ideally one that tells the model how to work ("first do this, then that"). You will rewrite it in this lesson. Access to a reasoning model through a chat app or an API is enough to test the result.
A delimiter is a marker that separates parts of a prompt, such as XML tags or markdown headings. A developer message is OpenAI's name for the instruction message that sits above the user's message. Since o1-2024-12-17 it has replaced the system message for OpenAI's reasoning models.
Rewrite a prompt as a goal
OpenAI's reasoning guide says its reasoning-capable GPT-5 models usually work best when you give a clear goal, strong constraints and an explicit output contract without prescribing every intermediate step. Its refactoring example shows all three and not one line about how to think.
Read it top to bottom. The goal comes first, then two lines on what the reply may contain, then a limit on layout, and last the code to work on.
Instructions:
- Given the React component below, change it so that nonfiction books have red
text.
- Return only the code in your reply
- Do not include any additional formatting, such as markdown code blocks
- For formatting, use four space tabs, and do not allow any lines of code to
exceed 80 columns
const books = [
{ title: 'Dune', category: 'fiction', id: 1 },
{ title: 'Frankenstein', category: 'fiction', id: 2 },
{ title: 'Moneyball', category: 'nonfiction', id: 3 },
];
export default function BookList() {
const listItems = books.map(book =>
<li>
{book.title}
</li>
);
return (
<ul>{listItems}</ul>
);
}- Write the finished state in one sentence, as the example does with "change it so that nonfiction books have red text".
- List the constraints as separate lines: what the reply may contain, and the formatting limits.
- Say what the output must not include. The example bans markdown code blocks, so the reply can be pasted straight into a file.
- Wrap pasted material in delimiters, so the model can tell where the task ends and the data begins.
- Delete every line that fixes an order of thought, such as "first list the options, then compare them".
- Run it with no examples. Add a few only if the output shape still drifts, and make them match your instructions exactly.
Say where the reasoning should appear
You can still shape what the visible reply contains. Another example in the guide asks for a plan for a small database-backed app and then every file in full. Its last line reads: "Only supply your reasoning at the beginning and end, not throughout the code."
That line controls output, not thinking. It tells the model where the explanation belongs and leaves the model free to reason however it likes before it writes anything.
OpenAI's best practices page adds that reasoning models usually do not need few-shot examples. If you add them, they should match your instructions closely, because a mismatch between the two can produce poor results. How to keep their format steady is the subject of the few-shot lesson, which you can skim first.
Fix rules that fight each other
A reasoning model takes every line seriously. The GPT-5 prompting guide warns that contradictory or vague instructions can hurt GPT-5 more than other models, because it spends reasoning tokens searching for a way to reconcile them instead of picking one at random.
The guide shows a scheduling assistant for a healthcare startup whose prompt looks consistent at first glance. It holds two clashes. One rule never to book without recorded consent collided with a rule to auto-assign the earliest slot without contacting the patient. A rule to always look up the patient first collided with a rule to send urgent cases to 911 before any scheduling step. OpenAI's two fixes are below.
OpenAI makes a similar point about GPT-6 Astra. The Using GPT-6 page says unclear or conflicting guidance in a skill file may make it pause and block work early, and tells you to make the priority of user instructions and skills explicit.
Conflict 1
Never schedule an appointment without explicit patient consent recorded in the chart.
...auto-assign the earliest same-day slot without contacting the patient as the first action to reduce risk.
Fix
...auto-assign the earliest same-day slot after informing the patient of your actions.
Conflict 2
Always look up the patient profile before taking any other actions to ensure they are an existing patient.
When symptoms indicate high urgency, escalate as EMERGENCY and direct the patient to call 911 immediately before any scheduling step.
Fix (a line added)
Do not do lookup in the emergency case, proceed immediately to providing 911 guidance.- Search the prompt for "never" and "always", and check each one against every other rule.
- When two rules can collide, add the case that decides it, as the emergency line does.
- Say which source wins when a prompt, a user message and a file disagree.
What each vendor says to change
The vendors give different advice, and each piece is written for a different model. OpenAI says to avoid step-by-step cues. DeepSeek suggests one for maths. Treat the page for the model you call as the rule.
| Model | What to put in the prompt | What to do with settings |
|---|---|---|
| OpenAI, GPT-5 and GPT-6 | A clear goal, strong constraints and an explicit output contract. No "think step by step" | On the GPT-6 models, remove temperature, top_p and top_logprobs when the reasoning effort is not none. The pages read for this lesson give no such rule for GPT-5 |
| Claude Sonnet 5.5 | Anthropic's cookbook gives no wording advice. It notes that you cannot pre-fill the assistant's reply | Non-default temperature, top_p and top_k are rejected, with or without thinking |
| DeepSeek-R1 | No system prompt, all instructions in the user prompt. For maths, Please reason step by step, and put your final answer within \boxed{}. | Temperature from 0.5 to 0.7, with 0.6 recommended |
Keep earlier thinking in a long conversation
A reasoning model that makes tool calls does better when it can see its own earlier thinking. OpenAI's GPT-5 guide recommends the Responses API and passing previous_response_id, so the model can refer to its previous reasoning instead of rebuilding a plan after every tool call.
The guide reports one number for it. Tau-Bench is a benchmark in which a language agent talks with a simulated user, using tools and policy rules for one domain. Sierra's repository contains airline and retail tasks. The GPT-5 guide, posted on 7 August 2025 and now archived, says GPT-5's Tau-Bench Retail score rose from 73.9% to 78.2% just by switching to the Responses API and passing back previous reasoning items.
That compares two API setups, not the reasoning items alone. OpenAI says the model then conserves thinking tokens and does not rebuild a plan after each tool call. It is a vendor result on one benchmark, so check it against your own tasks.
73.9%
Before: the Chat Completions API
Source: OpenAI Cookbook: GPT-5 prompting guide (archived) (read November 6, 2026)
78.2%
After: Responses API with previous_response_id
Source: OpenAI Cookbook: GPT-5 prompting guide (archived) (read November 6, 2026)
Common mistakes
- Pasting a prompt written for a fast model and leaving its "first do this, then that" lines in place.
- Piling on rules after each failure until two of them contradict each other.
- Sending
temperatureortop_pto a model that rejects or ignores them. - Adding a system prompt to DeepSeek-R1 when its card says to put every instruction in the user prompt.
- Adding few-shot examples whose format differs from the instructions above them.
Try it yourself
- Rewrite your own prompt with the six steps above, then run the old and new versions on the same input and compare the replies.
- Take a long prompt of yours and list every "never" and "always". Find one pair that can collide, and write the line that decides it.
- Open the vendor page for your model from the table and write down one change to your next request.
Next: how much should the model think
The goal is only half of the request. The next lesson covers the settings that decide how long the model thinks and how many tokens that may cost.
Check yourself
Which line should come out of a prompt written for an OpenAI reasoning model?
Show answer
B. Think step by step and explain your reasoning OpenAI calls step-by-step cues unnecessary because these models reason internally. The other lines are constraints on the output.
In the GPT-5 guide's scheduling example, why did the conflicting rules hurt performance?
Show answer
C. GPT-5 spent reasoning tokens trying to reconcile them The guide says GPT-5 expends reasoning tokens searching for a way to reconcile contradictions rather than picking one at random.
What does DeepSeek recommend about the system prompt for R1?
Show answer
A. Avoid it and put all instructions in the user prompt The model card says to avoid a system prompt and keep all instructions inside the user prompt.
A request sends a non-default temperature to Claude Sonnet 5.5. What does Anthropic's cookbook say happens?
Show answer
D. The request is rejected The cookbook says non-default temperature, top_p and top_k values are rejected on this model, with or without thinking.
Frequently asked questions
How do you prompt a reasoning model?
Give it the task, the constraints and the format you want, then let it plan the steps. OpenAI recommends brief, direct instructions, delimiters around the parts of the input and a zero-shot first try, with a few matching examples only if the result needs them.
Should I tell a reasoning model to think step by step?
Not on OpenAI's models. Its best practices page calls the line unnecessary and says it can sometimes hinder. DeepSeek is the exception, because its model card suggests a step-by-step directive with a boxed final answer for maths problems on R1.
Do reasoning models need few-shot examples?
Usually not. OpenAI says reasoning models often do well without them, so write the prompt with no examples first. If you add some, keep them close to your instructions.
What does "Formatting re-enabled" do?
OpenAI's best practices page says reasoning models in the API avoid markdown unless the first line of the developer message is the string Formatting re-enabled. The Using GPT-6 page describes the opposite habit. GPT-6 Astra leans toward lists and tables, and OpenAI says to state it if you want less formatting.
Sources
- OpenAI Docs: Reasoning models https://developers.openai.com/api/docs/guides/reasoning
- OpenAI Docs: Reasoning best practices https://developers.openai.com/api/docs/guides/reasoning-best-practices
- OpenAI Cookbook: GPT-5 prompting guide (archived) https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_prompting_guide
- OpenAI Docs: Using GPT-6 https://developers.openai.com/api/docs/guides/latest-model
- Anthropic on GitHub: Claude cookbooks, Extended Thinking https://github.com/anthropics/claude-cookbooks/blob/main/extended_thinking/extended_thinking.ipynb
- Hugging Face: DeepSeek-R1 model card https://huggingface.co/deepseek-ai/DeepSeek-R1
- OpenAI Cookbook on GitHub: registry entry for the GPT-5 prompting guide (dated 2025-08-07, archived) https://github.com/openai/openai-cookbook/blob/main/registry.yaml
- Sierra on GitHub: tau-bench https://github.com/sierra-research/tau-bench
