Prompting Basics

How to write a prompt that gets a useful answer: the four parts of a good prompt, how to revise a weak reply, and the mistakes that cause generic output.

12 minLesson 1 of 8
On this page
  1. How a prompt shapes the answer
  2. The four parts of a good prompt
  3. Revising a weak reply
  4. Pitfalls and nuances
  5. What to do differently in practice
  6. Quiz
  7. What to practise next

A prompt is the text you send to a language model, and the model's reply depends almost entirely on what that text contains. The model knows nothing about you, your audience or your goal except what the prompt says, so wherever the prompt is silent it falls back on the most typical answer to that kind of request. Prompting well means putting the facts that matter into the prompt so the model does not have to guess them.

Without that, a request such as "Summarize this article" produces a correct but generic summary, because the model cannot tell whether you want the history, the decision it supports, or the numbers.

How a prompt shapes the answer

A language model produces the most likely continuation of the text it is given. A short, vague request matches thousands of different situations, so the likely answer is the average of all of them. A request that includes your situation matches far fewer, and the answer fits yours. A useful way to check a prompt is to imagine handing it to a capable colleague who has never heard of your project: could they do the job from this text alone, or would they come back with questions? Any question they would ask is something to add to the prompt.

The first example below shows a vague prompt and a typical reply.

Vague promptIllustrative example. Real replies vary.
You
Summarize this article. [2,000-word article about moving a company's web app from one database to another]
Model
The article discusses a company's migration from its original database to a new system. It begins by describing the history of the original setup and the reasons it became difficult to maintain. The authors then outline the planning process, including stakeholder meetings and timelines. Finally, they reflect on lessons learned, noting that communication and testing were key to success.

The reply is accurate, but it only describes the structure of the article. The second prompt states who is asking, what decision the summary supports and what shape the answer should take.

Specific promptIllustrative example. Real replies vary.
You
I lead a team of four engineers. We are deciding next month whether to make the same database move described in the article below. Summarize the article for that decision: - 5 bullet points at most - Focus on cost, time taken, and what went wrong - Skip the company history - End with one line: the biggest risk for a small team <article> [2,000-word article] </article>
Model
- Took 7 months against a 3-month plan; the overrun came from rewriting reports that queried the old database directly. - Two engineers worked on it full time; the article does not give a total cost. - Data copying itself was quick. Most of the problems were in code that assumed the old database's date formats. - They ran both databases side by side for six weeks to compare results before switching. - One outage happened during the switch, caused by a connection limit nobody had tested. Biggest risk for a small team: running two databases in parallel for weeks, which is what made their switch safe.

The second prompt contains nothing unusual. It answers the questions a colleague would have asked before starting.

The four parts of a good prompt

Most good prompts contain four things. They do not need headings, but you should be able to point to each one.

The task

The task is a direct instruction near the top, such as "Summarize", "Rewrite", "List" or "Find the bug in". Name the actual output you want. "Help me with this email" could mean proofreading, shortening or writing a reply, while "Rewrite this email so it is polite but firm" cannot be misread. If the work has several steps, say so, and put the most important instruction first, because instructions buried after a long block of material are the ones that get dropped.

The context

Context is who the answer is for, why you need it and what you already know. It decides what counts as important. "For a decision my team makes next month" tells the model to weigh cost and risk above history. Include facts the answer must use, such as dates, names and what has already been tried, because the model will invent plausible filler where facts are missing. Do not include everything you know. Details that do not affect the answer only give the model more to attend to.

The shape of the answer

The shape covers length, format, tone and what to leave out. State each as something you can check: "at most five bullets", "under 120 words", "no company history". Vague limits such as "not too long" or "keep it brief-ish" mean different things to different readers, so the model picks its own. If you want the answer to be machine-readable, describe the exact format, and see Structured Output for how to make that reliable.

The input

The input is the material the model works on, such as an article, an email or code. Keep it visibly separate from your instructions. If a pasted email contains the sentence "please reply by Friday", the model may treat it as an instruction to itself instead of as text to summarize. Wrapping the material in tags like <article> ... </article>, or introducing it with a line such as "Text to summarize:", marks where your instructions end. Models do not require any particular marker; the point is that the boundary is unambiguous. This also matters for security, as Prompt Injection explains.

Revising a weak reply

Even a good prompt often needs a second attempt. Read the reply, decide exactly what is wrong with it, and change the prompt to address that one thing. Each kind of problem has its own fix.

  • If the reply is too long, give a number, such as "under 120 words".
  • If the focus is wrong, say what matters: "I care about the cost, not the timeline".
  • If the tone is wrong, say who will read it: "this goes to a customer who is already annoyed".
  • If the reply states things that are not in your material, tell the model to use only the provided text and to write "not stated" when something is missing.

Change one thing at a time. If you rewrite the whole prompt and the reply improves, you do not know which change helped, so you cannot reuse the lesson on the next prompt. When a prompt works well, keep it somewhere you can find it, as you would a useful code snippet.

Pitfalls and nuances

Standing instructions and the request

Many tools let you set instructions once, usually called a system prompt, and then send each request as a separate message. Put the things that stay the same for every request in the standing instructions, such as the role, the tone and the output format. Put the material and the specific task for this request in the message. That way you change one part without rewriting the other, and the format rules do not get lost in a long message.

What to do differently in practice

Before you send a prompt you will rely on or reuse, check that the task is stated directly, that the context includes the facts the answer needs, that the limits on the answer can be verified, and that the input is marked off. Short prompts are fine for quick, low-stakes questions. Treat the first reply as a draft, name what is wrong with it, and change one thing. A well-written prompt improves the odds of a good answer but does not make the content correct, so see Verifying AI Output for checking it.

Try it: Fix the landlord email

This prompt got a stiff, generic letter that missed the important facts. Rewrite it using the four parts: task, context, shape and input.

Show a sample answer

One stronger version:

Rewritten promptIllustrative example. Real replies vary.
You
Write a short email to my landlord asking them to fix the heating. Context: the heating in my flat has not worked since Monday (3 days). It is around 12°C inside at night. I reported it by phone on Monday and was told someone would come "this week", but nobody has contacted me. I have a good relationship with the landlord and want to keep it. Shape: polite but firm, under 150 words. Ask for a specific repair date by Friday. Mention that I can give access any weekday after 4pm. Sign it: Priya, Flat 3B

This version works for these reasons:

  • The task says the email should ask them to fix the heating, not just be "about" it.
  • The context supplies the facts the email must contain: how long the heating has been off, how cold it is and what was promised. Without them the model invents vague filler.
  • The shape sets the tone and length and asks for one concrete thing, a repair date, so the email ends with an action.
  • The sign-off and the access times save you an edit afterwards.

There is no separate input here because you are not giving the model a document to work on. The facts in the context play that role.

Quiz

Quick check

You ask for "a summary of this report" and get a generic overview. What is the most useful first change?

Which instruction is the model most likely to follow exactly?

Why wrap pasted material in markers like <article> tags?

A reply is too formal and also too long. What is the best way to revise the prompt?

What to practise next

Take a prompt from this week that disappointed you, find the missing part and rewrite it. Then read Be Clear and Specific for wording, and Show Examples for the most reliable way to get a precise format.