The anatomy of a prompt: role, context, task, constraints, format
A five-part template that lifts answer quality from \"meh\" to \"useful\" on any prompt, in any AI tool. With worked examples, common mistakes, and the order that matters.
Outcome: Build prompts with role, context, task, constraints, examples, and output format instead of relying on one-off wording tricks.
After you have used ChatGPT or Claude a few weeks, you start noticing that your good prompts and your bad prompts have a shape to them. The good ones contain certain ingredients; the bad ones leave them out. Once you can name the ingredients, you stop writing bad prompts almost by accident.
The five ingredients are below, with worked examples, and then how they fit together. By the end you will have a template you can use on any prompt, in any tool, that lifts the quality of the answer from "meh" to "useful."
For recurring work, think of the prompt as a task contract. It should specify the role, context, task, constraints, output format, and how uncertainty should be handled. That makes the prompt reusable and reviewable.
The five parts
In order:
- Role — who is the AI being, for this prompt?
- Context — who you are, the situation, what has happened so far.
- Task — what exactly you want the AI to do.
- Constraints — length, tone, things to avoid, things to include.
- Format — the shape of the output you want.
All five do not appear in every prompt — a casual question does not need them all. But on any prompt where the result matters, missing one of these is usually why the answer disappointed you.
1. Role
The role is the persona, expertise, or stance you want the model to adopt. It primes the model to draw on a specific kind of pattern from its training rather than the average pattern.
Weak:
Explain pension funds.
Better:
You are a financial advisor in Estonia who specialises in helping mid-career employees plan for retirement. You explain things in plain English without dumbing them down.
>
Explain pension funds.
The model is not actually becoming a financial advisor. It is matching the style and content density of expert-financial-advisor text. The answer becomes more grounded, less hedged, and uses the vocabulary a professional would.
A few notes on roles:
- Be specific. "An expert" is weaker than "a senior tax accountant who has filed Estonian corporate returns for fifteen years."
- Specify what kind of expert. "A direct, no-nonsense personal trainer" produces different output than "an empathetic personal trainer who specialises in working with beginners."
- Roles can include disposition. "A devil's advocate," "a skeptical journalist," "a patient teacher," "a careful editor" are all valid.
- Avoid role-stacking. "You are a senior expert, world-class authority, top-tier consultant with twenty years of experience..." is noise. One concrete role is better than three abstract ones.
2. Context
Context is everything the model would need to know about your situation that is not obvious from the task itself. Your role, your team, the project you are working on, what has been tried, what failed, who the audience is, anything that affects what a good answer would look like.
Weak:
Draft a project update for my manager.
Better:
About me: I am a product manager at a B2B SaaS company in Tallinn. I have been leading a project to migrate our authentication system, which started two months ago.
>
What has happened: We hit a major issue last week with a third-party identity provider. The fix means we will deliver two weeks later than planned. The team is otherwise doing well.
>
My manager: senior product VP, prefers very direct updates, dislikes apologies and "we're committed to" filler, wants to know risks and what I'm doing about them.
>
Draft a project update.
Notice how much the answer changes once the model knows who you are, what happened, and who is reading. It is not "more context for the sake of it." Each line shapes the output.
Three things people most often forget to include in context:
- Who you are. Your role, seniority, what you do.
- What has already happened. The history, the previous attempts, the prior decisions.
- Who the output is for. The audience. Their preferences, expertise, constraints.
If you are running the same kind of prompt repeatedly — same role, same situation — put the context into a Custom GPT or Claude Project once and stop re-typing it.
3. Task
The task is the actual request. This is the part most people lead with. It is also the part that is fine the way you usually write it — "draft an email," "summarise this document," "give me three options" — provided everything else around it is doing its job.
A few task patterns that work consistently well:
- Generate variants. "Give me three drafts." "Produce five options." Variants are almost always more useful than asking for a single answer and then being disappointed.
- Interview first, then act. "Before drafting, ask me five questions you would need answered. Wait for my answers." This is the most underused task structure.
- Critique, do not rewrite. "Find what is wrong with this. Quote specific lines. Do not rewrite." Useful when you want the model to sharpen your work, not replace it.
- Compare and recommend. "Compare X and Y on these four dimensions. Then recommend one, and tell me what would change your answer."
- Apply a framework. "Analyse this using the [STAR / SWOT / RACI / Five Whys / ICE] framework."
The pattern is the same throughout: be specific about the verb you want the model to do.
4. Constraints
Constraints are restrictions on the output — length, tone, format, vocabulary, things to include, things to avoid.
Without constraints, models default to the safest, longest, blandest response. They pad. They hedge. They include unnecessary preambles. Constraints are how you get the response you actually want.
Useful constraints:
- Length. "Under 100 words." "Three sentences max." "One paragraph." "Two pages." Length is the single biggest quality lever and the most under-applied.
- Tone. "Warm but professional." "Sharp and direct." "Conversational, slightly self-deprecating." "Match the tone of [paste example]."
- Vocabulary. "Do not use the words 'leverage,' 'utilize,' or 'going forward.'" "Avoid jargon." "Use only words a 12-year-old would understand."
- Format-level constraints. "No preamble." "No closing summary." "Don't start with 'Great question.'"
- What to include. "Include one specific example." "Reference the data I just gave you."
- What to exclude. "Don't ask me to consider professional advice — I know." "Don't hedge — I want a confident answer." "Don't give me an apologetic introduction."
The negative constraints — "do not" — are often more powerful than positive ones. The model has strong defaults toward certain phrases ("I hope this finds you well," "Great question!", "It's important to note..."). Telling it not to use them is dramatically more effective than telling it what to do instead.
5. Format
Format is the shape of the output. Bullets, table, numbered list, paragraph, JSON, markdown, code block, plain text. Specifying format saves you the cleanup work later.
Examples:
Return as a markdown table with three columns: option, pros, cons.
Return as a JSON object with the keys "summary," "decisions," and "open_questions."
Return as three short paragraphs, no headings.
Return as a numbered list of five items, each one sentence long.
A particularly useful pattern when you want to use the output downstream (paste into a doc, feed into another prompt, post somewhere): show the model the format with a brief template:
Return in this format:
>
Decision: [...]
>
Top three arguments for: 1. [...] 2. [...] 3. [...]
>
Top three arguments against: 1. [...] 2. [...] 3. [...]
>
What would change your answer: [...]
The model will fill in the blanks. The output is consistent and parseable.
6. Validation
The sixth part is not always part of the prompt itself, but it is part of any serious workflow: how will you know the answer is good enough?
Useful validation instructions:
If you make a factual claim, mark whether it came from the source text I provided or from general background knowledge.
If any required field is missing, write [missing] instead of guessing.Before the final answer, list the three assumptions you made.
After drafting, give me a short checklist of what I should verify before using this.
Validation matters because a polished answer can still be wrong. A good prompt does not merely ask the model to produce output. It tells the model how to expose uncertainty, missing inputs, and review points.
Putting it together: a worked example
Let's combine all five on a real task. Suppose you need to write a polite but firm reply to a client who is asking for free additional scope on a project.
Without the template:
Write a reply to my client who wants more work for free.
You get something generic. With the template:
Role: You are an experienced project manager who has worked with B2B agency clients for ten years. You are direct, friendly, and good at saying no without burning the relationship.
>
Context: I am a freelance designer. A client (a startup founder I have worked with for a year) just asked me to add two new pages to a project that is already in its final stage. The scope was clearly fixed in our contract. The relationship is otherwise good. I do not want to lose them, but I also do not want to do the work for free.
>
Task: Draft three reply versions.
>
Constraints: - Under 150 words each - Warm but unambiguous — I am saying no to free work, not negotiating - Offer a clear alternative path (e.g., a small additional engagement) - No "I hope this finds you well", no apologies for the boundary - Do not include "Best regards" or any sign-off — I'll add my own
>
Format: Three numbered versions, each labelled with its tone (e.g., "1. Warm and explanatory"), and a one-line "when to send this one" note under each.
The output of the second prompt will be three actually-useful drafts. Read each, pick one, edit lightly, send.
That is the whole game, every time.
A few patterns that combine the five
Some prompt shapes that show up over and over in good prompting:
The reverse interview. Role + context, then a task that starts with "Ask me five questions you would need answered to do this well." Lets the model help you sharpen the prompt itself.
The three-variant drafter. Role + context + "draft three versions" + length and tone constraints + numbered format. The reliable workhorse of working with AI on writing tasks.
The structured analyst. Role + context + "apply this framework" + "use this exact section structure" + format. The right shape for any analytical task.
The patient tutor. Role (a tutor) + context (you, your level) + task (teach me, quiz me) + constraints ("one question at a time, wait for me") + format (structured by phase). Combines all five and produces a useful tutoring loop.
You will develop your own. The point is that the patterns are all variations of the same template — five ingredients, in the order that works.
A small habit that compounds
After any meh AI answer, pause for two seconds. Ask: which of the five did I leave out?
- Did the model not know who it was being? → role.
- Did it not have my situation? → context.
- Did it misunderstand the verb? → task.
- Was the output too long, too formal, too padded? → constraints.
- Was the shape of the answer the wrong shape? → format.
You will almost always find a missing ingredient. Add it, regenerate. Within a couple of weeks the additions become automatic, and you will have learned more about prompting than any course could teach you — because you will be diagnosing your own real prompts in real situations.
That is the whole anatomy. Five parts plus validation. Use them deliberately for a month and they become permanent.