Category leaders

Guide

What Is Prompt Engineering?

A plain-English guide to prompt engineering: what it is, what a good prompt contains, which techniques the AI vendors recommend, how reasoning models changed chain-of-thought prompting, context engineering, prompt injection, and whether it is still a job.

November 19, 2026 · The AI Rankings

Quick answer: Prompt engineering is the practice of writing and structuring the input you give an AI model so that it produces the output you want, reliably. It still matters, but the advice has changed. The prompting guides that OpenAI, Anthropic and Google publish for the models behind ChatGPT, Claude and Gemini ask for plain, direct instructions, and put the weight on clear goals, the right background material and, where tone or format matters, good examples. Chain-of-thought prompting, the “let’s think step by step” technique, shows the change: it lifted one 2022 model from 17.7% to 78.7% on a maths benchmark, but in a 2025 test Wharton researchers found it added little or nothing on reasoning models, which already think before they answer. The part that has not changed is the context: the instructions, examples and documents the model is given. Anthropic calls the work of choosing them context engineering, “the natural progression of prompt engineering” (Anthropic).

Definition: Prompt engineering is the craft of designing the instructions, examples, background information and output format given to an AI model so that its answers are accurate, consistent and useful. For everyday users it means asking clearly. For developers it means writing, testing and versioning the system prompts that sit behind AI products.

This page is the explainer: what prompt engineering is, what the vendors recommend and what has changed. For tools that write prompts for you, see best AI prompt generators. For pay and job prospects, see prompt engineer salary. For the models the prompts go into, see what is an LLM, and for one-line definitions of the surrounding vocabulary, see the AI glossary.


What is prompt engineering?

Prompt engineering is the work of shaping what goes into an AI model so that what comes out is right. A prompt is the full input a model receives for one turn, and prompt engineering is deciding what that input contains, in what order and in what form.

A language model has no idea what you want beyond what the prompt tells it. It predicts the most plausible response to the text in front of it, so a vague prompt gets a generic answer and a specific prompt gets a specific one. Anthropic’s prompting guide puts the test simply: show your prompt to a colleague with minimal context on the task, and “if they’d be confused, Claude will be too.”

What goes into a prompt

Most well-built prompts, whether typed into a chatbot or written into an app, are made of the same handful of parts.

PartWhat it doesExample
InstructionStates the task and the goal”Summarise this contract for a non-lawyer”
ContextGives the background the model cannot knowWho the reader is, what the summary is for, what has already been decided
ExamplesShows the pattern you want rather than describing itTwo or three sample summaries in the style you like
Input dataThe material the model works onThe contract itself
ConstraintsSets limits”Under 200 words; flag anything about termination”
Output formatSays what shape the answer should takeA table, bullet points, JSON, a single paragraph

Not every prompt needs every part. A quick question needs only the instruction. A prompt that runs thousands of times inside a product usually needs all six.

System prompts vs user prompts

AI apps split the prompt into two layers. The system prompt is the standing instruction set written by whoever built the app: the model’s role, rules, tone and available tools. The user prompt is what you type. OpenAI’s API calls the first layer a developer message, and its reasoning guide says its reasoning models take developer messages in place of system messages. When you set custom instructions in ChatGPT, or a Gem in Gemini, you are writing a small system prompt of your own.


Does prompt engineering still matter?

Yes, but the advice has changed. The vendors’ guides advise against several habits written for older models, while clear goals and the right context appear in all three.

Plain instructions work. Anthropic’s guide says Claude Opus 4.5 and Claude Opus 4.6 respond more closely to the system prompt than earlier models, so prompts written to stop older models under-using a tool may make them over-use it. Where you might once have written “CRITICAL: You MUST use this tool when…”, it suggests “more normal prompting such as ‘Use this tool when…’”. Google’s Gemini prompting guide says Gemini 3 models respond best to prompts that are “direct, well-structured, and clearly define the task”. OpenAI’s reasoning guide advises keeping prompts “simple and direct”.

Step-by-step prompting adds little on reasoning models. Chain-of-thought prompting was introduced in 2022. On the reasoning models the Wharton Generative AI Labs report tested in 2025, it added “only marginal, if any” gains while making requests take 20% to 80% longer (see the chain-of-thought section below).

Formatting can swing results. A study by Melanie Sclar and colleagues (ICLR 2024) found that subtle formatting changes to a few-shot prompt, such as separators and spacing, produced “performance differences of up to 76 accuracy points” on Meta’s LLaMA-2-13B, and that the sensitivity remained with larger models, more examples and instruction tuning. It is the reason prompts are worth testing rather than guessing.

What changed, and what didn’t

Old habitWhat the vendors adviseSource
”Think step by step” on every hard questionLet reasoning models reason; ask for step-by-step reasoning when thinking is switched offWharton, OpenAI, Anthropic
CAPITALS, “CRITICAL”, “you MUST”Normal wording; Anthropic advises softening aggressive languageAnthropic
”NEVER do X”Say what to do instead, and whyAnthropic
Long, elaborate prompt templatesA minimal prompt first, then instructions and examples for the failures you seeAnthropic
Clear goal, the right documents, examplesStill recommended; OpenAI suggests trying its reasoning models without examples firstOpenAI, Anthropic, Google

Prompt engineering techniques that still work

These techniques come from the prompting guides that OpenAI, Anthropic and Google publish for their models; the last column says which guides recommend each one. None of them is a trick. Each one gives the model information it would otherwise have to guess.

TechniqueWhat it meansWhen it helps mostRecommended by
Be clear and specificState the task, the goal and what a good answer looks likeAlwaysOpenAI, Anthropic, Google
Explain whyGive the reason behind a rule, not just the ruleAny rule the model might apply too rigidly or too looselyAnthropic
Give examples (few-shot)Show a few sample inputs and outputsTone, format and classification tasksAnthropic, Google; OpenAI suggests trying its reasoning models without them first
Separate the partsMark instructions, documents and examples with headings, XML-style tags or other delimitersLong prompts and prompts with pasted materialOpenAI, Anthropic, Google
Put long documents firstPaste the material at the top and ask the question at the endQuestions about long reports, contracts or codeAnthropic, Google
Specify the output formatAsk for a table, list, word limit or JSON schemaAnything you will reuse, paste or parseAnthropic, Google
Give the model a roleOne line on who it is and who it is writing forExpert or audience-specific answersAnthropic, Google
Break big jobs into stepsRun one prompt per stage and feed each result into the next (prompt chaining)Multi-stage work such as research, then outline, then draftAnthropic, Google
Ask for quotesHave the model quote the passages it relied on before answeringReducing hallucinations on document questionsAnthropic

Be clear, and explain why

Anthropic’s own example is the clearest illustration. An instruction that says “NEVER use ellipses” is less effective than telling the model its response will be read aloud by a text-to-speech engine, which will not know how to pronounce them, because “Claude can generalize from the explanation.” The model can then avoid other things a speech engine would stumble over, without being told.

Examples: the vendors disagree on how many

All three vendors mention examples, but they disagree on when to use them.

Read together, the guides treat examples as most useful for tone, format and structure, and OpenAI treats them as optional for its reasoning models.

Long documents go at the top

For prompts that include long material, Anthropic recommends putting the documents at the top and the question at the end, and says queries placed at the end “can improve response quality by up to 30 percent in tests, especially with complex, multidocument inputs.” That figure is Anthropic’s own, from its own testing. Google gives the same advice for Gemini 3: “supply all the context first” and put the question at the end.

Settings: leave the sampling settings alone

Temperature controls how often a model picks less likely words. Google’s guide says Gemini 4 and Gemini 3.6 and later models ignore custom temperature, top-p and top-k values, and advises keeping them at their defaults on earlier Gemini 3 models “to avoid degraded reasoning performance” (Google).


Chain of thought prompting

Chain-of-thought prompting is asking a model to write out its reasoning step by step before giving a final answer. Researchers introduced it in 2022, and reasoning models have since built it in.

Where it came from

A Google Research team led by Jason Wei introduced chain-of-thought prompting in a paper first posted on 28 January 2022. They gave a 540-billion-parameter model “just eight chain of thought exemplars”, worked examples that included the reasoning, and it reached what was then state-of-the-art accuracy on the GSM8K benchmark of school maths word problems, “surpassing even finetuned GPT-3 with a verifier.”

Four months later, a team led by Takeshi Kojima found that no examples were needed at all. Adding the phrase “Let’s think step by step” before the answer raised OpenAI’s text-davinci-002 from 17.7% to 78.7% on the MultiArith benchmark and from 10.4% to 40.7% on GSM8K (Kojima et al., first posted 24 May 2022).

A follow-up technique, self-consistency, samples several different reasoning paths and takes the most common final answer. Its authors, led by Xuezhi Wang and including several of the chain-of-thought paper’s Google authors, reported a 17.9% gain on GSM8K over standard chain-of-thought prompting (Wang et al., first posted 21 March 2022).

Why reasoning models changed it

A reasoning model is trained to think through a problem before it answers, so chain of thought is built in rather than prompted. OpenAI released its first reasoning model, o1-preview, on 12 September 2024. Google’s guide says Gemini 2.5 and 3 series models generate internal “thinking” text, and Anthropic’s describes extended and adaptive thinking for Claude (see what is an LLM for how reasoning models work).

The Wharton Generative AI Labs report by Lennart Meincke, Ethan Mollick and colleagues (June 2025) tested chain-of-thought prompts on GPQA Diamond, a set of 198 PhD-level multiple-choice questions in biology, physics and chemistry, asking each question 25 times per condition.

Model typeEffect of asking for step-by-step reasoningExtra time per request
Non-reasoning models (including GPT-4o and Claude 3.5 Sonnet)Average scores generally rose against a prompt telling the model to answer directly. Against no instruction at all, the gain was much smaller, because many models already reasoned step by step unprompted. In three of the five models, it also caused errors on questions the model otherwise got right35% to 600% longer
Reasoning models (o3-mini, o4-mini, Gemini 2.5 Flash)“Only marginal, if any” gains: o3-mini and o4-mini improved slightly on average, and Gemini 2.5 Flash scored slightly lower20% to 80% longer

The vendors say the same thing:

When chain-of-thought prompting is still useful


Prompting terms you will see

TermWhat it means
Zero-shot promptingAsking for a task with no examples
One-shot and few-shot promptingIncluding one or a handful of worked examples in the prompt; OpenAI’s GPT-3 paper (28 May 2020), “Language Models are Few-Shot Learners”, used “few-shot” for a model given a few demonstrations of a task in its prompt, with no retraining
Chain-of-thought promptingAsking the model to reason step by step before answering
Self-consistencySampling several reasoning paths and taking the majority answer
Role promptingTelling the model who it is and who it is writing for
System promptThe standing instructions set by an app’s builder, applied before every user message
Prompt chainingSplitting a job into a sequence of prompts, each using the last one’s output
PrefillWriting the first words of the model’s reply for it to continue; Anthropic stopped supporting prefill on the last assistant turn starting with its Claude 4.6 models (Anthropic)
Meta-promptingAsking a model to write or improve a prompt for you
Context engineeringCurating everything in the model’s context window, not just the instructions (see below)
Prompt injectionAn attack that hides instructions in content the model reads (see below)

From prompt engineering to context engineering

Context engineering is the practice of deciding everything a model sees when it works: instructions, documents, search results, tool descriptions, conversation history and memory. Prompt engineering is usually treated as one part of it.

Andrej Karpathy backed the term over “prompt engineering” in June 2025, describing context engineering as “the delicate art and science of filling the context window with just the right information for the next step”, as Drew Breunig recorded at the time. On 29 September 2025, Anthropic published a guide to context engineering for AI agents that calls it “the natural progression of prompt engineering.”

Anthropic’s guide makes three points that apply well beyond agents:

The guide also explains why more is not always better. As the number of tokens in the context window grows, a model’s ability to recall information from that context falls, an effect it calls context rot. Adding everything available is not the same as giving the model what it needs.

For everyday users, context engineering is less abstract than it sounds. Custom instructions, saved memory, project folders with reference files and connected apps are all ways of giving a chatbot standing context so you do not have to repeat it in every prompt. For developers, it covers retrieval-augmented generation (RAG), which fetches relevant documents into the prompt, and the Model Context Protocol (MCP), which connects models to tools and data. Both are building blocks of agentic AI.


How to write a better prompt: a quick method

For anyone using a chatbot, five habits put the vendors’ advice into practice.

  1. Say what the result is for. “Write an email” becomes “Write a short email to a client explaining a two-week delay; they are annoyed, and I want to keep the account.”
  2. Give the background the model cannot know. Paste the relevant document, the earlier thread or the numbers. The model cannot read your mind or your inbox unless you connect it.
  3. Show an example if style matters. Paste one or two pieces you like and say “match this tone and length.”
  4. Say what shape you want back. A table, three options, a word limit, plain text with no headings.
  5. Iterate in the same conversation. Treat the first answer as a draft: tell the model what to change and why.

Before and after

BeforeAfter
”Give me some marketing ideas.""I run a two-person bakery in a commuter town. Suggest five low-cost marketing ideas for weekday mornings, each with a rough cost in dollars and one sentence on why it suits commuters. Put them in a table.”

The second prompt contains no tricks. It gives the model the goal, the context, the constraint and the format.

If you would rather have the model write the prompt for you, ask it: describe what you want, ask what a good brief would need, answer its questions and have it draft the prompt. That works in any major chatbot, including on free plans.


Prompt engineering for developers

Inside a product, a prompt behaves like code: it runs thousands of times, and a change to it needs testing like any other change.

For coding work specifically, where the same principles apply to briefing AI coding agents, see best AI for coding and vibe coding.


Prompt injection: the security side of prompts

Prompt injection is an attack in which instructions hidden inside content a model reads, such as a web page, an email or a document, take over its behaviour. The OWASP Foundation ranks it first, LLM01, in its 2025 Top 10 risks for LLM applications.

OWASP distinguishes two kinds:

OWASP says that “it is unclear if there are fool-proof methods of prevention for prompt injection.” Its recommended mitigations include constraining what the model is allowed to do and requiring human approval for high-risk actions. Those mitigations matter most for AI agents: an agent that browses the web or reads a mailbox takes in untrusted text while holding access to your accounts, and a carefully written system prompt does not stop injected instructions on its own.


Is prompt engineering a job?

Prompt engineer exists as a job title, and writing and testing prompts is also part of broader roles such as AI engineer and AI product manager. For what those roles pay and how demand has moved, see prompt engineer salary; for the wider map of AI careers, see AI career paths.

For people who use AI without building it, prompting is part of using the tools well, much as writing a clear brief is part of delegating. For structured training, see best AI courses.


A short history of prompt engineering

DateEvent
28 May 2020OpenAI’s GPT-3 paper, “Language Models are Few-Shot Learners”, shows a model can do a task from a few examples in its prompt, with no retraining
28 January 2022Google researchers post the chain-of-thought prompting paper
21 March 2022Researchers led by Xuezhi Wang post self-consistency, sampling several reasoning paths and taking the majority answer
24 May 2022Kojima and colleagues show “Let’s think step by step” works with no examples
30 November 2022OpenAI launches ChatGPT
17 October 2023Sclar and colleagues post evidence that formatting alone can swing accuracy by up to 76 points
12 September 2024OpenAI releases o1-preview, its first reasoning model
June 2025Andrej Karpathy backs “context engineering”; Wharton publishes The Decreasing Value of Chain of Thought in Prompting
29 September 2025Anthropic publishes its context engineering guide
30 November 2026OpenAI’s dataset-backed prompt optimizer is scheduled to close with its Evals platform

Frequently asked questions

What is prompt engineering in simple terms?

Prompt engineering is writing the instructions you give an AI model so that it gives you the answer you actually want. In practice it means stating the goal clearly, giving the background the model cannot know, showing an example when style matters and saying what format you want back.

Is prompt engineering still relevant?

Prompt engineering is still relevant, but the advice has changed. The prompting guides from OpenAI, Anthropic and Google ask for plain, direct instructions; Anthropic advises softening forceful wording written for older models, and OpenAI says its reasoning models do not need to be told to think step by step. Clear goals, the right context and, for tone and format, good examples remain the core advice.

What is chain of thought prompting?

Chain-of-thought prompting is asking an AI model to write out its reasoning step by step before giving a final answer. Google researchers introduced it in January 2022. In a May 2022 study by Takeshi Kojima and colleagues, adding “Let’s think step by step” raised one model from 17.7% to 78.7% on the MultiArith maths benchmark. Reasoning models do this internally, so the prompt adds little on them.

Does “think step by step” still work?

“Think step by step” can still help models that do not reason by default, but it adds little or nothing on reasoning models. A June 2025 Wharton study found only marginal gains, if any, on reasoning models such as o3-mini and o4-mini, with requests taking 20% to 80% longer. OpenAI and Google both say their reasoning models do not need the instruction.

What is the difference between prompt engineering and context engineering?

Prompt engineering is writing the instructions given to an AI model; context engineering is curating everything the model sees, including documents, search results, tool descriptions, conversation history and memory. Anthropic describes context engineering as “the natural progression of prompt engineering”, and Andrej Karpathy backed the term in June 2025.

What are the main prompt engineering techniques?

The main prompt engineering techniques are clear and specific instructions, explaining the reason behind rules, few-shot examples, separating the parts of a prompt with headings or tags, putting long documents before the question, specifying the output format, giving the model a role and breaking big jobs into a chain of smaller prompts. Each appears in the prompting guide of at least one of OpenAI, Anthropic and Google, and clear instructions and separating the parts of a prompt appear in all three.

What is the difference between zero-shot and few-shot prompting?

Zero-shot prompting asks a model to do a task with no examples, while few-shot prompting includes a handful of worked examples so the model can copy the pattern. Google recommends always including few-shot examples, Anthropic suggests three to five, and OpenAI suggests trying its reasoning models without examples first.

Is prompt engineering a real job?

Prompt engineer exists as a job title, and writing and testing prompts is also part of broader roles such as AI engineer and AI product manager. Pay and demand are covered in our prompt engineer salary guide.

Do I need a prompt generator?

Not necessarily. ChatGPT, Claude and Gemini will each draft or improve a prompt if you describe what you want and answer their questions, including on their free plans, which is why our best AI prompt generators page names the chatbot you already use as its pick for most people. OpenAI’s dataset-backed prompt optimizer is scheduled to close with its Evals platform on 30 November 2026.

What is prompt injection?

Prompt injection is an attack in which instructions hidden in content an AI model reads, such as a web page, email or document, hijack its behaviour. The OWASP Foundation ranks it the number one risk for LLM applications in its 2025 Top 10 and says it is unclear whether any fool-proof prevention exists.

How do I write a good prompt?

A good prompt says what the result is for, gives the background the model cannot know, shows an example if style matters, states the format you want back and is refined over a few turns. “Suggest five low-cost marketing ideas for a two-person commuter-town bakery, with rough costs, in a table” gives a model far more to work with than “give me marketing ideas”.

← All guides