AI Simplified Series
Blog · · 3 min read

How to Write Better AI Prompts: Five Parts Every Good Prompt Needs

Most weak AI answers come from one of three problems. The request was vague. The model did not have the facts it needed. Or two instructions pulled in opposite directions. Prompt engineering, without the mystery, is a simple habit. You decide what a good answer should contain, and you write that down in a plan you can reuse.

There are no magic words

No phrase makes a model smarter. Those packs of hundreds of "secret prompts" are mostly a few instructions in a different order. What helps is being complete. A short question leaves gaps, and the model fills them with the most average choices.

The five parts

One plan that works has five parts. Treat it as a good starting habit, not a law. Change it to fit your task.

  1. Role. Who the model is writing as, and for whom. This sets the words it uses and what it treats as obvious.
  2. Context. The facts of your situation that the model cannot know. Think numbers, names, limits, and what you already tried.
  3. Task. One job and one verb. If your sentence needs an "and," you may have two prompts.
  4. Format. The exact shape of the answer, so you can use it right away. It might be a table, five bullets or a 100-word email.
  5. Guardrails. The limits. Say what to leave out, what not to make up, and what to do when the facts run out.

A before-and-after

Before: "Write a project update."

The result is smooth and generic, and it is full of made-up milestones. The model had no facts to work with.

After:

  • Role: you are a project manager writing to a nervous client.
  • Context: the website launch moved from March 4 to March 18 because the payment provider's test system was down for a week.
  • Task: write the update email.
  • Format: four short paragraphs. What changed, why, the effect, and what I need from you.
  • Guardrails: use only the facts above. Write UNKNOWN if something is missing. Apologize once.

The second version takes about a minute longer to write. It saves you the rewrite.

Swap adjectives for tests

Words like "professional," "engaging" and "high quality" give the model nothing to act on. Replace each one with something you can check. Try "open with the reader's problem in one sentence" or "no sentence longer than 20 words." If two instructions might clash, such as "keep it short but cover everything," say which one wins.

Send less and label more

Models do not give a long paste equal attention. Some research has found that facts in the middle of a long input are often missed more than facts at the start or end. Results vary by model. Send only the pages that matter. If you must send a lot, add clear headings and refer to them by name.

Show examples

If you want a certain style or shape, show one or two finished examples instead of describing it. For jobs you repeat, move the steady instructions into your tool's custom settings. Then keep a small library of tested prompts, with the parts that change clearly marked.

Watch for orders hidden in documents

When a model reads a web page, an email or a file, text inside it may try to give the model orders. This is called prompt injection. Keep your own instructions apart from the material. Tell the model to treat the material as data only. Review anything that triggers an action.

Keep reading

Each book in the On-Ramp stands alone. These four cover the neighbouring ground.

More from the blog

Written by Dhi Sattva. This article is an original introduction to a topic and does not reproduce the book. It is general information, not legal, financial, medical or professional advice.