How-to guide

How to write better AI prompts: a practical guide with examples

Most bad AI answers come from vague prompts. Learn the five-part pattern, the habits that fix common problems, and before-and-after examples you can copy.

Key points

  • Good prompts give the AI five things: a role, a clear task, the context it can’t guess, the format you want and the rules to follow.
  • Context — your facts, your notes, your examples — matters more than clever wording.
  • Showing one example of what “good” looks like often beats a paragraph of description.
  • Iterate: change one thing at a time and keep the prompts that work.

Why prompts matter

A chatbot answers the question you asked, not the one you meant. When a prompt is vague, the model fills the gaps with the most typical assumptions — a generic audience, a medium length, a neutral tone — and the result feels bland or off-target. That isn’t a flaw you can wait out with the next model release. Even the most capable model can’t know your customer, your teacher’s marking rubric or the budget your manager gave you unless you say so.

The good news is that prompting isn’t a secret art. OpenAI, Anthropic and Google all publish prompting guides, and their core advice is strikingly similar: be clear and specific, provide context, give examples, and say what form the answer should take. This guide turns that advice into a pattern you can use every day, with before-and-after examples.

The five-part pattern

1. Role: who should the AI be?

Starting with “You are an experienced…” sets vocabulary, depth and point of view. “You are a patient maths tutor for a 14-year-old” produces a very different explanation from “You are a university mathematics professor.” Roles work best when they’re specific about expertise and audience. They don’t make the model more knowledgeable than it is, but they steer how it uses what it knows.

2. Task: one clear job, starting with a verb

Write, summarise, compare, explain, rewrite, critique, plan, list. Then define the deliverable: “three subject lines under 50 characters”, “a one-page summary with five bullet points”, “a table comparing four options”. If you need several things, number them. Vague tasks like “help me with my essay” invite vague help.

3. Context: what the AI can’t know

This is where most quality comes from. Paste the text to edit, the facts about your product, the notes from your meeting, the constraints you’re working under. Label it clearly — for example “NOTES:” or “DRAFT:” — so the model knows which part is material and which part is instruction. Anthropic’s documentation suggests separating instructions from material with clear markers, such as XML-style tags, which is especially helpful with long documents.

4. Format: the shape of the answer

Say exactly how you want the output: a bulleted list, a table with named columns, a 150-word email with a subject line, code with comments, plain text without markdown. Format instructions save more editing time than almost anything else.

5. Rules: what to avoid

Constraints prevent the most common follow-up corrections: “Use British spelling”, “Don’t mention competitors”, “Keep my voice — don’t add new ideas”, “If you’re unsure of a fact, say so instead of guessing”. Rules about uncertainty are particularly valuable; see the section on accuracy below.

You don’t need all five every time. A quick factual question needs only a task. But when an answer disappoints, check which part was missing — it’s almost always context or format. Our free prompt builder walks you through all five.

Before and after: three examples

Example 1: an email

Before: “Write an email asking for a deadline extension.”

After: “You are a professional but friendly project coordinator. Write an email to my client, Sam, asking to move the website launch from 3 March to 17 March. Reason: the payment provider’s approval is delayed, which is outside our control. Offer a 20-minute call this week to walk through the new timeline. Under 140 words, with a clear subject line. Don’t over-apologise.”

The second version gives the relationship, the dates, the reason, an offer and a length — everything needed for a send-ready draft.

Example 2: learning a concept

Before: “Explain inflation.”

After: “Explain inflation to me as if I’m a first-year economics student who understands supply and demand but not monetary policy. Use one everyday example and one simple numerical example. Then ask me two questions to check I understood, one at a time.”

Example 3: analysing a document

Before: “Summarise this report.”

After: “Summarise the report below for a busy manager deciding whether to renew this supplier. Give a two-sentence verdict, then up to five key points, then any risks. Quote exact figures from the report and don’t add numbers that aren’t in it. REPORT: [paste]”

Editor’s note — add your own experience: Add screenshots or pasted excerpts of real answers to one of these before/after prompts from two different chatbots, and comment on the difference you saw.
Remove this box by adding your content here, or hide all notes with "showEditorNotes": false in site.config.json.

Show, don’t just tell: using examples

One of the most reliable techniques is giving the model examples of the output you want. Researchers documented this “few-shot” behaviour in the 2020 GPT-3 paper, which showed that large language models can pick up a task from a handful of examples in the prompt. In practice: if you want product descriptions in your house style, paste two you’ve written before and say “match this style”. If you want data extracted in a certain structure, show one completed example. Examples communicate tone, length and structure more precisely than adjectives like “punchy” or “professional”.

One caution: models can copy examples too closely. Use examples that vary in content but share the qualities you want, and say which qualities matter.

Asking the model to think step by step

For problems with several steps — calculations, planning, logic puzzles, debugging — asking the model to reason before answering can help. The 2022 “chain-of-thought” paper by Wei and colleagues found that prompting models to produce intermediate reasoning steps improved performance on arithmetic and reasoning tasks. Many current chatbots now include built-in “thinking” or reasoning modes that do this automatically, so you may not need to ask. Where you do, a simple “Work through this step by step, then give the final answer on its own line” is enough. For simple tasks, it just makes answers longer.

Prompting for accuracy

Chatbots can state wrong information confidently — a problem known as hallucination (we explain why in Why AI hallucinates). Prompts can reduce the risk, though never remove it. Anthropic’s guidance on reducing hallucinations suggests explicitly allowing the model to say “I don’t know” and asking it to base answers on provided documents, quoting relevant passages. Useful lines to add:

  • “If you’re not sure, say so. Don’t guess.”
  • “Use only the information in the document below. If the answer isn’t there, say it isn’t.”
  • “Quote the exact sentence from the source that supports each claim.”
  • “Don’t invent sources, statistics or quotations.”

Then verify anything important. Our guide on how to fact-check AI answers shows a five-minute routine.

Iterating: treat it as a conversation

Your first prompt rarely produces the perfect answer, and that’s fine. Good iteration is specific: instead of “make it better”, say “make the second paragraph half as long and replace the jargon with plain words”. Change one thing at a time so you learn what made the difference. If a conversation goes off track after many corrections, start a fresh chat with an improved prompt — long conversations carry earlier mistakes forward and use up the model’s context window.

Common mistakes to avoid

  • Burying the task. In a long prompt, put the main instruction at the top and repeat it briefly at the end if needed.
  • Mixing instructions and material. Label pasted text clearly so the model doesn’t treat a sentence in your document as an instruction.
  • Asking for everything at once. Break big jobs into steps: outline first, then draft each section.
  • Accepting the first answer. Push back, ask for alternatives, ask what’s missing.
  • Sharing sensitive data. Remove names, account numbers and confidential details. See our AI privacy guide.

Build your own prompt library

Once a prompt works well, save it. A small personal library of prompts for your recurring tasks — weekly reports, customer replies, study sessions — is one of the most practical productivity gains AI offers. Start from our free prompt library of 58 templates, adapt them to your work, and refine them over time.

Frequently asked questions

Do prompts that work in ChatGPT also work in Claude or Gemini?

Mostly, yes. The core techniques — clear tasks, context, examples and a defined format — are recommended in OpenAI’s, Anthropic’s and Google’s documentation alike. Each model has quirks, so test important prompts in the chatbot you’ll actually use.

Is “prompt engineering” still necessary with newer models?

Newer models are better at guessing what you mean, but they still can’t know facts about your situation that you don’t provide. Clear context and a defined output will always improve results.

Should I be polite to chatbots?

Politeness isn’t required. Clarity is. Write the way you’d brief a capable new colleague: specific, complete and direct.

How long should a prompt be?

Long enough to remove ambiguity. A quick question can be one sentence; a report or a piece of code may need a few paragraphs of context. Put the main instruction first.

What’s the fastest way to improve a bad answer?

Tell the model specifically what was wrong (“too formal”, “missed the budget limit”, “invented a statistic”) and add the missing context. Starting a fresh chat with an improved prompt often works better than many corrections.

Sources

  1. Anthropic — Prompt engineering overview (opens in a new tab)
  2. OpenAI — Prompt engineering guide (opens in a new tab)
  3. Google — Prompt design strategies (Gemini API) (opens in a new tab)
  4. Brown et al. (2020), Language Models are Few-Shot Learners (opens in a new tab)
  5. Wei et al. (2022), Chain-of-Thought Prompting Elicits Reasoning in Large Language Models (opens in a new tab)
  6. Anthropic — Reduce hallucinations (opens in a new tab)

Facts, prices and features were checked against these sources on November 19, 2026. AI products change quickly; if you spot something out of date, please tell us.