Prompt engineering is the practice of designing the text you give a large language model (its instructions, context, examples and requested output format) so the model's prediction lands closer to what you need. It works because a language model generates each word conditioned on everything in its input, so clearer context narrows the range of likely continuations. Documented techniques include few-shot prompting (showing worked examples, described in the 2020 GPT-3 paper by Brown et al.), chain-of-thought prompting (asking for intermediate reasoning, which Wei et al. 2022 found raised one large model's score on grade-school math problems from about 18% to about 57%), role and format instructions, and supplying source documents. Prompting cannot give a model facts it doesn't have or guarantee accuracy, so outputs still need checking, which is why official guides from OpenAI and Anthropic pair prompting advice with testing against real examples.
Reading time
— 6 min
Updated
— Oct 1, 2026
Fact-reviewed
— Oct 1, 2026
Key Takeaways
Key Takeaways
1Prompt engineering means designing the input (instructions, context, examples, output format) so a language model's prediction lands closer to what you need.
2It works because the model generates every word conditioned on everything it has been given. More precise context narrows the range of likely answers.
3It can't add knowledge the model doesn't have or make an answer true. It improves the odds, so outputs still need checking.
The concept
Imagine handing a task to a very well-read temp worker who has never met you, can't ask questions, and will start typing the moment you stop talking. If you say "write something about our product," you get something generic. If you say who it's for, how long it should be, what to include, and show one example you liked, you get something close to usable. That's all prompt engineering is: giving the model the briefing a stranger would need. The word "engineering" makes it sound mysterious, but the core skill is the same one good managers use when they write a clear brief. The catch is the temp worker's confidence. A chatbot sounds equally sure whether it knows the answer or is guessing, so a better brief raises your odds of a good answer without guaranteeing one.
The reason this matters is hallucination. A model fills gaps with plausible text. Prompt engineering is mostly about leaving fewer gaps: telling it what you want, giving it the facts to work from, and showing it what a good answer looks like. It's a different activity from training, which happens long before you type anything (see how chatbots are trained). Prompts also steer AI agents, which loop through tools and actions, so a vague instruction there can produce a wrong action rather than just a wrong paragraph.
Quick check
A chatbot gives you a vague, generic answer. What is the most likely cause?
The five levers that actually move results
Strip away the hype and nearly every documented technique fits one of five levers. They're ordered roughly by how much they usually help.
Task and audience. What you want, for whom, and why. "Explain inflation" versus "Explain inflation to a 14-year-old in 150 words for a school newsletter."
Context and source material. Paste the document, the data, or the policy text. A model summarizing text it can see is far more reliable than one recalling from memory.
Examples (few-shot). One to five samples of the input and the output you want. This is the fastest way to pin down tone and format.
Output format. Bullets, a table, JSON, a word limit, headings. Say it, don't hope for it.
Steps. For multi-step problems, ask for the reasoning or split the job into separate prompts (outline first, then draft).
Worked examples
Example 1: A product email (baseline case)
Prompt A: "Write an email about our new feature." The result is a cheerful, generic announcement that could be from any company. Prompt B: "Write a 120-word email to existing small-business customers announcing that invoices can now be paid by bank transfer. Tone: plain and friendly, no exclamation marks. Include one sentence on how to turn it on (Settings, then Payments). End with a single link placeholder." Prompt B usually produces something close to sendable. Nothing magic happened. Prompt B supplied the audience, length, tone, facts and structure that A left for the model to guess.
Example 2: A math word problem (where reasoning steps help)
"A cafe had 23 apples, used 20 for lunch and bought 6 more. How many now?" Asked for just the number, models historically slipped on problems like this. Asked to work it through (23 minus 20 is 3, plus 6 is 9), they got it right far more often. This is the example that opens the Wei et al. paper, and it's the clearest evidence that prompt structure changes accuracy on multi-step tasks. Newer "reasoning" models now do much of this step-by-step work internally, so the visible gain from adding "think step by step" is smaller on them, which is a good reminder that prompting tricks are model-dependent.
Example 3: Asking for a citation it doesn't have (the limit)
"You are a world-class legal researcher. Give me three court cases supporting this argument, with citations." The role line makes the answer sound more authoritative. It doesn't give the model a legal database. If the cases aren't reliably in its training data, it can generate realistic-looking but non-existent citations, which has already happened in real court filings. The fix isn't a better role phrase. It's supplying the actual sources (or using a tool that searches them) and verifying every citation yourself. Prompting shapes the guess; it can't supply the knowledge.
Quick check
Which prompt change is most likely to stop a model from inventing details about your company's refund policy?
How it works (visual)
What a prompt is made of, and what it can and can't do
Common mistakes
Common Mistakes
✕
Collecting "magic phrases" from social media and pasting them into every prompt.
→ Spend the words on context instead: audience, purpose, source material and an example. Those transfer across models; phrase tricks often don't.
✕
Judging a prompt by one good answer.
→ Try it on five to ten realistic inputs. Outputs vary from run to run, and the vendor guides recommend exactly this kind of small test set.
✕
Asking the model for facts, figures or citations it would have to recall from memory.
→ Give it the source to work from, or verify every specific claim independently before using it.
✕
Cramming a complex job into one giant prompt.
→ Split it: outline, then draft, then critique. Each step gets a clearer, smaller target.
Common misconception
“Prompt engineering is a technical skill that unlocks hidden abilities inside the AI.”
It's mostly clear writing plus testing. The model can only do what its training made possible; a prompt chooses which of those behaviors you get and how reliably. The research gains (few-shot, chain-of-thought) came from giving models better information about the task, not from secret commands.
What to do next
What to do next
Next time you prompt, include four things: the task, the audience, the format, and any source text the answer should come from.
Add one example of a good output when tone or structure matters.
For anything multi-step, ask for the working, or split it into separate prompts.
Save prompts that work and test them on a few new inputs before relying on them.
Check every fact, number and citation in the output against a real source.
FAQ
FAQ
Related terms
Related terms
Prompt
Everything a language model receives as input for a given response: instructions, background, examples, documents and the question itself.
Context window
The maximum amount of text (measured in tokens) a model can take into account at once. Anything outside it is invisible to the model.
Few-shot prompting
Including a handful of worked input-and-output examples in the prompt so the model copies the pattern, with no retraining.
Chain-of-thought prompting
Asking the model to write out intermediate reasoning steps before its final answer, which tends to help on multi-step problems.
System prompt
Standing instructions set by the app or developer that apply to every message in a conversation, separate from what the user types.
In-context learning
A model picking up a task from examples inside the prompt itself, without any change to its trained weights.
This entry was researched from public sources and drafted with AI-assisted tools, then edited — errors are still possible. Spot one, or want a topic covered? Read our disclaimer.