What is prompt engineering?
Prompt engineering is the craft of telling a language model what you want clearly enough that it does it well and does it the same way each time. A prompt is everything the model is given: the instruction, background, examples, documents and the format expected back.
How do you write a good prompt?
Write it as you would brief a capable new colleague who knows nothing about your company.
- State the task and the goal. Say what you want and what it is for.
- Give the context. Audience, product, constraints, what has been tried.
- Show examples. Two or three samples of good output teach more than a paragraph of description.
- Specify the format. Length, structure, tone, and what to leave out.
- Supply the facts. Paste the source material. Do not rely on the model's memory for specifics.
- Say what to do when unsure. For instance, to answer "not stated in the source" instead of guessing.
- Test and revise. Run it on varied inputs, read the failures and change one thing at a time.
Prompt engineering examples
| Weak prompt | Stronger prompt |
|---|---|
| "Write a cold email." | "Write a cold email of under 90 words to a head of finance at a 50-person SaaS company that has just raised a Series A. We sell spend management software. Mention the funding round once, name one specific problem, and end with a question. Plain tone, no exclamation marks. Here are two emails that worked: ..." |
| "Summarise this call." | "Summarise this sales call transcript in five bullets: the buyer's problem, current tool, objections raised, next step agreed and anything we promised to send. Quote the buyer's words for the problem. If a point was not discussed, write 'not discussed'." |
Common prompting techniques
- Zero-shot: an instruction with no examples.
- Few-shot: an instruction with a handful of examples to copy.
- Step-by-step reasoning: asking the model to work through the problem before answering.
- Role and audience: saying who the output is for and from whose viewpoint.
- System prompt: standing instructions that apply to every message in a product.
- Chaining: splitting a job into several prompts, each feeding the next.
Prompt engineering vs context engineering
Prompt engineering focuses on the wording of the instruction. Context engineering is the wider job of deciding what information reaches the model at all: which documents are retrieved, what the tools return, what is remembered from earlier. As models have become better at following plain instructions, more of the gain comes from giving them the right material.