Home/Blog/AI Tools at Work
AI Tools at Work · 11 min read

How to write and test AI prompts that work reliably

The short answer

To get reliable results from ChatGPT, Claude, Gemini or Copilot, write each prompt with six parts (role, task, context, constraints, examples and output format), give sources and ask for quotes, then run it on a fixed set of 10-30 real cases scored with the same rubric. Keep the approved outputs as a baseline and re-test whenever the model, tool or prompt changes.

Want the tools, not just the method? The The Prompt Engineering Practitioner Kit kit turns this guide into ready-to-use templates, spreadsheets and printables, with an instant download.

Key takeaways
  • One good output proves nothing: the same prompt can give different answers
  • Six parts: role, task, context, constraints, examples, output format
  • Test sets and rubrics turn opinions into evidence
  • Save a baseline and re-test after every model or tool change
  • Prompt injection cannot be fully prevented: limit what assistants can do
  • Decide what may be pasted where before writing prompts

What are the steps to write a reliable prompt?

A reliable prompt is not one that worked once. It is one that has been run on a fixed set of realistic cases, scored the same way each time, compared with the previous version, and re-tested whenever the model, the tool or the prompt changes. The steps below turn that into a routine any team can run without code, although a short script makes it faster.

The first two steps protect your data and your readers. The middle steps make the prompt good. The last steps keep it good, which is the part most guides leave out.

  • 1. Decide what may be pasted into which tool, on which account.
  • 2. Write the prompt with six parts: role, task, context, constraints, examples and output format.
  • 3. Give sources inside tags and ask for quotes; tell the model to say NOT FOUND.
  • 4. Build a test set of 10-30 real cases, including the hard ones.
  • 5. Write a rubric with a few criteria scored 0-2 and mark which are critical.
  • 6. Score two versions on the same cases and keep the better one.
  • 7. Save the approved outputs as a baseline and re-run after every change.
  • 8. Record the prompt in a register with an owner, a version and a review date.

Why does the same prompt give different answers?

A language model predicts the next chunk of text, called a token, again and again. Most chat tools add a little randomness when choosing, so the same prompt can produce different words, and sometimes different facts. Vendors also update the models behind their products. Microsoft's own Copilot guidance tells users to expect different results when they run the same prompt again.

Two further facts matter. Likely text is not always true text: NIST calls confident false output confabulation, and researchers have argued that common benchmarks reward guessing over admitting uncertainty. And the model only uses what is in its context window, the text it can see at once. If your policy is not in the prompt or in files the tool retrieves, the model fills the gap with something plausible.

The practical lesson is that one good output proves nothing. You need the same cases, scored the same way, every time.

What are the six parts of a strong prompt?

Role says who the model should act as. Task is one instruction starting with a verb. Context is what you paste, wrapped in tags such as <ticket> and <article> so the model knows where each source starts and ends. Constraints say what must never happen and what to do when information is missing. Examples show one to three short outputs that look right. Output format gives the exact shape: word limit, columns or JSON keys.

The vendors use different words for the same ideas. Microsoft describes a Copilot prompt as goal, context, source and expectations. OpenAI recommends separating standing instructions from user input, marking sections with Markdown or XML-style tags, and giving examples. Google recommends examples in its Gemini guidance. Anthropic's guide starts by assuming you already have success criteria and a way to test them. A prompt written with the six parts travels between tools because it answers all of them.

Small details matter more than you would expect. One study found that changing only the formatting of a prompt moved accuracy by up to 76 points for one open model. You cannot reason your way to the best wording; you have to test it.

How do you test a prompt without writing code?

Collect 10 to 30 real inputs with personal details removed, including past failures and awkward cases. For each, write the facts a good answer must contain and one claim it must never make. Then write a rubric: for example, key points covered, grounded in the source, format and length, tone, and safety, each scored 0, 1 or 2. Mark the criteria where a zero fails the case whatever the total.

Run each version of the prompt on every case, paste the outputs into a spreadsheet, and score them. Hide which version wrote which output when people score, and swap the order for half the cases, because graders favour the first or the longer answer. A short script can do the rule-based checks (key phrases, word limit, banned phrases) in seconds, and a person should still read a sample every time.

Worked example: how much does testing change the result?

Northpeak is a fictional 90-person software company in Austin, Texas, used throughout The Prompt Engineering Practitioner Kit. Its support team uses an AI assistant to draft first replies to tickets. The numbers below are SAMPLE results from the kit's practice files, scored by the same rubric on the same 20 cases: a pass needs 8 of 10 points with no zero on grounding or safety.

The one-line prompt passed 6 of 20 cases. The six-part version passed 13. Adding tags, an escalation list, one example and a word limit took it to 18 with no critical failures. Then the vendor updated the model, and the same prompt fell to 15 of 20 with three new critical failures, two of them invented refund periods. A two-line fix took it to 19. Without the test set, the team would have learned about the update from customers.

VersionCases passed (of 20)Pass rateCritical failuresEdit minutes per draft
One line630%96.5
Six parts1365%54.6
Six parts + tags, rules, example1890%03.1
Same prompt, updated model1575%3not measured
Two-line fix (v3.1)1995%03.0

What should you do when the AI model changes?

Assume it will. Researchers comparing two versions of the same named models a few months apart found that one model's accuracy at identifying prime numbers fell from 84% to 51% and its instruction following declined. OpenAI recommends pinning production applications to dated model snapshots and building evaluations to measure prompt behaviour as models change. In a chat tool you often cannot pin a version, but you can always re-run your test set.

Keep the outputs of every approved prompt as a baseline. After any known update, tool switch, setting change or prompt edit, re-run the cases and compare. Write the rule down in advance: for example, a drop of more than 5 points in pass rate, or any new critical failure, is a regression. Then act in proportion: pause the prompt for risky topics, pin or roll back if you can, fix forward with a small tested change, and tell users what to watch for.

Measure where you are

Reading helps; measuring tells you what to work on. These AI-graded assessments on AssessAll pair with this topic:

What should you never paste into an AI assistant?

Start with your organisation's rules and the terms that apply to your account. Work accounts often come with business terms that differ from consumer ones, so the same tool can be fine for one kind of data on one account and not on another.

Regulators are consistent on the basics. Australia's privacy regulator recommends, as best practice, not entering personal information, especially sensitive information, into publicly available generative AI tools. Canada's federal guide tells public servants not to enter personal information into public tools, and New Zealand's Privacy Commissioner expects no personal or confidential information in tools unless the provider confirms it is not retained or disclosed. A simple rule set: public data anywhere; internal and confidential data only in approved tools on work accounts; personal data only with a lawful purpose and minimised; health, payment card numbers, passwords and keys never.

What is prompt injection and should business users worry?

Prompt injection is text that tries to make a model ignore its instructions. Direct injection comes from the person typing. Indirect injection is hidden in content the assistant reads, such as an email, a web page or a file. OWASP ranks prompt injection first among the risks for applications built on language models.

The UK National Cyber Security Centre warns that models do not separate instructions from data, so prompt injection may never be fully mitigated, and recommends designing to reduce its likelihood and impact. For business users that means least privilege: an assistant that reads outside content should not send, pay, delete or share without a person approving it. Mark outside content as information inside tags, check outputs against policy, and test with a few hostile inputs before go-live.

How do you manage prompts as a team?

Give every shared prompt a row in a register: an ID, a plain name, an owner, the tools it has been tested on, a version number, a status (Draft, Tested, Approved or Retired), the date it was last tested, its pass rate, the data class it may handle and a review date. Store the exact text as a plain file with a short header, so you can compare versions line by line and paste it into any tool.

Never edit an approved prompt in place. Copy it, change the copy, give it a new version, run the full test set, compare it side by side with the approved version, and only then replace it, with a short change note saying what changed and why. A retired prompt goes into an archive rather than the bin, so you can see what used to work.

Before a prompt goes to the whole team, run a short go-live check: owner and version recorded, data class set, test set and rubric in place, target pass rate met with no critical failures, baseline saved, injection tests run if it reads outside content, a name-swap bias check if it writes about people, and a written human-review rule. Brief people before they get access, because a library is only as safe as the review habits of the people using it. If leadership asks for a business case, measure your own edit times before and after and show a low case first, rather than borrowing a percentage from a study of different tasks.

What are the most common prompt engineering mistakes?

Most mistakes come from treating prompting as a one-off rather than a practice.

  • Trusting a fluent answer without checking its source.
  • Shouting with capital letters instead of adding the missing constraint or format.
  • Examples that are all alike, so the model copies their content.
  • One prompt that tries to do the whole job, with nowhere to check the middle.
  • A test set built only from cases that already work.
  • Editing a shared prompt in place, so nobody knows what changed.
  • Waiting for complaints to learn that the model changed.
  • Judging fairness from one or two outputs per name.
Bodhih Pro Kit

Turn this method into a working practice

The Prompt Engineering Practitioner Kit gives you the workbook, the no-API-key scorer, the test set, templates and 212 prompts to run every step above with your own team. Plan your growth with Jobulary's individual development plan.

Common questions

Questions people ask next

What is the best prompt for ChatGPT, Claude or Gemini?

There is no single best prompt. A prompt is good for a task if it passes your test cases, and the same wording can behave differently across tools and model versions. Write with six parts and test.

How many test cases do I need for a prompt?

For most business prompts, 10 to 30 realistic cases, including past failures and edge cases. Use more for customer-facing or high-volume prompts. Fewer cases with the hard ones beat many easy cases.

Can I use an AI model to grade AI outputs?

Yes, with care. Research on model judges found strong agreement with human preferences but also position, length and self-preference biases. Use a detailed rubric, swap the order of compared answers, prefer a different model as grader and check it against your own grades first.

How do I stop an AI assistant making things up?

You cannot stop it completely. Give it the sources, tell it to use only them and to reply NOT FOUND when they do not answer, ask for a quote with each claim, and check the quote in the original.

Do prompts written for one tool work in another?

Often, if they are written with the six parts and no tool-specific tricks, but test them on each tool you use. Approve a prompt for the tools it has been tested on, not for AI in general.

Is there a law about using AI prompts at work?

Not about prompts as such, but privacy law applies to personal data in prompts and outputs in most markets, and the EU AI Act asks organisations using AI to take measures for staff AI literacy. Check local rules with your adviser.

How do I measure my prompt writing skills?

Score yourself against a list of practices first. For an independent measure, AssessAll's Task Specification and Prompt Writing Work Sample tests the skill directly.