# How to write a prompt

A good prompt differs from a bad one not in length or politeness but in having everything the work needs — the task, the material, the shape of the answer and what a usable result looks like.

## The five parts of a prompt

Keep this order at hand and fill it in from the top.

1. **The task in one sentence.** A verb and a result: "rewrite", "find the bug",
   "make a table". Not "help me with this text".
2. **The material.** The text, code, data or problem itself. Without it the model
   fills in the gaps, and you later mistake its guesses for your own facts.
3. **Who it is for and why.** Who the reader is, where it will be published, what
   they already know. This decides the vocabulary better than any "keep it
   simple".
4. **The shape of the answer.** Length, structure, language, headings, a table or
   a list. If the result goes into a program, a schema.
5. **Constraints and stop rules.** What not to do; what to write if there is not
   enough information.

The fifth part is the one most often skipped, and it saves the most time. A line
like "if the text does not contain the answer, write 'not in the text'" turns a
confident invention into an honest gap.

## Example one: a piece of writing

Bad:

```
Write a post about the new plan
```

The model knows nothing about the plan, the platform or the reader — you get a
faceless template you will have to rewrite from scratch.

Good:

```
Task: write a LinkedIn post about our new pricing plan.
Material: the "Team" plan — 5 seats, a shared archive,
report export to CSV; do not mention the price.
Reader: owners of small agencies, not technical people.
Shape: 700–900 characters, three paragraphs, no emoji, no
"don't miss out" calls; the last paragraph is one line on what to do next.
Constraint: do not invent features that are not in the material.
```

What changed: there is material, the platform and the reader are named, the
length is set, and the main failure of such texts — adding features that do not
exist — is ruled out.

## Example two: code

Bad:

```
Why doesn't my code work?
```

Good:

```
Python 3.12. The script reads a CSV and crashes.
Code:
    import csv
    with open("data.csv") as f:
        rows = list(csv.DictReader(f))
    print(rows[0]["Price"])
Error: KeyError: 'Price'
Already checked: the file opens and has rows.
Needed: explain the cause and give a corrected snippet,
without rewriting the whole script.
```

What changed: the language version, the full error text, the code itself, the
hypotheses already ruled out, and an explicit limit on how much to change. The
last part matters most — otherwise you get a script rewritten from scratch that
you have to understand all over again.

## Example three: working with a document

Bad:

```
Summarize this
```

Good:

```
Below are meeting notes. Summarize them using this outline:
1) decisions — a bulleted list, one sentence each;
2) who does what and by when — a three-column table;
3) open questions.
Write only what is in the text. If no deadline is given,
put a dash in the date column.
Text: <...>
```

What changed: the structure is set, guessing is ruled out, and the behaviour when
information is missing is described. You can paste this answer straight into a
working document.

## If the answer misses

Do not start with "try again" — with a probabilistic model that is just a second
roll of the dice. Do one of three things.

**Say exactly what is wrong.** "Too long — make it half the length and drop the
intro paragraph" beats "I don't like it".

**Show an example.** One sample of a finished result in the style you want
changes the answer more than a paragraph of description.

**Split the task.** First a plan, which you edit, then the text based on the
approved plan. A long task in one go goes off course more often; [AI
agents](https://skillok.org/topics/ai-agents) are built on the same principle.

Edit the prompt rather than replying in the old conversation: a long thread drags
all the earlier clutter along with it.

## Checklist before sending

* The task is named with one verb, and the result is clear.
* All the material needed is pasted into the prompt, not implied.
* The reader is named.
* The length and structure of the answer are set.
* It says what to do if information is missing.
* The prompt contains no personal data, passwords, keys or other people's
  documents that must not be shown to a third party.
* If the answer goes into a program, there is a format you can parse
  automatically.

## What to check in the answer

Numbers, dates, names and legal references — check against the source. Links —
open them: an address can be invented whole. Quotes — find them in the original.
Code — run it, do not just read it. Claims about your own field deserve extra
attention: a plausible inaccuracy is noticeable in a familiar topic and invisible
in an unfamiliar one.

Remember that an answer sounds equally smooth and confident whether it is right
or wrong, and a hedge like "possibly" is not a sign of doubt — it is just another
chosen phrase. Why it works this way is explained in [what is an
LLM](https://skillok.org/topics/what-is-an-llm).

And a line that no wording can move: medical, legal and financial decisions are
made by a doctor, lawyer or financial adviser with a licence and responsibility,
not by a chat. Where a mistake costs health, money or rights, a person who is
accountable decides. The name of the service — ChatGPT, Claude, Gemini or any
other — changes nothing here.

## Step-by-step plan

1. **Write the task in one line** — A verb plus a result; if the line will not come together, the task is not defined yet.
2. **Paste in the material** — Copy the text, code or data into the prompt in full instead of describing it.
3. **Set the shape and a stop rule** — Length, structure and what to do when information is missing — three lines that save a round.
4. **Run the checklist** — Before sending, go through the seven points, especially the one about personal data.
5. **Fix the prompt, not the chat** — When the answer is bad, edit the original prompt and send it again from a clean start.
6. **Fact-check the answer** — Open the links, check the numbers, run the code — only then use it.

## Check yourself

1. Which part of a prompt is most often missing when a model "makes up" details about your product?
   - The material: the actual facts were not included in the prompt
   - A polite greeting to the model
   - Telling the model it is an expert
2. Why add the line "if the text does not contain the answer, say so" to a prompt?
   - To give the model an acceptable way out instead of a plausible invention
   - To make the answer faster
   - So the model remembers the text for the future
3. The answer came out too long and off the point. What helps most?
   - Fix the original prompt: state the length, the structure and what to leave out
   - Write "try again" and hope for a different result
   - Send the same prompt to another service

## Sources

- [Anthropic documentation](https://docs.anthropic.com/) — Prompt examples and structuring instructions
- [OpenAI documentation](https://platform.openai.com/docs/) — Response formats and generation parameters

---

https://skillok.org/articles/en/how-to-write-a-prompt
