AI School · Level 2 · Lesson 1

Anatomy of a good prompt

Léelo en español →

A prompt is not a magic phrase. It is a brief, and a brief is judged by the same things as any brief you give somebody: whether it is clear what you want, who it is for, what shape it should take, and what to do when a piece of information is missing.

The piece almost nobody writes is the one that changes the answer most. It is not "act as an expert pharmacist" — it already does that the moment you ask about pharmacy — it is "if anything is missing, tell me instead of assuming it". Without that line the model answers what it knows and what it does not with exactly the same confidence.

The five pieces, by what leaving them out costs you

PieceWhat happens without it
The task
critical
With no verb there is no prompt: there is a topic. Given a topic the model writes an encyclopaedia, which is the least useful thing with somebody waiting.
What to do when it does not know
high
It fills the gap. Not out of dishonesty: nobody told it that "I do not know" was an answer it was allowed to give.
The context
high
It answers about the average case. The average case does not walk through your door.
The format
medium
You get prose, and prose has to be re-read. Re-reading at the counter costs time.
The role
low
Almost nothing — and it is the piece prompt guides put first. It sets who it is talking to, not how accurate it is.

Write it piece by piece

Fill in whatever you like and press the button. Below you get the assembled prompt and, under it, what you left out and what that costs you.

Where it speaks from. The piece that changes the answer least.
Who will read it, what you already know, the source text.
The verb: summarise, compare, extract, rewrite, check.
Table, three bullets, 80 words, one sentence.
The instruction that lets it NOT answer.

Your prompt

What is missing

What this exercise does NOT check

Whether the prompt is any good. It checks that the five pieces are there, which is necessary and not sufficient: a prompt with all five can ask for something a model should not be asked — that is what the risk traffic light decides — and an answer with flawless shape can still be wrong, which is what checking it decides.

And the identifier detector catches the obvious: an ID number, a national insurance number, a phone, an email, a date of birth. It does not catch — and cannot — "the lady from the third floor who comes in on Tuesdays", which identifies just as well and is far more common. That is why the judgement lives in the first lesson and not in a detector.

Four shortcuts that do work

A full example, and what is wrong with it

The table above says what each missing piece costs. This example shows it, which is a different thing: the same query written both ways, with both replies underneath. Same case, same model, same day.

Short version: "What can I give somebody with a dry cough?"

Version with the five pieces: "You are a community pharmacist in Spain. An adult comes in asking for something for a dry cough of three days, no fever. Give me, in three bullets, what to ask before dispensing, what over-the-counter options there are, and when to refer. If you are missing any fact you need to decide, tell me instead of assuming it."

What it replies

What the short version replies. For a dry cough, the usual options are antitussives such as dextromethorphan, or pharmacy-only formulations, as well as preparations containing cloperastine. Soothing lozenges and good hydration can also help. It is important to keep the air humid and avoid irritants such as tobacco. If the cough lasts more than two weeks, it is advisable to see a doctor.

What the long version replies. Before dispensing, ask: whether the cough is genuinely dry or productive, what medication they take — particularly ACE inhibitors, which cause a dry cough — and whether there is known asthma, COPD or allergy. Over-the-counter options: licensed antitussives per each product's information and demulcents, weighing interactions and drowsiness. Refer if there is fever, breathlessness, chest pain, blood-stained sputum, weight loss, a cough of more than three weeks, or if it is an infant. I am missing something to be precise: you have not told me what else this person takes, or whether there is a pregnancy.

And now, what is wrong with that reply:

  1. The short one is not wrong. It is beside the point. Everything it says is true and none of it helps the person in front of you: it gives you a tour of the options when what you needed was what to ask first. And because there is no error, nothing warns you that you have been handed something else. This is the real cost of leaving out the task — not a worse answer, but an answer to a different question.
  2. With no context, it invents the context. Notice the short one mentions codeine without asking the age, and codeine is not for everybody. It is not that it got it wrong: nobody told it who the patient was, so it took the average one — adult, nothing else going on, no pregnancy, no other medication. The average case does not walk through your door, and the model has no way of knowing that yours is not it.
  3. Format is not decoration: it is counter time. The short one is six lines of prose you have to reread to extract three things. The long one is three bullets you can take in at a glance with somebody waiting. The difference is not in what the model knows: it is that one of them can be used standing up and the other cannot. In that situation, a paragraph you have to reread is a paragraph that does not get read.
  4. And the last line of the long one is what the exercise is for. "I am missing something: you have not told me what else they take or whether there is a pregnancy." That is what a colleague does and what a model never does unless you ask it to — because answering fits better than asking. It costs eleven words in the prompt and it changes what the tool is: it goes from always giving you an answer to telling you when the answer cannot be given yet.

Now one important thing about this example, so as not to draw the wrong conclusion: the long version is not a "better prompt", it is a different request. The short one asked for a tour of the options and delivered one. If the tour was genuinely what you wanted, it was perfect.

The question to ask while writing is not "is my prompt well phrased?" but "have I said what I want to do with the answer?". The five pieces fall out of that on their own, and that is why the composer above does not fill them in for you.

And if your pharmacy is not like that

If the answer is for you and you will read all of it. Then three of the five pieces are surplus and that is fine. The task and what to do when it does not know will do: format does not matter because you will read it anyway, the role changes nothing, and you supply the context mentally as you read. Writing five pieces to ask yourself a question is ceremony, and ceremony gets abandoned by the third time.
If a patient is going to read the result. There the two pieces that govern are context and format, and you have to be far more specific than you would think: "for an older person who reads with difficulty, sentences under fifteen words, no jargon, no abbreviations". Without that you get a correct, university-level text. And then the Level 1 check remains: simplifying eats the caveats, so the text gets reread against the leaflet.
If you will repeat the same request every week. The monthly poster, the new-products summary, the email to the supplier. Write it once with the five pieces and keep it in a note, with a gap where the changing part goes. That is the difference between rethinking it every time — and therefore leaving out a different piece every time — and pasting and filling in. This is where the anatomy stops being theory: it is not for writing better, it is for not writing it again.
If several of you use the same request. Then the piece to fix as a house rule is what to do when it does not know, because it is the one nobody writes unprompted and the one that prevents the real problem. A shared prompt with that line in it, taped next to the computer, is worth more than explaining the concept. The rest — role, format — let each person adjust for their own use; changing those does no harm.
If you are starting out and will only remember one thing. Make it pasting the text instead of describing it. It changes the result more than any of the other three shortcuts and requires understanding nothing: "summarise this leaflet" with the leaflet below and "summarise the leaflet for X" are two different tools — in the second the model writes from memory, and memory is where inventions come from. If a month from now that is the only habit you have picked up, you have removed half the problems in the whole of Level 1.

When it does not work first time

I write all five pieces and the answer is still generic.
Look at the context: nearly always it is written in the abstract. "An elderly person" is generic; "a woman of about 80, on the long-term treatment I am pasting below, who comes in alone and cannot remember the names" is specific — and the second carries no identifier at all, which is the balance from Level 1 lesson 1. And paste the source text rather than describing it: half of all generic answers are answers written from memory.
I tell it to say when a fact is missing and it never does.
Usually for two reasons, and both are fixable. One: the instruction is at the end, behind a very specific question that "pulls" the answer along — move it up. Two: you have not told it which facts you would consider essential. "If something is missing, tell me" is vague; "do not decide without the age, the renal function and the rest of the medication: if I have not given them to you, ask me" is an instruction that can be followed.
My prompt fills half the screen and I cannot face writing it.
Then you are writing it every time, which is a method problem, not a length one. The five pieces get written once per type of request — extract, summarise, write for a patient — and after that you paste the template and change the middle. And if it is still long: drop the role and the format, which are the two cheapest pieces to lose. The task and the "what to do when it does not know" do not get dropped.
I have seen pharmacy prompt templates online. Should I use them?
Use them as examples and read them with this lesson in mind: nearly all of them carry three pieces of role and none of "what to do when it does not know". "Act as an expert pharmacist with twenty years of experience" takes a whole line and changes almost nothing. If a template saves you writing the format and the context, good; if what it gives you is adjectives, it is missing exactly the part that matters and you will use it believing you are covered.
I ask for one thing and it answers three.
The opposite of the usual problem and it has the same root: a request with no format gets padded out to wherever the model thinks it is expected to stop. State the size and the number — "three bullets, nothing else" — and it ends. And if what is surplus is the courteous preamble ("certainly, here you go…"), ask it to start straight in with the content: in a counter query those two lines are what make you scroll before finding what you came for.

Before you call this learned

← Back to the school Next: summarising a research paper →