Vote this week
GUIDE · HOW-TO

How to write prompts that work

A prompt is just what you type to an AI. The difference between a vague answer and a great one is usually the prompt, not the AI. The good news: the rules are simple, and the major AI companies give much the same advice. This guide distills the official advice from Anthropic , OpenAI , Google and Microsoft into one page you can use with any AI.

By Parth AminReviewed 15 min readHow we made this
Illustration: a pencil writing in a speech bubble, with a second bubble replying
On this page

The golden rule

TIP

Write for a brilliant new colleague who knows nothing about your situation. Anthropic's guide puts it this way: show your prompt to a colleague with little context; if they'd be confused, so will the AI. (source)

AI can't read your mind or see your screen. Everything it knows about your task is in the words you give it.

The six habits every AI lab agrees on

We read the official prompting guides from Anthropic, OpenAI, Google and Microsoft. These six habits come up again and again across them.

The parts of a strong prompt. Only the task is required; add the others as needed.

1. Be clear and specific

Say exactly what you want. "Make it shorter" is vague; "cut it to three sentences" is clear. Numbers, names and specifics beat adjectives.

2. Give the background, and say why

Explain the situation and the purpose. "Write a product description" gets a generic one. "Write a product description for our handmade candles; our buyers are gift shoppers who care that they're plastic-free" gets a useful one. Saying why helps the AI make good choices you didn't spell out.

3. Describe the result you want

Name the format (list, table, email, code), the length, the tone and the audience. "Explain this to a 10-year-old in under 100 words" changes everything.

4. Show an example

One good example often works better than a paragraph of description. Paste a past email you liked and say "match this style". A few varied examples work best; if they're all alike, the AI may copy them too closely.

5. Give it your material

Paste or attach the document, data, notes or code you want it to use, and say which to rely on. An AI working from your actual material is far more accurate than one working from memory.

6. Treat the first answer as a draft

Reply with what to change: "more formal", "drop the second point", "now make a table". Most great results take two or three rounds.

Three more that help

  • Give it a role. One line such as "You are an experienced tax accountant" focuses expertise and tone. One sentence is enough; a long backstory adds little.
  • Separate your instructions from your material. Put pasted text in quotes or under a heading like "Here is the article:" so the AI doesn't confuse it with your request.
  • Ask the AI to improve your prompt. Write a rough version, then ask: "Rewrite this prompt to get a better result, and ask me anything you need to know." Google and Anthropic both suggest some version of this.

A simple formula

If you like a template, Google's Persona · Task · Context · Format is easy to remember. Microsoft teaches a similar one: Goal · Context · Expectations · Source. You rarely need every part; the task is the only must-have.

Prompt builder

YOUR PROMPTYou are a friendly personal trainer. Make me a 4-week running plan. I'm a beginner, I can run 3 days a week, and I want to finish a 5 km race. A table with one row per week, under 200 words.
41 words · paste into any AI

Before and after

BEFORE

Write an email about the meeting.

AFTER

Write a short, friendly email to my team saying Thursday's planning meeting moves to Friday at 10:00. Apologize briefly, keep the same video link, and ask anyone who can't make it to reply by Wednesday. Under 80 words.

Why it's better: it says who it's for, what changed, the tone, the one action needed, and the length.

Copy-ready templates

Each template has blanks in [brackets]. Copy it, fill the blanks, paste it into any AI.

  • Write

    Write a [type of text] for [audience] about [topic]. The goal is [purpose]. Tone: [tone]. Length: [length]. Here is an example of the style I like: [example].

  • Summarize

    Summarize the text below for [who will read it]. Give [number] key points, then [one risk / one action]. Use only the text; say if something is missing. Text: [paste].

  • Explain

    Explain [concept] to [audience and their level]. Start with a one-sentence answer, then an everyday example, then [number] details. Avoid [jargon / math].

  • Decide

    I'm choosing between [option A] and [option B] for [goal]. What matters most to me is [criteria]. Compare them in a table, then recommend one and say what would change your mind.

  • Brainstorm

    Give me [number] ideas for [goal] for [audience]. Make them [constraint: cheap / quick / unusual]. Group them by [theme] and mark the three you'd try first.

  • Code

    Write [language] code that [does what]. Inputs: [inputs]. Output: [output]. It runs in [environment]. Explain any part a beginner might not follow, and list how to test it.

  • Feedback

    Act as [role, e.g. a tough editor]. Review my [text / plan / code] below for [what to judge]. List the five most important problems, most serious first, each with a fix. [paste]

  • Learn

    I want to learn [skill] in [time]. I already know [level]. Make a plan with one short lesson per [day/week], each with a practice task, and quiz me at the end of each lesson.

What's changed: habits to drop

Some popular prompting advice no longer holds, according to the labs' current guides.

  • Stop shouting. ALL CAPS, "CRITICAL" and "you MUST" can make models overreact. Say it once, calmly. (Anthropic, Google)
  • You rarely need "think step by step". Reasoning models already think before answering, and OpenAI notes that telling them to can even hurt. For hard problems, choose the AI's deeper "thinking" mode instead. (OpenAI)
  • Say what to do, not what not to do. "Write in plain prose paragraphs" works better than "don't use bullet points".
  • Write sentences, not search keywords. "best laptop students" gets a generic answer; a sentence with your budget, use and must-haves gets a useful one. (Google's guide)
  • Don't over-pad. A long role-play setup or paragraphs of "you are the world's greatest…" add little. Real context does the work.

When the answer is wrong

ProblemFix
It made something upSay "If you're not sure, say so." Ask for sources and open them. Give it the document instead of relying on its memory.
The answer is genericAdd your audience, goal and specifics. Paste an example of what good looks like.
Wrong length or formatGive a number ("5 bullet points", "under 150 words") or show the format.
It ignores a "don't"Rephrase as a "do": say what you want instead.
Long document, weak answerPut the document first and your question last, and ask it to quote the relevant parts before answering.
Your request was ambiguousAsk it to ask you clarifying questions before it starts.
Math or counting errorsAsk it to use code or a calculator tool if it has one.
Different answers each timeThat's normal. Run it again, compare, and keep the best.

Prompting image generators

Image AIs follow the same spirit with a few extra habits, drawn from OpenAI, Google and Midjourney:

  • Describe a scene in a sentence, not a pile of keywords: "a red bicycle leaning on a blue door in a sunny Lisbon street" beats "bicycle, door, street, colourful, 4k".
  • Be specific about the look: subject, setting, lighting, colours, style (photo, watercolour, 3D), mood.
  • Use camera words: close-up, wide shot, from above, shallow depth of field.
  • Give exact numbers: "three cats", not "cats".
  • Say what you want, not what you don't. Naming an unwanted object can make it appear.
  • Put any words that must appear in quotes, and check the spelling in the result.
  • Change one thing at a time when refining, and say what should stay the same.
  • Set the shape: square, portrait or widescreen.
  • Midjourney is the exception on length: it favours short, simple prompts, so trim to the essentials there.

Use AI safely

  • Check anything that matters. Facts, quotes, numbers, citations, medical, legal and money advice. AI can be confidently wrong.
  • Mind what you paste. Don't share passwords, ID numbers or other people's private information. Read each AI's data settings; most let you stop your chats being used for training: ChatGPT, Claude, Gemini.
  • Watch for instructions hidden in content. If you ask an AI to read a web page or email, that text could contain instructions meant to trick it, called prompt injection. Be careful letting AI act on your behalf.

Watch: a prompt built live

Anthropic's prompt engineers build a real prompt from scratch, step by step, showing why each part is there.

Go deeper: the official guides

TRY IT · OPENAIPrompting best practices for ChatGPT(opens in a new tab) TRY IT · ANTHROPICPrompt engineering overview(opens in a new tab) TRY IT · GOOGLE WORKSPACEWriting effective prompts(opens in a new tab) TRY IT · MICROSOFTLearn about Copilot prompts(opens in a new tab) TRY IT · LEARN PROMPTINGA free, beginner-friendly prompting course(opens in a new tab) TRY IT · DAIR.AI PROMPT ENGINEERING GUIDEEvery prompting technique, catalogued (technical)(opens in a new tab)

Questions people ask

How do I write a good AI prompt?

Say clearly what you want, give the background and the reason, describe the result you want (format, length, tone, audience), include an example or your own material if you have it, then refine the first answer with follow-up messages. The major labs' guides share these basics.

What is the best prompt formula?

A simple one from Google's guide is Persona, Task, Context, Format: who the AI should act as, what to do, the background, and the shape of the answer. You rarely need all four; the task is the only must-have.

What is prompt engineering?

The practice of wording instructions so an AI model gives the result you want. For everyday use it mostly means being clear, specific and complete. For developers it also covers testing prompts systematically and building them into apps.

Is prompt engineering still needed?

Less trickery is needed than before, since models follow plain instructions well and reasoning models plan on their own. But the basics matter more than ever: an AI can't read your mind, so clear goals, context and examples still decide the quality of the answer.

How long should a prompt be?

As long as it needs to be to remove guesswork. Google found the most effective prompts in its research averaged around 21 words, while people typically type fewer than nine. For big tasks, pasting pages of background is fine.

Do prompts work the same in ChatGPT, Claude and Gemini?

The fundamentals work everywhere, because the major labs recommend similar core habits. Each model has small quirks, so if one gives you a poor result, rephrasing or trying another AI can help.

What is few-shot prompting?

Including a few examples of the input and the output you want in your prompt, so the AI copies the pattern. One example is 'one-shot', several are 'few-shot', none is 'zero-shot'.

How we made this

Parth Amin runs thisorthis.ai and has spent over a decade building software products, most recently enterprise generative-AI systems. @_aminparth on X
How we made this: drafted with AI assistance, then fact-checked against the linked sources and edited by hand. Reviewed . Spotted a mistake? Tell us.
Found this useful? Share it with someone learning AI.
Which AI follows your prompts best? Vote for this week's best AIVote

Keep reading