# Prompt writing that gets reliable results

Source: https://sarang.pro/prompt-writing-reliable-results/
Author: Sarang | Published: 25 October 2026

Most disappointing AI output starts with a vague request. "Write a product description" gives the model almost nothing to go on, so it fills the gaps with the most generic text it can produce. Writing a good prompt has little to do with secret phrases. It is much closer to writing a clear brief for a capable new colleague.

Anthropic and OpenAI both publish prompting guides for their models, and they agree on more than they differ. This article pulls out the advice that holds across tools, shows a before-and-after prompt, and explains how to test a prompt so it keeps working.

## Start with what good looks like
[Anthropic's prompt engineering overview](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) assumes three things are in place before you start tuning: a clear definition of success, a way to test against it, and a first draft. Without the first two you cannot tell whether a change to the prompt helped or hurt.

Before you write, jot down three to five things the output must do. For a customer email that might be: answers the question asked, uses the correct refund window, stays under 150 words, sounds like your brand. The same guide also warns that not every problem is a prompt problem. Speed and cost, for example, are sometimes easier to fix by choosing a different model.

## Be clear and direct
Anthropic's guide, [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices), offers a golden rule: think of the model as "a brilliant but new employee who lacks context on your norms and workflows." Their test is simple. Show the prompt to a colleague with little background on the task. If they would be confused, the model will be too.

- **Say exactly what you want.** If you want more than the bare task, such as alternatives or a short rationale, ask for it explicitly.
- **Use numbered steps** when the order or completeness of steps matters.
- **Say what to do, not only what to avoid.** Anthropic suggests replacing "Do not use markdown in your response" with "Your response should be composed of smoothly flowing prose paragraphs."
- **Ask for action when you want action.** "Can you suggest some changes?" may get suggestions. "Change this function to improve its performance" gets changes.
[OpenAI's prompt engineering guide](https://developers.openai.com/api/docs/guides/prompt-engineering) makes a related point about model types. It compares its reasoning models to a senior co-worker who can be trusted with a goal and left to work out the details, and its GPT models to a junior co-worker who needs explicit instructions. The more literal the model, the more precise your prompt needs to be.

## Explain why, and give context
Rules work better with reasons attached. Anthropic's example: instead of "NEVER use ellipses", tell the model the response will be read aloud by a text-to-speech engine that cannot pronounce them. With the reason, the model can apply the idea to cases your rule did not mention.

Useful context usually covers who the output is for, what it will be used for, what the reader already knows, and any constraints such as word limits, tone or legal wording that must not change. If the model needs facts it cannot know, such as your prices, policies or product details, paste them in. No amount of clever wording replaces missing information.

## Show examples
Examples are one of the most reliable ways to get a specific format or tone. OpenAI calls this few-shot prompting and advises showing "a diverse range of possible inputs with the desired outputs." Anthropic recommends three to five examples that are relevant to your real use, varied enough to cover edge cases, and wrapped in tags such as <example> so the model can tell them apart from the instructions.

Models copy examples closely. If every example opens with "Great news!", so will the output. Vary length, opening and structure across examples unless that feature is something you want repeated.

## Give the prompt a structure
Long prompts are easier for a model to follow when the parts are clearly separated. OpenAI suggests a typical order for instructions: identity (the purpose and style), then instructions, then examples, then context. It says Markdown headings and XML tags both work for marking sections. Anthropic recommends XML tags with "consistent, descriptive tag names", such as <instructions>, <policy> and <customer_email>.

The two guides differ slightly on where long material goes. Anthropic advises putting long documents near the top, with your question and instructions at the end, and reports that queries at the end "can improve response quality by up to 30 percent in tests" on complex, multi-document inputs. OpenAI says context is usually best placed near the end of its instruction message. In practice, keep the question or task last and test the order on your own inputs.

## A worked example: before and after
**An example (illustration only):** a small online homeware shop wants product descriptions for its website.

Before:

> Write a product description for our new candle.

The result will be generic, may invent a scent or burn time, and will not match the rest of the site.

After:

> You write product descriptions for an independent UK homeware shop. Our customers are buying gifts and care about natural materials. Write a description for the product in <product> using only the facts given. Do not add features, claims or measurements that are not listed. If something a shopper would expect is missing, list it under "Missing information" instead of guessing.

Format: a one-line headline, then 60 to 80 words of body text, then three bullet points of key facts. British English, warm and plain, no exclamation marks.

<example> [one existing description the shop is happy with] </example>

<product> Name: Fig and Cedar candle. Wax: soy. Burn time: 40 hours. Size: 200g. Made in: Yorkshire. </product>

The second prompt states the audience, the source of truth, the format, the tone, and what to do when information is missing. In a real version you would include two or three more examples in different styles of product.

## Test, then lock it in
A prompt that worked once has not been tested. Run it on 10 to 20 real inputs, including awkward ones, and check each output against the success criteria you wrote at the start. Change one thing at a time so you know what made the difference. Anthropic's guide to [success criteria and evaluations](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests) covers how to turn this into a repeatable test set.

Two further habits help:

- **Build in a self-check.** Anthropic suggests ending with an instruction such as "Before you finish, verify your answer against [test criteria]." For bigger jobs, chain steps: draft, review against the criteria, then revise.
- **Pin the model version.** OpenAI recommends pinning production apps to a specific model snapshot and keeping tests that catch regressions when you change the prompt or upgrade the model.

## Common mistakes
- Writing rules in capital letters instead of explaining the reason behind them.
- Giving one example and getting near-copies of it.
- Burying the actual question in the middle of a long paste.
- Expecting the model to know your prices, policies or customers without being told.
- Judging a prompt on a single run, or changing several things at once.
- Spending hours on a prompt for a one-off task. For a quick question, a plain request is fine. Structure pays off for work you will repeat or publish.