Skip to main content
Season 3 ends in 16 d 22:31:37 $2,000 10,000 pts = 1 month Premium
Artificial Intelligence

How to Write a Prompt: Clear Instructions for Better Answers

Published 19 min read
Open the post and read it to claim 31 points
Hands arranging four blank coloured cards in a row in front of a laptop, with a speech bubble above, like parts of a prompt

Sign in and earn +31 points by reading this

Read to the end, wait a few seconds, then tap the claim button below.

In short

To write a good prompt, state the task in plain words, give the context the chatbot cannot guess, say what format and length you want, add limits and, when possible, an example [1][3][4]. Then read the answer, check facts and refine the prompt instead of starting over [4][8].

Key takeaways

  1. A prompt is the text you give a language model; the clearer it is, the less the model has to guess [1][3].
  2. The guides from OpenAI, Anthropic and Google agree on the basics: a specific task, useful context, a stated format and clear limits [2][3][4].
  3. Examples are one of the most reliable ways to show the style and structure you want (few-shot prompting) [3][4][5].
  4. Say what to do rather than only what not to do, and replace vague words such as “short” with numbers [2].
  5. For long documents, put the material first and the question at the end, and split big jobs into steps [3][4][7].
  6. Chatbots can state false things with confidence, so check important facts against reliable sources [8][9].
  7. Do not paste passwords, ID numbers or other sensitive information into a public chatbot [9].
On this page 13 sections
  1. What is a prompt, and why does the wording matter?
  2. How do you write a good prompt, step by step?
  3. What should a prompt include? A simple template
  4. What does a good prompt look like? Before and after examples
  5. What are zero-shot, few-shot and step-by-step prompts?
  6. How do you write prompts for long documents and complex tasks?
  7. How do you fix a prompt that gives bad answers?
  8. Do prompts work the same in every chatbot?
  9. What should you never put in a prompt, and how do you check the answer?
  10. Common mistakes
  11. Frequently asked questions
  12. Glossary
  13. Sources

What is a prompt, and why does the wording matter?

A prompt is the instruction, question or text you give a language model, and the model’s answer depends heavily on how clearly that prompt states what you want [1][4].

Chatbots and writing assistants are built on large language models (LLMs). The UK National Cyber Security Centre (NCSC) describes an LLM as an algorithm trained on a very large amount of text that turns the relationships between words into a probability model; you give it a prompt and it produces an answer from those relationships [9]. Google’s prompting guide puts it simply: generative language models work like an advanced auto-completion tool [4].

That is why wording matters. The model does not know who you are, what you already know, what the answer is for or what a good result looks like to you, unless you say so. Anthropic’s guide suggests treating the model as a brilliant but new employee who lacks context on your norms: the more precisely you explain what you want, the better the result [3]. Its quick test is to show the prompt to a colleague with little background on the task. If they would be confused, the model probably will be too [3].

Prompting is not a secret code. Google calls prompt design the process of creating natural language requests that lead to accurate, high-quality responses, and stresses that it is iterative: you write, read the result and refine [4]. The same habits that make a good message to a person, such as a clear goal, the right background and an example, make a good prompt.

This guide is about text chatbots and assistants. For pictures, see our guide AI Images with Persian Prompts: Step-by-Step Tips.

How do you write a good prompt, step by step?

Build the prompt from five parts: the task, the context, the format, the limits and, if you can, an example. Then test it and improve it [2][3][4].

  1. Start with the task. Use a clear action verb: summarise, explain, compare, draft, translate, list, check. OpenAI’s help centre recommends putting the instruction at the beginning of the prompt [2].
  2. Add the context. Say who the answer is for, why you need it and what you already know. Anthropic notes that explaining the reason behind an instruction helps the model give a more targeted answer, because it can generalise from the explanation [3]. Google recommends including the information the model needs instead of assuming it already has it [4].
  3. Set the format. Say whether you want a table, a bulleted list, a short email or a step-by-step plan, and give a length in numbers. OpenAI’s guide replaces “fairly short, a few sentences” with “a 3 to 5 sentence paragraph” as a better instruction [2].
  4. State the limits. Mention what must be included or avoided, the reading level, the tone and any facts the answer must stick to. Google calls these constraints and lists them as a standard part of a prompt [4].
  5. Show an example. If you want a particular style or structure, include a short sample of it. Both Anthropic and Google describe examples as one of the most reliable ways to steer the output [3][4].
  6. Review and refine. Read the answer, then add the missing detail or correct the misunderstanding in a follow-up message or in a revised prompt [4].

You will not need all five parts every time. A quick factual question needs only a clear task. A piece of writing that someone else will read usually needs all of them.

Five coloured blocks with simple symbols stacked into one tower, standing for task, context, format, limits and example
A strong prompt is built from parts: the task, the context, the format, the limits and, when the style matters, an example.

What should a prompt include? A simple template

A reusable template saves time: fill in the role, task, context, format and limits, and add an example when the style matters [3][4].

The table below turns the advice from the official guides into a fill-in-the-blanks structure. Copy it into a note and adapt it. Separating the parts with line breaks, headings or quotation marks helps the model tell your instructions apart from the material you paste in; OpenAI suggests separators such as ### or triple quotes, and Anthropic suggests labelled tags [2][3].

A filled-in example: “You are a patient maths tutor. Explain what a percentage is to a 12-year-old who finds fractions hard. Use one everyday example about a shop discount. Keep it under 150 words, in short sentences, and end with one practice question.” That prompt has a role, a task, a reader, an example to include, a length and a closing instruction.

Giving the model a role, as in the first sentence above, is optional. Anthropic notes that even a single sentence setting a role can focus the tone and behaviour of the answer [3]. A role does not add knowledge the model lacks, so it is no substitute for context.

What does a good prompt look like? Before and after examples

The difference between a weak and a strong prompt is usually missing detail: who the answer is for, what shape it should take and what to leave out [2][3].

The examples in the table on this page follow the same pattern as the “less effective” and “better” pairs in OpenAI’s help centre and Anthropic’s documentation [2][3]. In each case the stronger version does not use special words. It simply tells the model what a person would need to know to do the job well.

  • Vague: “Write about climate.” Clear: “Explain the difference between weather and climate for a secondary-school student in about 200 words, with one example from daily life.”
  • Vague: “Make this email better.” Clear: “Rewrite the email below so it is polite but firm, under 120 words, and keeps the deadline and the invoice number unchanged.”
  • Vague: “Give me some ideas for a trip.” Clear: “Suggest a three-day plan for a family with two children aged 6 and 9, using public transport only, with one indoor option each day in case of rain.”

A useful rule from OpenAI’s guide is to say what to do instead of only what not to do [2]. “Do not be technical” leaves the model guessing; “explain it without jargon, as you would to a friend” gives it a target.

A crumpled note with a scribble leading to tangled grey yarn beside a neat checklist card wrapped in straight teal ribbon
A vague request tends to give a tangled answer; a clear checklist of what you want gives a neat one.

What are zero-shot, few-shot and step-by-step prompts?

A zero-shot prompt gives only the instruction; a few-shot prompt adds a handful of worked examples; a step-by-step prompt asks the model to reason through intermediate steps before answering [2][5][6].

Zero-shot. You ask directly, with no examples. OpenAI’s help centre suggests starting this way and adding examples only if the results are not good enough [2].

Few-shot. You show a few input-and-output pairs, then give the new input. The idea was made famous by a 2020 research paper from OpenAI, “Language Models are Few-Shot Learners”, which showed that a large model could pick up a new task from a few examples in the prompt, without retraining [5]. Google’s guide goes further and recommends always including few-shot examples where possible, and keeping their structure and format consistent so the model copies the right pattern [4]. Anthropic suggests three to five examples that are relevant, varied and clearly separated from the instructions [3].

Step by step. For maths, logic or planning problems, it can help to ask the model to work through the problem before giving the final answer. A 2022 Google Research paper called this chain-of-thought prompting and found that showing worked reasoning steps improved results on arithmetic, commonsense and symbolic reasoning tasks [6]. Newer “reasoning” models often do this internally; OpenAI’s guide notes that they usually work better with high-level goals, while other models benefit from precise, explicit instructions [1].

Few-shot examples have a side effect worth knowing: the model may copy surface details, such as length or wording, from them. Varying your examples helps it learn the pattern you mean rather than an accident of one sample [3][4].

How do you write prompts for long documents and complex tasks?

Put long material first and your question last, label each part clearly, and break big jobs into a chain of smaller prompts [3][4][7].

When you paste a report, a contract or several articles, where you place the question matters. Anthropic advises putting long documents near the top of the prompt, above the query and instructions [3]. Google gives the same advice for long contexts: supply the context first and put the specific instructions or question at the very end [4].

Research supports being careful with long inputs. A study from Stanford University and partners, published in 2023 and later in the journal Transactions of the Association for Computational Linguistics, found that language models were often best at using information at the beginning or end of a long input and noticeably worse when the key passage sat in the middle [7]. In practice: keep the material focused, cut what is irrelevant and ask the model to quote the passages it relies on.

For complex work, split the task. Google’s guide describes two ways: one prompt per instruction, or a chain of prompts in which the output of one step becomes the input of the next [4]. Anthropic describes a common chain for writing: draft, review the draft against criteria, then refine [3]. For example, ask first for an outline, approve or edit it, then ask for each section in turn. Each step is easier to check than one long answer.

How do you fix a prompt that gives bad answers?

Treat a bad answer as feedback: find what the model misunderstood, add the missing detail or an example, and try again rather than repeating the same prompt [2][4].

Google’s guide lists practical iteration strategies: use different phrasing, switch to an analogous task that is easier to describe, and change the order of the content in the prompt [4]. The table on common problems below maps typical failures to fixes drawn from the official guides.

  • The answer is too long or too short. Give an exact length or number of points [2].
  • The tone is wrong. Name the reader and the tone, or paste a short sample of the style you want [3][4].
  • The answer ignores part of the request. Number the requirements so each one is visible, and ask the model to confirm it covered every point [3].
  • The facts look doubtful. Paste the trusted source text and tell the model to answer only from it, and to say so if the answer is not there [3][4].

Settings can matter too, if your tool exposes them. OpenAI explains that temperature controls how often the model picks less likely words: higher values give more varied, creative text, and for factual tasks such as data extraction a low setting is best [2]. Most chat apps hide this setting, so wording remains the main lever.

Do prompts work the same in every chatbot?

The core habits work in any major chatbot, because the official guides from different companies give largely the same advice; details such as preferred formatting differ [1][3][4].

OpenAI, Anthropic and Google each publish prompting guides for their own models. All three ask for clear and specific instructions, useful context, a stated output format and examples [1][3][4]. They differ in small ways. Anthropic suggests wrapping parts of a long prompt in labelled tags; OpenAI’s help centre shows separators such as ### and triple quotes; Google’s guide includes templates with headings for role, constraints and output format [2][3][4]. These are interchangeable ways of making structure visible, and plain headings work in all of them.

Models also change. A prompt that worked well in one version may behave differently after an update, which is why each company keeps separate notes for newer models and why testing your important prompts again after a change is sensible [1][3]. This guide does not rank chatbots: which one suits you depends on the task, the language you work in, price and privacy terms, all of which change over time.

The same principles apply in Persian, Arabic, Turkish or any other language. Write the prompt in the language you want the answer in, or say explicitly which language to answer in, and give examples in that language.

What should you never put in a prompt, and how do you check the answer?

Never paste information you would not want made public, and never treat a chatbot’s answer as verified until you have checked the important facts yourself [8][9].

The NCSC points out that what you type is visible to the company running the service, may be stored and may be used to develop it; stored queries could also be leaked or hacked. It recommends not including sensitive information in queries to public LLMs and not asking anything that would cause problems if it were made public [9]. That rules out passwords, bank and card details, ID numbers, other people’s personal data and confidential work documents unless your organisation has approved a tool for them. Read the terms and privacy settings of the service you use. For one example of how data handling works behind the scenes, see our guide OpenRouter Prompt Leak: What Zero Data Retention Means.

Checking matters because LLMs can be wrong while sounding certain. The NCSC lists “hallucinating” incorrect facts among their serious flaws [9], and the US National Institute of Standards and Technology (NIST) uses the term confabulation for confidently stated but false content in its 2024 profile of generative AI risks [8]. A clear prompt reduces mistakes but does not remove them.

  • Ask for sources, then open them; a cited link or reference may not exist or may not say what is claimed.
  • Check numbers, dates, names and quotations against an authoritative source.
  • For health, legal or money questions, use the answer only as a starting point and ask a qualified professional.
A magnifying glass on a printed page beside an open book, a laptop, a green check-mark clip and a small padlock
Check important facts in a chatbot’s answer against reliable sources, and keep passwords and personal data out of prompts.
A fill-in prompt template built from the official prompting guides
PartWhat to writeExample
Role (optional)Who the model should act as“You are a patient maths tutor.”
TaskOne clear action verb and the goal“Explain what a percentage is.”
ContextWho it is for, why, what they already know“For a 12-year-old who finds fractions hard.”
MaterialText or data to work on, clearly separatedPaste it between triple quotes or under a heading
FormatShape and length in numbers“Under 150 words, then one practice question.”
LimitsTone, must-include and must-avoid items“Short sentences, no jargon, one shop-discount example.”
ExampleA short sample of the output you wantOne model answer in the style you like
Weak and stronger versions of the same request
Weak promptStronger promptWhat was added
“Summarise this.”“Summarise the article below in 5 bullet points for a busy manager, each under 20 words.”Reader, format, length
“Write a poem.”“Write a 12-line poem about the first snow of winter for a children’s class, with simple rhymes.”Topic, audience, length, style
“Fix my CV.”“Suggest edits to the CV below for a junior data-analyst job; keep it to one page and list changes as bullets.”Goal, constraint, output format
“Don’t be so technical.”“Explain it without jargon, as you would to a friend.”A positive instruction instead of a negative one
Common prompt problems and how to fix them
ProblemLikely causeFix
Generic, bland answerToo little contextSay who it is for and why, and add specifics
Wrong lengthVague words such as “short”Give a number of words, sentences or points
Wrong structureFormat not statedName the format or show an example
Part of the request ignoredMany instructions in one paragraphNumber the requirements or split the task
Made-up factsNo source to rely onPaste trusted text and ask it to answer only from it
Same mistake againRepeating the same promptRephrase, reorder or add an example

Common mistakes

  • Writing a one-line request and expecting the model to guess the rest.

    Fix: Add the reader, the purpose and the format; the model only knows what you tell it [3][4].

  • Using vague size words such as “short” or “a few”.

    Fix: Use numbers: “3 to 5 sentences” or “under 150 words” [2].

  • Only listing what not to do.

    Fix: Say what to do instead, which gives the model a clear target [2].

  • Burying the question in the middle of a long pasted document.

    Fix: Put the material first and the question at the end [3][4][7].

  • Trusting confident answers without checking.

    Fix: Verify facts, figures and references against reliable sources [8][9].

  • Pasting passwords, ID numbers or confidential files into a public chatbot.

    Fix: Remove sensitive details or use a tool your organisation has approved [9].

Frequently asked questions

How do you write a prompt for AI?

State the task with a clear verb, add the context the model cannot guess, say what format and length you want, list any limits and add an example if the style matters [2][3][4]. Then read the answer and refine the prompt.

How do you write a prompt for ChatGPT, Claude or Gemini?

The same way: the official guides for all three ask for clear instructions, context, a stated format and examples [1][3][4]. Small differences, such as labelled tags or separators, are optional ways to make structure clear [2][3].

What is an example of a good prompt?

“Explain the difference between weather and climate for a secondary-school student in about 200 words, with one example from daily life.” It names the task, the reader, the length and an element to include [2][3].

How long should a prompt be?

As long as it needs to be clear. A simple question can be one line; a writing or analysis task often needs several sentences of context, format and limits [3][4]. Cut anything irrelevant, especially in long documents [7].

What is few-shot prompting?

Including a few examples of inputs and the outputs you want, so the model copies the pattern. It was popularised by a 2020 research paper and is recommended in the major prompting guides [3][4][5].

Does asking the model to think step by step help?

Often, for maths, logic and planning tasks. Research on chain-of-thought prompting found that showing intermediate reasoning steps improved accuracy on such tasks [6]. Many newer models now reason internally [1].

Can a good prompt stop a chatbot from making mistakes?

No. Clear prompts reduce errors, but language models can still produce confident false statements, so check anything important [8][9].

Glossary

Prompt
The instruction, question or text given to a language model [1][4].
Large language model (LLM)
A model trained on large amounts of text that generates answers from patterns between words [9].
Zero-shot prompt
A prompt with an instruction but no examples [2].
Few-shot prompt
A prompt that includes a few examples of the desired input and output [4][5].
Chain-of-thought
Prompting a model to show intermediate reasoning steps before the final answer [6].
Prompt chaining
Splitting a task into steps where each prompt uses the previous output [3][4].
Confabulation
NIST’s term for false content a generative model states confidently, often called hallucination [8].

Sources

  1. Prompt engineering OpenAI (API documentation)
  2. Best practices for prompt engineering with the OpenAI API OpenAI Help Center
  3. Prompting best practices Anthropic (Claude documentation)
  4. Prompt design strategies Google AI for Developers (Gemini API documentation)
  5. Language Models are Few-Shot Learners Brown et al., OpenAI; NeurIPS 2020 · 2020-05-28
  6. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models Wei et al., Google Research; NeurIPS 2022 · 2022-01-28
  7. Lost in the Middle: How Language Models Use Long Contexts Liu et al., Stanford University; Transactions of the ACL · 2023-07-06
  8. Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile (NIST AI 600-1) US National Institute of Standards and Technology · 2024-07-26
  9. ChatGPT and large language models: what's the risk? UK National Cyber Security Centre · 2023-03-14
Share this guide Telegram WhatsApp X
0 likes

Comments

Top comments

About the Pouyam Team Editorial policy

On Pouyam

Explore Pouyam

Guides are one corner of Pouyam. Here is where to go next.

Play and win dollar prizes

All games

Free online games with no download on Pouyam: every game earns season points, and the top players win dollar prizes.

Quick navigation