The Anatomy of a Perfect AI Prompt (With Examples)
The difference between a useless AI answer and a genuinely good one is rarely the model. It's the prompt — and specifically, whether the prompt contains the six parts the model needs to do the job properly.
Not every prompt needs all six. But when an answer disappoints, the cause is almost always one of these parts missing. Learn the anatomy once and you can diagnose any prompt in seconds.
The Six Parts
1. Role — who the AI should be
"You are an experienced HR manager at a mid-sized company" produces measurably different output from a bare question. Role sets vocabulary, priorities and level. One sentence is enough.
2. Task — the verb and the deliverable
The single most important part. "Write a 200-word summary" beats "can you help me with this text". Use a concrete verb — write, rank, rewrite, extract, critique — and name the deliverable.
3. Context — what the AI can't know
The model knows the world; it doesn't know your situation. Audience, purpose, what happened before, constraints from your company. Two or three sentences of context eliminate most generic answers.
4. Format — what the output should look like
Table, bullet list, email, JSON, one paragraph. If you don't specify, you get the model's default (usually a long essay). If you'll paste the result somewhere, say where — "formatted as a Slack message" changes everything.
5. Examples — one sample of "good"
The highest-leverage part that almost nobody uses. One example of the tone or structure you want ("here's a past post that worked — match this style") outperforms three paragraphs of description.
6. Constraints — what to avoid
Length limits, banned phrases ("no 'in today's fast-paced world'"), things to leave out, lines not to cross. Constraints are how you encode taste.
Before and After
Before: "Write a LinkedIn post about our new product."
Result: 300 words of generic enthusiasm with twelve emojis and "game-changer" twice.
After: "You are a B2B marketer who writes in plain, confident language (role). Write a LinkedIn post announcing our scheduling tool for clinics (task). Audience: clinic managers in South Asia who currently coordinate rosters on WhatsApp; the pain point is double-booked staff (context). Under 120 words, hook in the first line, one call to action (format). Match the tone of this post: [paste] (example). No emojis, no 'revolutionise', don't mention competitors (constraints)."
Result: something you'd actually publish — usually on the first try.
The second prompt takes ninety seconds longer to write and saves four rounds of "no, not like that". That trade is the entire skill of prompting.
When You Need Less
Simple factual questions need none of this — "what's the capital of Australia" doesn't want a role play. The anatomy matters when output quality matters: anything you'll send, publish, or decide from. For everything in between, Task + Context + Format is the reliable minimum.
If you want the named frameworks people wrap around these parts — RTF, CO-STAR, chain-of-thought — we've compared them in Prompt Frameworks Explained. And if your prompts keep failing in the same way, the diagnosis is probably in Why Your AI Prompts Don't Work.
Or Let the Structure Be Done for You
We built Cocoon's free Prompt Builder around exactly this anatomy: it walks you through role, task, context, format and constraints with simple questions, then assembles the finished prompt for you to copy into any AI tool. It also includes a library of ready-made prompts for common work tasks — useful as examples of part 5, or as starting points you edit.
No signup, works with ChatGPT, Claude, Gemini or anything else. Build your next prompt here.
Cocoon builds free AI tools and runs practical AI training for professionals and teams across Sri Lanka and Southeast Asia. Try the free tool from this article or talk to us about training.