← All chaptersChapter 2 of 8

Designing and Testing Robust Prompts

You create prompts that not only give one nice answer but remain reliable across different inputs.

After this chapterYou can build a professional prompt architecture, use examples purposefully, and compare versions with a small test set.
Your progress0 of 40 lessons
2.1

The anatomy of a professional prompt

Combine result, context, output, limits, and control; only use parts that change the risk or usability.

A professional prompt is a transfer of work. Start with the end result and then add the relevant context, desired output format, and necessary boundaries. Indicate which source information is leading and what should be done in case of missing data.

A role can guide perspective or jargon, but it does not prove expertise. Therefore, it is better to use concrete assessment criteria rather than an impressive job title. Conclude important tasks with a control instruction: report missing information, unsupported claims, and deviations from the assignment separately.

  • Result
  • Relevant context
  • Usable format
  • Real boundaries
  • Post-check
This is how you can use this

An analysis prompt defines decision, sources, criteria, and uncertainties; it does not only ask for 'deep thinking'.

Try this prompt
Result: [result]. Context and sources: [context]. Output: [form]. Limits: [limits]. Check before completion: [criteria]. Mark missing information and do not invent source facts.
Quick knowledge check

What makes a role in a prompt valuable?

Your practical assignment

Build a complete prompt for a real task and remove any part that has no effect.

2.2

Using examples without blindly copying

Making examples makes the pattern and quality level concrete, but incorrect or incidental properties should not be elevated to a rule.

With example-driven instruction, you show input and desired output. This is especially helpful for classification, fixed formats, tone of voice, and exceptions. Choose examples that together cover the normal cases and important boundaries.

Explain what the model should adopt from an example: structure, level of detail, criterion, or tone. Do not automatically reuse names, facts, or incidental wording. Include at least one unusual or incomplete case and define the correct behavior, for example 'insufficient information' instead of guessing.

  • Representative examples
  • Name desired feature
  • Include edge case
  • No unwanted fact copying
This is how you can use this

An email classification shows examples of a general question, a complaint, an ambiguous question, and an out-of-scope message.

Try this prompt
Learn from the examples below exclusively [features]. Do not take over names or facts. Classify the new input into [categories]. If no category fits, answer OUT_OF_SCOPE and motivate briefly. Examples: [examples].
Quick knowledge check

Why do you add an edge case?

Your practical assignment

Create three examples and one edge case for your own classification or formatting task.

2.3

Requesting verifiable intermediate steps

Ask for relevant pieces of evidence and reasons for decisions, not for a hidden internal thought process.

For professional work, you want to be able to trace what an outcome is based on. Therefore, ask for source extractions, assumptions, calculations, decision criteria, and a concise justification. You can check such artifacts without pretending that a generated explanation fully reveals the actual internal reasoning process.

Choose intermediate steps that locate errors. In a comparison, these are, for example, criteria, source values, missing data, and scores. In a text check, these are claims, evidence, and suggested corrections. A long line of thought is not evidence; verifiable data and repeatable tests are.

  • Source extraction
  • Assumptions separately
  • Calculation or criterion
  • Concise justification
  • Remaining uncertainty
This is how you can use this

When choosing a supplier, do not ask for 'all thoughts', but for source values, weights, calculation, and sensitivity analysis.

Try this prompt
Analyze [question]. Show: 1) used source facts, 2) necessary assumptions, 3) applied criteria or calculations, 4) concise reason for the conclusion, and 5) remaining uncertainties. Do not invent missing values.
Quick knowledge check

What is the strongest audit evidence?

Your practical assignment

Rewrite one prompt so that it produces five verifiable intermediate outputs.

2.4

Building a small but strong test set

Test normal cases, boundaries, and failures before reusing a prompt.

A prompt that handles one example correctly is not yet a reliable workflow. Create a test set with representative input, a difficult case, missing information, conflicting sources, and possibly an inappropriate instruction in the source material. Define in advance for each test what minimally correct behavior is.

Do not use real sensitive data when fictional examples suffice. Evaluate both content and safety: does the output follow the schema, are facts not being made up, does the source content remain subordinate to the task, and does the workflow stop where it should? Save failed examples as regression tests.

  • Normal case
  • Incomplete case
  • Contradiction
  • Out of scope
  • Unreliable source instruction
This is how you can use this

A summarization prompt is tested with a normal report, missing conclusions, conflicting data, and a document containing instructions for the AI.

Try this prompt
Design six tests for [workflow]. For each test, provide input type, expected behavior, forbidden behavior, and evidence criterion. Use fictitious data. Include one prompt-injection-like source fragment.
Quick knowledge check

When is a failed test valuable?

Your practical assignment

Create a test set of six cases and have a colleague dispute one expected outcome.

2.5

Fairly comparing prompt versions

Change one important element per round and compare based on pre-established criteria.

Do not compare prompt versions based on feeling or on a single random answer. Use the same test set and the same evaluation criteria. Preferably change only one factor, such as source instruction, output schema, or error handling. That way you will know which adjustment likely made the difference.

Record version number, change, reason, tests, and known limitation. Measure not only quality but also correction work, consistency, and required time. A version with a higher average score can still be unsuitable if it handles one critical edge case incorrectly.

  • Same test set
  • One main change
  • Criteria before test
  • Critical errors separately
  • Version log
This is how you can use this

Compare v1 without source labels with v1.1 with source labels; do not simultaneously change tone, length, and task sequence.

Try this prompt
Compare prompt v1 and v2 on [testset]. Score per test: adherence to instructions, use of sources, completeness, safety, and recovery work. List critical errors separately; do not use an average to hide a knockout error.
Quick knowledge check

Why do you preferably change only one main element?

Your practical assignment

Test two prompt versions on the same five cases and write a short change decision.

Chapter assignment

Bring everything together

Build a prompt v1, a test set with six cases, and a v1.1 in which you correct one demonstrable weakness. Document result, regression test, and remaining limitation.