Anatomy of a good prompt: role, context, task, constraints
Type "write me a post about coffee" into ChatGPT and you get something forgettable: a generic blurb that opens with "Coffee is one of the world's most beloved beverages." It's not wrong. It's just useless.
Now try this instead:
You are a copywriter for a small specialty coffee roaster. Write a 120-word Instagram caption for our new Ethiopian single-origin beans. Audience: home brewers who care about flavor, not jargon. Tone: warm and a little playful. End with a soft call to actioncall to actionA button, link, or message that prompts users to take a specific action such as sign up, buy, download, or learn more.View full definition → to visit our shop.
The second prompt produces something you could actually publish: a specific voice, the right length, a clear ending. Same model, wildly different result. The only thing that changed was the prompt (the instructions you give the AI).
That difference is not luck. It comes from four ingredients you can add to any request.
The four-part template
Every strong prompt tends to include four things:
- Role: who the AI should act as.
- Context: the background and audience it needs.
- Task: the specific thing you want done.
- Constraints: the limits and format.
You don't always need all four, but when an output disappoints, a missing piece is usually why. Let's take them one at a time.
Role: Tell the AI who to be
A role sets the perspective and vocabulary the model uses. "You are a tax accountant" and "you are a stand-up comedian" will explain the same topic in completely different ways.
Examples you can drop in:
- "You are a patient middle-school science teacher."
- "You are a senior recruiter reviewing resumes."
- "You are a friendly nutritionist, not a doctor."
The role is a quick way to aim the tone and depth. Without it, the model defaults to a bland, average voice.
Context: Give it the background
Context is everything the AI can't guess: who the output is for, what came before, what matters to you.
Compare:
- Weak: "Write a follow-up email."
- Strong: "Write a follow-up email to a client named Dana who asked for a quote last Tuesday but hasn't replied. We're a web design studio. She mentioned a tight launch deadline in October."
The second version gives the model facts to work with, so it stops inventing and starts helping. A simple test: if a new freelancer couldn't do the task with the info you gave, the AI can't either.
Task: Say exactly what you want
The task is the verb: summarize, draft, compare, rewrite, brainstorm, translate. Be specific about the deliverable.
- Vague: "Help me with my presentation."
- Specific: "Write a 5-slide outline for a 10-minute presentation on remote work benefits."
One prompt, one clear job. If you need several things, list them as numbered steps rather than cramming them into one sentence.
Constraints: Set the limits
Constraints shape the final form. They include:
- Length: "under 150 words," "exactly 3 bullet points."
- Format: "as a table," "in plain text, no markdown."
- Tone: "formal," "casual," "no exclamation marks."
- What to avoid: "don't use buzzwords like 'synergy'."
Constraints are where most people leave value on the table. "Keep it to two sentences a customer could understand" turns a wall of text into something usable.
Putting it together
Here is the template as a fill-in-the-blank:
Role: You are a [role]. Context: [background, audience, relevant facts]. Task: [the specific thing to produce]. Constraints: [length, format, tone, things to avoid].
A worked example for a real scenario, writing a job description:
You are an experienced HR manager. We're a 12-person bakery hiring our first delivery driver. The role is part-time, mornings, local routes only. Write a job posting that feels warm and human, not corporate. Keep it under 250 words, use short paragraphs, and include a bulleted list of 4 requirements.
Notice you can read off all four parts. That structure is the whole trick.
Why structure beats length
A common myth: longer prompts are always better. Not true. A focused 4-line prompt beats a rambling paragraph. You're not trying to write *more*, you're trying to remove guesswork.
Think of it like ordering at a restaurant. "Food, please" forces the kitchen to guess. "A medium-rare burger, no onions, side salad instead of fries" gets you exactly what you want. The four parts are just a way to order clearly.
🎬 [VIDEO: "How to Write Better ChatGPT Prompts" - youtube.com - a short, beginner-friendly walkthrough of structuring prompts with roles, context, and constraints]
Using the template across tools in 2026
The same template works on every major assistant, with small differences in flavor.
- ChatGPT (OpenAI): Great all-rounder. Its Custom Instructions setting (under your profile) lets you store the Role and some Context permanently, so you don't retype it every time. Set "I'm a small business owner; keep answers concrete and skip the disclaimers" once and it applies to every chat.
- Claude (Anthropic): Especially strong with long documents and careful formatting. It responds very well to clearly labeled sections, so literally writing "Role:", "Context:", "Task:", and "Constraints:" as headers in your message works beautifully.
- Gemini (Google): Tightly connected to Google tools (Docs, Gmail, Search). Helpful when your Context lives in your own files. The four parts still apply unchanged.
The mindset to carry across all three: you are the director, the model is the actor. It will perform whatever role you assign with whatever context you provide. Vague direction, vague performance.
For more structured examples to copy, the OpenAI prompt examples library is free and a useful place to see patterns.
The same idea in code
If you ever call a model through an APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → (a way for programs to talk to the AI directly), the four parts show up as clean, separate fields. This Python snippet uses the OpenAI library, but the structure is identical to what you'd type by hand:
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-5.1",
messages=[
# Role + Constraints often live in the "system" message
{"role": "system", "content":
"You are a friendly nutritionist, not a doctor. "
"Keep answers under 100 words. Avoid medical jargon."},
# Context + Task go in the "user" message
{"role": "user", "content":
"I'm a busy parent who skips breakfast. "
"Suggest 3 quick, healthy breakfast ideas under 5 minutes."},
],
)
print(response.choices[0].message.content)You don't need to code to use the template. But seeing it laid out this way shows that "system" (role and rules) and "user" (context and task) are the same four ingredients, just sorted into boxes.
Knowledge check
1. According to the lesson, why does a detailed prompt produce dramatically better results than a vague one like 'write me a post about coffee'?
2. What is the primary purpose of adding a 'Role' to a prompt?
3. The lesson offers a 'simple test' for whether you've given enough context. What is it?
4. Select ALL statements that correctly describe the four-part prompt template.
Select all the correct answers.
5. Select ALL examples that demonstrate strong CONTEXT rather than a weak, vague request.
Select all the correct answers.
Common mistakes and quick fixes
Mistake: Asking for everything at once.
"Write a business plan, a logo idea, a tagline, and a budget." Break it into separate prompts. The model does each better when it focuses.
Mistake: No audience.
"Explain inflation." For whom? Add "to a 10-year-old" or "to a finance student." Audience is the fastest quality boost you can add.
Mistake: Forgetting the format.
If you wanted a table and got paragraphs, you didn't ask. Add "as a table with columns for X and Y."
Mistake: Accepting the first draft.
The prompt is a conversation starter, not a one-shot. Follow up: "Make it shorter," "More casual," "Add an example." Iterating is normal and expected.
A two-minute practice
Take any real task on your plate right now. Fill in the four blanks:
- Role: _______
- Context: _______
- Task: _______
- Constraints: _______
Paste it into ChatGPT, Claude, or Gemini. Then do the lazy version ("write me X") and compare. The gap you see is exactly the value of this lesson.
Key Takeaways
- Use the four parts: Role, Context, Task, Constraints. Add them whenever an output disappoints, and find the missing piece.
- Be specific, not long. Clarity beats word count. Remove the model's need to guess.
- Always name the audience and the format. These two additions fix most weak outputs instantly.
- You're the director. The model performs the role and context you give it, so give clear direction.
- Treat it as a conversation. First drafts are starting points; follow up to refine.
What to do, from this lesson
These actions are compiled in the role's Playbook.
- Structure prompts with role, context, task, and constraints
- Name the audience explicitly in every prompt
- Split multi-part requests into one job per prompt
Related articles
Recent articles from the blog that build on this lesson.
- AIAI skills that stay relevant as tools changeThe specific AI tools you use today will look very different in two years. The professionals who keep their edge are building skills that transfer across every version of every tool.
- AIRight context, wrong assumption: what Morgan Stanley learned about prompting at scaleMorgan Stanley's deployment of an AI assistant for its financial advisors exposed a problem most teams overlook: feeding the model more information does not produce better answers. The real discipline is selecting which context matters, and why that distinction changes how you build prompts entirely.
- AIHow Klarna rewired its support operations with disciplined prompt engineeringKlarna's AI deployment in customer support became one of the most cited cases of LLMs producing measurable operational results. The prompt discipline behind it offers concrete lessons that transfer well beyond fintech.