The parts of a good prompt
Learn the five parts of a strong prompt: role, task, context, format and constraints.
The five parts
Most good prompts are built from the same few parts. You do not need all of them every time, but thinking through them helps.
- Role. Who should the model act as? For example, "Act as a careful editor."
- Task. What should it do? Use a clear verb: summarise, rewrite, compare, explain.
- Context. What does it need to know? Say who the audience is, what the goal is and paste any text it should work from.
- Format. What should the answer look like? A table, five bullet points, two short paragraphs, or a particular tone.
- Constraints. What should it avoid? For example, "Do not invent facts. If you are unsure, say so."
A weak prompt and a better one
Weak: "Write about dogs."
Better: "Act as a pet-care writer. Write a 150-word introduction to caring for a first dog, for adults who have never owned one. Use a friendly tone and end with three bullet points of tips. Do not give medical advice."
The second prompt names the audience, length, tone and format, so the model has far less to guess.
Try it
Use the box above to see how the parts join into one prompt, then write your own version for a task you do at work or school.
Try it
var prompt = {
role: "an editor",
task: "shorten this email to three sentences",
format: "plain text, friendly tone"
};
console.log("Act as " + prompt.role + ". Please " + prompt.task + ". Output: " + prompt.format + ".");Common errors
- Asking for several different jobs in one prompt. Split them into separate prompts.
- Leaving out the audience, so the answer is too technical or too simple.
Quick check
Which part of a prompt tells the model what you want done?
Quick check
Why add a format, such as 'three bullet points'?

