Prompting basics
A good prompt states the task, gives the context the model cannot guess, and shows what a good answer looks like.
Words on this page (2)
- prompt
- : The input text you give a model, including instructions, examples and data.
- eval
- : A repeatable test of AI output quality, run before and after every change.
What it is
Treat the model like a capable colleague who has none of your background. Say what you want, who it is for, what the constraints are, and what format you need back. Include the inputs. Give one or two examples of good output when the format matters. Put long documents before the question, and separate sections with clear tags, for example <document> ... </document> around the pasted text and <question> ... </question> around your request, so instructions are not confused with data.
What helps and what does not
Specific beats clever. "Summarize in three bullets for a CFO, no jargon" works better than a persona line. Examples work better than long descriptions of style. Telling the model what to do works better than listing what not to do: "Reply in two sentences" beats "Do not write long answers". Trying a on five varied inputs finds problems that one input hides.
Try it
Take a prompt that gives mediocre results. Rewrite it with an audience, a format and one example, then compare outputs on the same inputs.
A worked example: before and after
Before: "Summarize this report." You get a generic paragraph. After: "Summarize this report for the finance director in three bullets. Focus on cost changes and risks. Skip background. Report: ..." Now the model knows who, how long, what to focus on and what to skip. A good checklist: who is it for, what do you want, how long, what format, what to avoid, and what the inputs are.
One example beats a paragraph of description
If you want a specific style, paste one example of it. Showing is faster and clearer than explaining. If the output is still wrong, ask what the prompt failed to say, not what the model did wrong.
Why vague prompts fail
A model predicts the most likely useful answer given your words. When the words leave gaps, it fills each gap with the most typical choice. "Write a birthday message" leaves open who it is for, the tone, the length and the relationship. The result is the average birthday message. Every detail you add removes one guess. That is why a prompt with an audience, a length and a purpose beats a clever phrase.
A second example: when more words cannot help
Ask "What was our revenue last quarter?" with no document attached. No wording can fix this, because the model does not have the number. The symptom is a confident, specific figure that is invented. The fix is to supply the input, such as the report itself, or to accept that the model cannot know. If you see made-up details, check first whether the prompt gave the model what it needed to answer.
Change one thing at a time
To see whether a rewrite helps, keep the test inputs fixed and change only one part of the prompt. Use ten inputs and mark each answer pass or fail against three yes or no rules you wrote first, such as "under 50 words", "mentions cost" and "no jargon". Invented example: version one passes 4 of 10 and version two passes 7 of 10. Run each version twice, because the model picks words with some randomness, so the same prompt can give different answers on different runs. With only ten inputs a gap of a few passes can be luck. If two changes happen together, you cannot tell which one helped.
Common mistakes
Writing very short prompts and expecting mind-reading. Stacking many unrelated tasks in one prompt. Testing on only one input.
Where this connects
How do you know a new prompt is better? Run it on a fixed set of examples and count. That habit is the subject of Why evals come first, later in the path. You can start with ten examples today.
Two people ask for a birthday message. One types "write a birthday message". The other types "write a warm, funny two-sentence message for my 70-year-old grandfather who loves fishing". The second prompt costs ten more seconds and gets something you could actually send. The model is the same. The difference is what you told it.
Check yourself
Which change usually helps a vague prompt most?
Not quite. The model cannot guess your audience or format. Stating them and showing one example removes ambiguity.
Where should a long document go in a prompt?
Not quite. Long inputs first and the question last, with clear delimiters, tends to work better.
A prompt gives you a good answer on the first test input. What should you do next?
Not quite. One input hides problems that varied inputs reveal.
You got 0 of 3 right.
Go deeper
- Course
Anthropic · Nine notebook chapters with exercises, from basics to tool use.
- Docs
Anthropic · Official techniques and when each one applies.
- ArticlePrompt Engineering GuideArticle
DAIR.AI · Large, regularly updated reference of techniques with papers.
- Repo
DAIR.AI · The source behind the guide, with notebooks and course material.
Spotted a mistake or something unclear? Report it on GitHub.