A reliable prompt has five parts: a role when it helps, the context the AI cannot guess, one clear task, the format of the answer, and constraints that say what to avoid and what to do when unsure. Fill them in, and most vague answers disappear.
Most weak AI answers come from the same place: the prompt left out something the AI could not guess. The formula below gives you five parts to check before you send. It works in Claude, ChatGPT, Gemini and Grok, and it works for a single question as well as for an AI agent.
The formula at a glance
- Role: the perspective to take, when it helps.
- Context: what the AI cannot guess.
- Task: the one thing to do.
- Format: what the answer should look like.
- Constraints: limits, exclusions and what to do when unsure.
You do not need to label the parts, though labels make long prompts easier to scan and edit. You do need to know which part you are writing at any moment. The sections below explain each one, with a weak and a strong example.
1. Role
A role gives the answer a viewpoint. "You are an experienced editor" shapes how feedback is written. "You are a careful analyst who reads for risks" changes what gets noticed in a report.
Use a role when it changes the result. Skip it when it does not. A role without a goal tends to produce a polished but unfocused answer, so always pair a role with a task and an audience.
Weak: "Act as a marketing expert."
Strong: "You are a marketing editor. Review the landing page text below for a busy small-business owner and point out where it is unclear."
The strong version also tells the AI who the reader is, which helps more than the role itself.
2. Context
Context is everything the AI cannot guess: who the result is for, what already exists, what you tried, what matters and what is true about your situation. It is the part people leave out most often, and the part whose absence produces generic answers.
A useful test is to imagine handing the prompt to a capable stranger. Could they do the work, or would they need to ask you five questions first? Put those answers in the prompt.
Weak: "Write an email asking for payment."
Strong: "Write an email to a client who is two weeks late paying an invoice. We have worked together for two years and want to keep the relationship. The invoice is for design work and the payment terms were 14 days."
Context also includes source material. If you want the AI to work from a document, paste it or attach it, and label it. Do not assume it knows your files, your company or recent events.
3. Task
The task is the one thing you want done. Write it as an action with a clear result: summarize, compare, rewrite, list, draft, check, translate, classify. Avoid vague verbs such as "look at", "help with" or "improve" without saying how.
Keep to one main task per prompt, or number the tasks. If you pile several unrelated requests into one message, the AI may do some well and skip others.
Weak: "Help me with this report."
Strong: "Summarize the report below in five bullet points for a manager, then list the two decisions it asks the reader to make."
If a task is large, split it into steps and say so: "Step 1: list the main arguments. Step 2: mark the weakest one. Step 3: suggest a counterargument." Numbered steps make the order explicit and give you something to point to when you want a change.
4. Format
Format is what the answer should look like: its structure, its length and its style. If you do not say, the AI picks a default, and the default rarely matches what you need next.
State the shape: a table with named columns, a numbered list, three short paragraphs, an email with a subject line, a JSON structure. State the length: 150 words, five bullets, one page. If another tool or person will use the answer, say how.
Weak: "Compare these three phones."
Strong: "Compare these three phones in a table with columns for price, battery, camera and weight. Below the table, add a two-sentence recommendation for someone who mostly takes photos."
If the style matters, paste a short example and say "match this style". An example communicates structure and tone better than a paragraph of description.
5. Constraints
Constraints are limits and rules: what to avoid, what to use, how far to go and what to do when information is missing. They protect you from the most common problems: invented facts, ignored requirements and answers that wander beyond the task.
Useful constraints include:
- Sources: "Use only the text below. Do not add outside facts."
- Exclusions: "Do not use jargon. Do not mention competitors."
- Limits: "Maximum 120 words."
- Uncertainty: "If you are not sure, say so. Do not guess numbers or quotes."
- Questions: "If something essential is missing, ask me before you continue."
Weak: "Write about our product's benefits."
Strong: "Write about our product's benefits using only the facts listed below. Do not add claims about speed, security or awards that are not listed. If a benefit needs a fact I did not provide, tell me instead of inventing it."
The last constraint matters most for factual work. An assistant that is told what to do when it does not know is far less likely to fill the gap with something plausible.
A reusable skeleton
Keep this in a note and fill it in. Delete any section you do not need.
Role: {role}
Context:
{context}
Task:
{task}
Output format: {format}
Length: {length}
Constraints:
- {constraint_one}
- {constraint_two}
- If something essential is missing, ask me before you continue.
When you finish, check your answer against the task and the constraints, and tell me anything you could not verify.The last line asks the AI to review its own work. It costs a sentence and often catches missing requirements before you read the answer.
Putting the parts together
Here is a complete prompt built from the formula.
You are an experienced editor.
Context: the text below is a newsletter intro for busy small-business owners who know little about accounting. The tone of our newsletter is friendly and plain.
Task: shorten the intro to about 80 words and make the main benefit clear in the first sentence.
Format: give the shortened intro, then a list of what you cut.
Constraints: keep my tone. Do not add claims. If the main benefit is unclear from the text, ask me what it is instead of guessing.
Text:
{newsletter_intro}Every part is short, and every part removes a guess. Compare it with "shorten this", and you can see why the results differ.
Diagnosing a weak answer
When the answer disappoints, change the prompt, not just your wording of the complaint. Match the symptom to the likely missing part.
| Symptom | Usually missing |
|---|---|
| Generic, could apply to anyone | Context |
| Wanders or does several things | A single clear task |
| Wrong length or shape | Format |
| Invents details or adds unwanted content | Constraints |
| Right content, wrong voice | Role or an example |
Then add the missing part and run the prompt again. If you work with the same kind of task often, save the improved version as a template.
Adapting the formula to different tasks
The five parts stay the same, but the weight shifts with the kind of work.
Writing. Context and format carry the most. Say who will read the piece, what tone fits, how long it should be and what material to use. Add a constraint against invented statistics or quotes.
Analysis and research. The task and the constraints matter most. Ask for a specific question to be answered, tell the AI to use only the material you provide, and ask it to separate findings from interpretation. Add a rule for sources: name them, or say there is none.
Code. Context decides the quality. Give the language, the framework, what the code should do, what it does instead and what you already tried. Ask for the cause before the fix, and for a way to confirm that the fix works.
Agents. Every part gets stricter. The task becomes a goal with a definition of done, the constraints include approval points and limits, and the format includes a report on what the agent verified. The agent guide shows how.
How much detail is enough
A prompt does not need to be long. It needs to be complete. A useful rule is to add detail only where a wrong guess would cost you something. If the audience is obvious and the format does not matter, leave them out. If a wrong assumption would force you to redo the work, put the answer in the prompt.
If you are unsure, start with a short version, read the answer and add the part whose absence you can see. After a few rounds you will know which details your tasks always need, and you can save them in a template.
Next steps
Try the formula on a task you do every week, then compare it with your old prompt. The Article from an Outline, Rewrite in a Target Tone of Voice and Product Description templates use it with variables to fill in. For longer, multi-step work, read How to Write Prompts for AI Agents. To see which parts people most often skip, read 10 Common Prompt Mistakes.
Try these templates
Article from an Outline
Turn a rough outline into a complete article with the audience, tone and length you choose.
Rewrite in a Target Tone of Voice
Rewrite existing text in a defined tone while keeping the meaning, facts and length.
Product Description
Write a clear product description that leads with benefits and uses only the facts you provide.
Frequently asked questions
Do I need all five parts in every prompt?
No. A quick question may need only a task and a format. Use all five for work that matters or that you will repeat. The task is the only part you should never skip.
Does the order of the parts matter?
Mildly. A common order is role, context, task, format, constraints. If you include a long document, put it before the task. Clear labels matter more than the exact order.
Is a role always useful?
No. A role helps when it changes the answer, such as an editor giving feedback. A role with no goal or audience often adds polish without direction, so lead with the task instead.
How do I know which part is missing when an answer is poor?
Match the symptom to the part. Generic answers usually lack context. Wandering answers lack a clear task. Wrong shape means no format. Unwanted content or guesses mean missing constraints.
Can I reuse the formula as a template?
Yes. Keep the skeleton in a note, fill in the parts each time and keep the fixed parts unchanged. The templates in the library are built this way.
Keep reading
10 Common Prompt Mistakes and How to Fix Them
Ten mistakes that make AI answers vague, wrong or unusable, each with what it looks like, why it fails and a before-and-after fix.
How to Give a Task to an AI Agent: A Checklist
An eight-point checklist for briefing an AI agent, a ready brief you can copy, and a method for reviewing what the agent hands back.
How to Write a System Prompt for an AI Agent
What a system prompt is, the seven sections to include, a complete worked example and a simple way to test and improve it with a few test cases.
