Prompt foundations

The four-part prompt

The one prompt structure worth memorising: say who the model should be, what it cannot guess, exactly what to do, and the shape of the answer you want back.

Use this when your first attempt came back generic, waffly, or the wrong shape — which is most of the time.

The pattern

Copy this and replace everything in [SQUARE BRACKETS] with your own specifics.

Prompt template
You are [ROLE — the kind of expert who would normally do this].

Context: [WHAT THE MODEL CANNOT GUESS — who this is for, what has already been decided, any constraint that matters, and the raw material itself.]

Task: [ONE INSTRUCTION, stated as a verb. Do this thing to this input.]

Format: [THE EXACT SHAPE — length, structure, headings, tone. Say what NOT to include.]

Why each part is there

Role
Picks which slice of the model's training to lean on. “A hiring manager at a mid-size Indian startup” produces different judgement from “a careers counsellor” — same facts, different priorities.
Context
The only part the model genuinely cannot invent. Most “bad AI output” is actually missing context: it guessed, and guessed wrong.
Task
Exactly one verb. Two tasks in one prompt means the model quietly optimises for whichever it saw first and half-does the other.
Format
Constrains length and structure so you get something usable instead of something you reformat by hand. Saying what to leave out is as useful as saying what to include.

Before and after

The lazy version

Write something about our new after-school coding class.

What goes wrong: No role, no audience, no length, no facts. You get five paragraphs of enthusiastic filler that mentions “cutting-edge technology” and invents a price.

The pattern, filled in

Worked example
You are a school outreach coordinator who writes to parents, not to teenagers.

Context: We run a Saturday coding club for Class 8-10 students at a CBSE school in Pune. 12 seats, 10:00-11:30am, starts 14 July, no laptop needed (lab machines provided), no prior coding experience assumed. Fee is Rs 1,200 per month. Parents' main worry, from last term's feedback, is screen time.

Task: Write the WhatsApp message parents will receive to announce it.

Format: Under 90 words. Plain sentences, no emoji spam, no exclamation marks. Address the screen-time worry in one sentence without being defensive. End with a single clear action.

What that buys you: Every fact in the output is a fact you supplied. The screen-time line exists because you named the objection. The length is short enough to actually send.

Now do it on your own work

Take the last request you made to an AI tool that disappointed you. Rewrite it with all four parts filled in — and make Context the longest section. Run both versions and keep them side by side.

Check yourself — every box should be true

  • Your Context section contains at least three facts the model could not have guessed.
  • Your Task section contains exactly one verb.
  • Your Format section names a length AND at least one thing to exclude.
  • You can point at one specific difference between the two outputs and say which part of the prompt caused it.

Then explain it back

Which of the four parts made the biggest difference to your output, and why did that particular part matter for this particular task?

Write two or three sentences in your own words. If you cannot, you copied a prompt rather than learning a pattern — which is the whole difference this library is trying to make.

Does this depend on which AI tool I use?

Every mainstream assistant responds to this structure — it is not a vendor trick. What differs is where the Role lives: tools with a custom-instructions or system-prompt field hold the Role across a whole conversation, so you state it once. Tools without one need it restated in each new chat.

Why it actually works

Why does naming a role change the answer at all? Because the model predicts the next token conditioned on everything before it — your role text literally shifts the probabilities over what comes next.

See next-token prediction for yourself

Prompting well is a skill you can pick up in a week. Understanding what is happening underneath is the 18-month curriculum — and it is what stays useful when the tools change.

FAQ

Do I need all four parts every time?
No. For a throwaway question, the task alone is fine. The four-part structure earns its keep when the output matters, when you will reuse the prompt, or when a first attempt already failed — and at that point the missing part is almost always Context.
Is a longer prompt always better?
No. Longer Context is usually better; longer Task is usually worse. Padding the instruction with adjectives like “amazing, engaging, world-class” adds no information and gives the model nothing to act on.

Next patterns

The Prompt Patterns Library is a separate, optional track — it does not change the 78-week curriculum or your roadmap. See what the curriculum actually covers →