How to write better AI prompts: a five-part template
Good prompts are clear, not clever. Here is a five-part template you can reuse, an example you can adapt and what the official prompting guides actually recommend.
Why prompts matter
An AI assistant only knows what you tell it. Anthropic's guide suggests thinking of the assistant as a capable new colleague who lacks context on your norms and your workflow, and says a useful check is to show your prompt to a colleague who knows nothing about the task and see whether they could follow it. If a person would be confused, the assistant may be too.
The five-part template
| Part | What to write | Example |
|---|---|---|
| 1. Role | Who the assistant should be, in a sentence. | You are a friendly travel planner who knows India well. |
| 2. Task | The one thing you want done. | Plan a 3-day trip to Udaipur. |
| 3. Context | Facts it cannot guess: dates, budget, who is travelling, limits. | Two adults, one senior, mid-December, budget of about ₹25,000, no long walks. |
| 4. Format | How the answer should look and how long it should be. | A day-by-day table with morning, afternoon and evening, under 300 words. |
| 5. Check | How it should handle gaps and what to avoid. | Ask me up to three questions first. Mark anything you are unsure of. |
Anthropic's documentation lists giving a role, adding context, using examples and being specific about format as separate techniques. OpenAI's guide lists an identity, instructions, examples and context as the usual sections of a developer message. The five parts above combine both into one simple order for everyday use.
A full example
You are a friendly travel planner who knows India well.
Task: plan a 3-day trip to Udaipur.
Context: two adults and one senior, mid-December, budget about ₹25,000 in total, no long walks, vegetarian food.
Format: a table with one row per day and columns for morning, afternoon and evening. Keep it under 300 words.
Check: ask me up to three questions first if anything is missing. Mark any price, timing or fee you are not sure about so I can verify it.Change the details and the same shape works for many jobs, such as drafting a letter, summarising notes or comparing two products.
What the official guides recommend
- Give a role, even briefly. Anthropic says setting a role focuses the assistant's behaviour and tone, and that even a single sentence makes a difference.
- Say what to do, not only what to avoid. Anthropic's example: instead of "Do not use markdown", ask for "smoothly flowing prose paragraphs".
- Be specific about format and constraints. Both guides recommend stating the output format you want.
- Show examples when format matters. Anthropic calls a few well-chosen examples one of the most reliable ways to steer tone and structure and suggests three to five varied ones. OpenAI also recommends showing a diverse range of inputs with the desired outputs.
- Use numbered steps when order matters. Anthropic suggests sequential steps when the order or completeness of steps matters.
- Test and refine. Both guides treat prompts as something you test and improve, not something you get right on the first try.
Neither guide says that you need a secret code or magic word. They describe clear instructions.
Common mistakes
- Too vague. "Write about Goa" leaves everything open. Say who it is for, how long it should be and what tone you want.
- Hidden context. If the answer depends on your budget, dates or limits, write them down.
- No format. Without one you may get a long essay when you wanted a list.
- Too many tasks. Split big jobs into steps and check each one. Anthropic notes that asking the assistant to draft, review and then improve its own work is a common pattern.
- Trusting the first answer. Check facts, figures and dates yourself, especially prices and rules.
Protect your privacy
The official prompting guides we read focus on getting better answers and do not give general advice about personal data, so this part is our own common-sense advice. Leave out passwords, card and bank details, Aadhaar and passport numbers, and private health records. Replace real names with labels such as "Client A" when you can. Read the privacy settings of the service you use, because policies differ and change.
A quick checklist
- Start with a one-line role.
- State one clear task.
- Add the context a stranger would need.
- Say how the answer should look and how long it should be.
- Ask the assistant to flag anything it is unsure about.
- Read the answer critically, then ask for a revision instead of starting over.
Last reviewed 20 November 2026. AI tools, plans and prices change quickly, so check the official pages below before you rely on a detail. This guide is general information, not advice.
Frequently asked questions
Do I need special words or secret codes in prompts?
No. The official guides from Anthropic and OpenAI describe clear instructions, context, format and examples, and neither says special codes are required.
Does giving the AI a role really help?
Anthropic says setting a role focuses the assistant's behaviour and tone, and that even one sentence can make a difference. It is one technique, not a requirement.
How many examples should I include?
Anthropic suggests three to five varied examples for best results when format and tone matter. OpenAI does not give a number.
Should I tell the AI what not to do?
It is usually more effective to say what you want. Anthropic suggests asking for the style you want instead of only forbidding the one you do not.
Can I reuse the same prompt in different assistants?
Mostly yes, because clear prompts transfer well. Assistants differ, so test it and adjust the wording.
Is it safe to paste personal details into a prompt?
Avoid sensitive details, and check the privacy settings of the service you use.
Sources
Checked against these pages on 20 November 2026:
- Anthropic: Prompt engineering overview
- Anthropic: Prompting best practices
- OpenAI: Prompt engineering guide