How to write a prompt that works first time
Say who it’s for, what you want, what to include and how long. Four parts, every time.
Give the model a role, the context, an example of good output and a format. Then iterate on the result, not the prompt.
Treat prompts as code: structure them, version them and test them against cases.
Most disappointing AI answers come from short, vague requests. Add four things and the answer gets much better.
Who it’s for: “for my 80-year-old dad”. What you want: “a step-by-step guide to video-calling”. What to include: “WhatsApp on an iPhone, big clear steps”. How long: “no more than six steps”. That extra is what turns a generic answer into a useful one.
Good prompts carry : the audience, the goal, what you already have and the constraints. Add an example of output you like, and say the format you want back: a table, bullets or an email.
Then iterate in conversation: “shorter”, “more formal”, “add a line about pricing”. When a prompt works, save it. A small library of proven prompts is worth more than any trick.
Structure prompts with clear sections: instructions, documents, examples and the output contract. Ask for structured output when another program will read it, and validate it.
Version prompts alongside your code, keep a small test set of inputs with expected properties, and re-run it when you change the prompt or the model. Most regressions come from small wording changes nobody tested.
Try it yourself 2 minutes
- Think of something you asked an AI recently.
- Rewrite it with who, what, include and length.
- Compare the new answer with the old one.
Try it yourself 2 minutes
- Find an email you wrote that you’re proud of.
- Ask the AI to write a new one ‘in the style of this example’.
- Save the prompt if it works.
Try it yourself 2 minutes
- Split one prompt into instructions, context and examples.
- Write three test inputs with the properties you expect.
- Re-run them after your next change.
Spotted a mistake? Tell us and an editor will check it.