5 min read
Illustration of a prompt box with a blinking cursor and a red spark
Image credits · Illustration: Global Pulse Daily

How to Write Better AI Prompts: A Practical Guide With Examples

A strong prompt names the task, supplies the context the model cannot guess and shows the format you want; six steps and a before-and-after example make that routine.

In short

To write better AI prompts, state the task clearly, add the context the model cannot guess, set limits such as length and tone, name the output format and show an example. Then review the answer and change one thing at a time to learn what helped.

Table of contents 8 sections
Key takeaways
  • Say what you want, who it is for and what format you expect, because the model has only your words to work with.
  • Supply the source text and background instead of assuming the model knows them.
  • A few examples in the prompt steer style and format, and step-by-step reasoning helps on maths and logic problems.
  • Tell the model to answer only from the text you provide and to say when the text does not cover the question.
  • Review each answer, change one element of the prompt at a time, and save the versions that work as templates.

To write better AI prompts, say exactly what you want, give the model the background it cannot guess, and describe the shape of the answer you expect. A chatbot has little beyond your words to work with, so a vague request gets a generic reply. The fixes are habits, not tricks, and they work across the major chat assistants.

Why does the wording of a prompt change the answer?

A language model continues text. It predicts the response that best fits the words it was given, and it knows nothing about your audience, your company or what you tried yesterday. Every gap in the prompt is filled with an average guess, a behaviour our guide to how large language models work explains in more detail.

What should a good prompt include?

Six ingredients cover most everyday needs. You rarely need all of them at once, but the more of them you supply, the less the model has to invent.

  • Task. One clear verb: summarise, compare, draft, critique or classify.
  • Context. The situation, the source text and anything already decided. Google's prompting guide for Gemini advises supplying the information the model needs rather than assuming it has it.
  • Audience and tone. Who will read the result and how it should sound.
  • Constraints. Length, points to cover and things to leave out. The same guide notes that you can tell the model what to do and what not to do.
  • Format. A bulleted list, a table, an email with a subject line or JSON.
  • Examples. One or two samples of what a good answer looks like.

How to write better AI prompts, step by step

  1. Start with the task. Open with one sentence that begins with a verb and names the deliverable.
  2. Add the context. Paste the source text, and say who the audience is and what you have already tried or decided.
  3. Set limits. State the length, the tone and anything to avoid.
  4. Name the format. Say whether you want a table, numbered steps, a short email or plain paragraphs.
  5. Show an example. Include a sample of the style or structure you want.
  6. Review and adjust one thing at a time. Read the result, change a single element of the prompt and run it again, so you can see what mattered.

Before you start tuning, decide what a good answer looks like. Anthropic's prompt engineering overview makes the same point: begin with clear success criteria and a way to test against them.

What does a before-and-after prompt look like?

The difference is easiest to see side by side. Both prompts below ask for the same email.

Weak: Write something about our new feature.

Stronger: Write a 120-word email to existing customers announcing our new invoice reminders. The readers are small-business owners who are not technical. Use a friendly, plain tone, put the benefit in the first sentence and end with a link to the help page. Do not mention pricing, and give me a subject line and the body.

The second version states the task, audience, length, tone, constraint and format. It still leaves the model room to write, but it removes the guessing that made the first answer generic. The fastest way to write better AI prompts is to compare outputs like these and note which added detail changed the result.

When do examples and step-by-step reasoning help?

Examples teach by pattern. A prompt that includes a few sample inputs and outputs, known as few-shot prompting, steers the model toward a format or style without retraining it. OpenAI's guidance describes few-shot learning this way, and the 2020 GPT-3 paper showed that a large model can handle new tasks from demonstrations placed in the prompt.

For maths, logic and multi-part problems, asking for the steps can help. A 2022 study found that including intermediate reasoning steps in the examples improved large models on arithmetic, commonsense and symbolic reasoning tasks. In one result, a model with 540 billion parameters, prompted with just eight worked examples, reached state-of-the-art accuracy at the time on GSM8K, a benchmark of maths word problems. Newer reasoning models do much of this work internally, and OpenAI notes that they do well with high-level goals while standard GPT models benefit from precise instructions, so spelling out every step matters less with them.

Large jobs often work better as a chain of smaller prompts, where each output feeds the next. Google's guide recommends this for complex tasks.

How do you stop a chatbot from inventing things?

Give it the source and permission to say it does not know. Paste the text you want summarised or quoted, tell the model to answer only from it, and ask for the passage behind each claim. For the reasons models make things up, see our explainer on AI hallucinations, and for systems that fetch documents automatically, see retrieval-augmented generation. Always check names, numbers and citations before you rely on them.

What mistakes weaken a prompt?

  • Vague requests. "Make it better" gives the model nothing to aim at.
  • Too many jobs at once. Ask for the summary, the critique and the rewrite in separate prompts.
  • Conflicting instructions. "Be brief" and "cover everything" pull in opposite directions.
  • No stated audience. Without a reader in mind, the model writes for nobody in particular.
  • Confidential data. Check how your provider stores and uses what you type before you paste in anything sensitive.
  • Treating the first answer as final. Google's guide says prompt engineering is iterative, and a second or third pass is normal.

How do you keep prompts working over time?

Save the prompts that work as templates, with blanks for the parts that change, such as audience, source text and length. Keep a handful of test inputs and rerun them whenever you edit a template.

If you build on a model through an API, remember that different snapshots of the same model family can give different results. OpenAI recommends pinning production applications to a specific snapshot and running evaluations when you upgrade. When a job grows beyond one prompt into several steps with tools, you are moving toward an agent, and our explainer on what an AI agent is shows where that line sits.

Frequently asked

Written by Said Dulevic

Our international desk covers the infrastructure, policy and people behind the technology shaping the world. Tips and corrections: newsroom@globalpulsedaily.com

More from this author

0 comments

Never published.
A quick check that you are not a script.
Comments are moderated. Links, contact details and abuse are removed.

No comments yet — be the first.