Short answer: prompt engineering is telling an AI what it needs to answer well. Most good prompts have four parts: the role (who it should be), the task (what to do), the context (what it needs to know) and the format (how the answer should look). Add one example of the answer you want, and the AI copies the pattern.
It sounds like a job title, and for teams building products on AI it can be. For everyone else it is a short habit. A chat model only knows what you typed, so a vague answer usually means something in your head never reached the prompt.
Checked against the Anthropic, OpenAI and Google docs (5 November 2026).
What are the four parts of a prompt?
| Part | The question it answers | Example |
|---|---|---|
| Role | Who should the AI be? | "Act as a travel planner who knows Rome well." |
| Task | What should it do? | "Plan a three-day trip to Rome." |
| Context | What does it need to know? | "Two adults, a tight budget, we like food and walking." |
| Format | How should the answer look? | "A table per day: time, place, rough cost." |
All three big model makers describe the same pieces. Anthropic says of a role that "even a single sentence makes a difference". OpenAI's guide says to give the model "any additional information it might need". Google's says "you can give instructions that specify the format of the response".
For the task, Anthropic's test is the most useful one: show your prompt to a colleague with minimal context on the job and ask them to follow it. If they would be confused, the model will be too.
What does a good prompt look like, before and after?
Before:
Plan a Rome trip.This gets a generic list, because the model has to guess how long you are staying, what you can spend and what you want to read at the end.
After:
Act as a travel planner who knows Rome well.
Plan a three-day trip to Rome.
We are two adults on a tight budget, and we like food and walking.
Give me one table per day with the columns time, place and rough cost.Nothing clever happened. Every line just removes a guess.
Why does one example help so much?
Because an example shows at once what a paragraph of rules has to describe. If you want a particular shape, paste one row of it:
Format each row like this:
09:00 | Walk through Trastevere | FreeGoogle goes furthest here: "We recommend to always include few-shot examples in your prompts." Few-shot just means a few examples of the input and the answer you want. OpenAI calls it "a handful of input/output examples", and Anthropic suggests 3 to 5 for best results. Use that many when a prompt will run again and again. For a one-off chat, one is usually enough to make the difference.
Does the order of the parts matter?
Less than having them. Role, task, context, format is an easy order to remember, which is the main reason to use it: you notice when one is missing. The docs add two details:
- The role goes first. Google's guidance for Gemini 3 puts it at the very beginning of the prompt, or in the system instruction.
- Long pasted material depends on the model. The makers disagree here. OpenAI's guide says context "is usually best positioned near the end of your prompt". Anthropic says to put long documents near the top, above your question, and that a question at the end can improve quality by up to 30 percent in its tests. For a short paste it will rarely matter; for a long report, follow the guide of the model you use.
When is prompt engineering not the answer?
When the problem is not the words. Anthropic's overview points out that not every failure is best solved with a prompt: speed and cost, for example, are often easier to fix by choosing a different model. And a better prompt cannot give a model facts it does not have, so paste the source and tell it to use only that. If you already have a prompt and the answer is off in a specific way, 20 prompts that fix bad AI answers lists one line per problem.
Does this work for images and video too?
The idea is the same, the parts change. An image prompt names the subject, the setting, the style, the light, the camera and the format, as in image prompts that work in Midjourney, Flux and Nano Banana. A video prompt needs its own four parts.
Where can you check this?
- Anthropic: Prompting best practices
- Anthropic: Prompt engineering overview
- OpenAI: Prompt engineering
- Google: Prompt design strategies
Where do you start?
Take the last prompt that gave you a weak answer, and add whichever of the four parts it was missing. For pictures, it is often faster to start from words that already worked: Prompt Gallery shows 558 image prompts, each next to the picture it made, so you can copy one and change the details.

