Skip to content

Prompts

How to write a good prompt: five elements that make the difference

The five elements of a clear prompt: task, context, input, examples and output format, with a before-and-after example and common mistakes to avoid.

Talqeen wrote this article and no editor has reviewed it yet. Search engines do not see this page until it is reviewed.

A prompt is what you write to a language model to get work done. The model knows nothing about you or your project beyond the prompt and the conversation. Most weak results come from an incomplete prompt, not a weak model. Here are five elements that make a prompt clear.

1. The task: a clear verb

Start with a verb that says exactly what you want: "summarise", "classify", "write a unit test", "review this function". "Help me with this text" leaves the model to guess what help means.

2. The context: for whom and why

Say who will read the output and what it is for. A summary for a busy manager differs from one for a student revising. State any important constraint: the language and its version, that the text will be public, or a length limit.

3. The input: keep it apart from the instructions

Put the text the model works on in a clearly marked place, between triple quotes or simple tags, so it does not mix with your instructions. This also protects you: if the text says "ignore the above", it stays text to work on, not an order to follow.

4. Examples: show what you want

One or two examples are worth a paragraph of explanation. This is few-shot prompting. Pick varied examples so the model does not copy details you did not intend.

5. Output format: describe it precisely

If you want a table, name its columns. If you want JSON, list the keys and their types. A well-defined output is easier to check and to use in your program.

Before and after

Weak:

Write about security.

Clearer:

You are writing for beginner developers building their first web app.
Write a list of the five most common security mistakes they make,
each with one sentence explaining the mistake and one on how to avoid it.
No more than 150 words.

The second names the reader, the task, the format and the length, so the model guesses less.

Common mistakes

  • Contradictory instructions: "be brief" and then "explain every detail". Pick one.
  • Negatives only: "don't be formal" is weaker than "write in a friendly, direct tone".
  • Forgotten variables: if your template has {{name}}, make sure every variable is filled before sending.
  • Trust without checking: a model can present an invented fact as true (a hallucination). Check numbers, names and links before relying on them.

Try it

Take a prompt you use often, add the five elements one at a time, and compare the output after each. You will quickly learn which element matters most for your work. Talqeen's prompt builder starts from these same fields and checks the result without a model.