BeginnerLesson 2 of 305 min read

The anatomy of a prompt: role, task, context and format

Learn the four parts most strong prompts share, how to order them, and how to diagnose a weak answer by finding the missing part.

In this lesson you will

  • Name the four parts of a prompt
  • Write each part clearly
  • Diagnose a weak answer
  • Build a prompt from stored parts

About 15 minutes

A recipe has ingredients; so does a prompt

Farhan runs a small bakery and asks an AI for help with a customer email. His first try, reply to this complaint, gets a stiff, apologetic essay that promises a refund he never wanted to give. His second try, which tells the AI who it is, what the goal is, what happened, and how the email should look, gets a short, warm message that offers a replacement. He did not become cleverer between tries. He just included the four parts that most strong prompts share.

The four parts: role, task, context, format

Part Question it answers Example
Role Who should the AI act as? You are a patient maths tutor for 12-year-olds.
Task What exactly should it do? Explain how to add fractions with different denominators.
Context What does it need to know? The student gets confused by the word ‘common denominator’. Use baking examples.
Format What should the answer look like? Three short steps, then one practice question with the answer hidden.

You do not need all four every time. A quick question may need only a task. But when an answer disappoints you, check which part is missing. Most failed prompts are missing context or format.

Part 1: Role

A role gives the model a point of view and a level of expertise: You are an experienced travel agent, You are a strict proofreader, You are a beginner-friendly coding teacher. It shapes vocabulary, depth and tone. A role works best when it implies standards. “You are a helpful assistant” adds almost nothing because it is the default. “You are a copy editor who removes filler words and keeps sentences under 20 words” adds a lot.

Part 2: Task

The task is the action, stated with a clear verb: summarise, compare, rewrite, list, explain, draft, classify, translate, plan. Give one main task per prompt when you are starting out. If you ask for five things at once, the model often does the first well and rushes the rest.

Part 3: Context

Context is everything the model cannot know without being told: who the audience is, what has already happened, what you tried, what is true about your situation, what to avoid. It also includes material to work from, such as an email you pasted or notes you wrote. Good context is specific and relevant. Do not paste your whole life story; give what changes the answer.

Part 4: Format

Format is the shape of the answer: length, structure, order, tone, style, language. Examples: three bullet points, a table with columns Name, Price and Reason, under 100 words, plain language a 10-year-old would understand. If you do not specify, you get the model’s default, which is often longer and more general than you wanted.

Putting the four parts together

ROLE: You are a friendly customer-care writer for a small bakery.
TASK: Write a reply to the customer message below.
CONTEXT: The customer's birthday cake arrived with a cracked top. We want to keep her as a customer. We can offer a free replacement cake or a 30 percent refund, her choice. Do not blame the courier.
FORMAT: Under 90 words, warm and professional, no exclamation marks, end with a clear question asking which option she prefers.

Customer message: "My cake arrived cracked and I'm very disappointed."
Dear Mrs Khan, I am very sorry that your birthday cake arrived with a cracked top. That is not the experience we want for you. We would be glad to make it right. We can send a free replacement cake, or refund 30 percent of the price. Which would you prefer? Kind regards, Farhan's Bakery
Good to know

The labels ROLE, TASK, CONTEXT and FORMAT are not required. They just make the prompt easy for you to read and edit. Plain sentences work equally well.

Seeing the parts in code

Because prompts have parts, you can store them separately and join them. This is how teams build reusable templates. This small program does exactly that and was run for real:

parts = {
    "role": "You are a friendly school office assistant.",
    "task": "Write a 60-word announcement about the science fair.",
    "context": "Audience: parents. Date: Friday 14 March, 10 am to 1 pm, main hall.",
    "format": "One paragraph, no emojis. End with the registration deadline: Wednesday.",
}
order = ["role", "task", "context", "format"]
full = "\n".join(parts[k] for k in order)
print(full)
print()
print("Words:", len(full.split()), "| Parts:", len(parts))
You are a friendly school office assistant.
Write a 60-word announcement about the science fair.
Audience: parents. Date: Friday 14 March, 10 am to 1 pm, main hall.
One paragraph, no emojis. End with the registration deadline: Wednesday.

Words: 38 | Parts: 4

An order that works

A good order is: role first (sets the stage), task next (the main instruction), context (the details), format last (the shape of the answer). Putting the format at the end keeps it fresh in the model’s attention. If you paste a long document, a common pattern is to put the instructions first and the document after clear markers, then repeat the key format request at the end.

Diagnosing a weak answer

Symptom Likely missing part Fix
Generic, could be about anyone Context Add specifics: audience, situation, facts
Wrong style or too formal Role or format Name the voice and give a tone
Too long or too short Format Set a word count or number of items
Did something else Task Use one clear verb and say what to produce
Messy layout Format Ask for a table, bullets or numbered steps
Common mistake

Stuffing every part with long text. A short role, a clear task, the facts that matter and a precise format beat a wall of words.

Use the four-question check

Before you press enter, ask: Who is it? What must it do? What does it need to know? What should the answer look like? If you can answer all four, your prompt is ready.

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

Which are the four common parts of a strong prompt?

  1. Title, body, link, image
  2. Role, task, context, format
  3. Name, age, city, job
  4. Start, middle, end, thanks

These four answer who, what, what to know and what shape.

What does the format part control?

  1. The AI’s speed
  2. The language of the app
  3. The shape, length and tone of the answer
  4. Your password

It tells the model how to present the result.

An answer is generic and could be about anyone. What is probably missing?

  1. Context
  2. A longer role
  3. More exclamation marks
  4. A different browser

Specific facts make answers specific.

Why give one main task at first?

  1. The AI can only read one word
  2. Tasks must be numbered
  3. Multi-task prompts are often rushed or uneven
  4. It saves money

Focus improves quality.

Where does a good prompt usually put format?

  1. Near the end
  2. Never
  3. Only in the title
  4. Inside the context

Ending with the format keeps it fresh.

Summary

  • Strong prompts often contain role, task, context and format.
  • Missing context and format cause most disappointing answers.
  • Keep each part short and specific.
  • Store parts separately to build reusable templates.

Next lesson

Next: writing clear instructions, the words that remove ambiguity.

Questions

Do I need all four parts every time?

No. Quick questions may need only a task. Add parts when an answer is not what you wanted.

Is the role really necessary?

Not always, but a specific role with standards can improve tone and depth. A generic role adds little.

Should I label the parts?

Labels are optional. They help you read and edit long prompts.

Progress is saved in this browser.