When to use it

Use this prompt before you put a prompt into an app, a customer-facing chatbot or an automated workflow. It is also helpful after changing a prompt or switching models, to check that nothing broke. A prompt that works on the three examples you tried by hand often fails on the first unusual input a real user sends; this prompt helps you find those inputs first.

How to customize it

  • [THE PROMPT UNDER TEST] should be the exact text you will use, including any system prompt.
  • [WHAT IT IS FOR] lets the generator create realistic inputs rather than generic ones.
  • [WHO SENDS THE INPUTS] changes the risk profile: public users need many more manipulation tests than internal staff.
  • [EXPECTED BEHAVIOR RULES] become the checks for each test. Write them as statements you can verify.
  • [NUMBER] can start small. Twenty-five good tests are more useful than two hundred similar ones.

Why it works

Developers naturally test the cases they had in mind when writing a prompt. Asking for named groups, including edge cases, ambiguity, scope and manipulation, forces coverage of the inputs that usually cause failures. Writing the expected behavior and the failure mode for each test turns a list of inputs into a real test suite you can run again.

The manipulation group is a lightweight form of red teaming. It will not replace a professional security review, but it catches the common problems, such as a prompt that reveals its instructions or abandons its format when asked. Our explainer on prompt injection and LLM security describes why these attacks work.

Tips and variations

  • Run every test, record the actual outputs, and score them with a rubric or by hand.
  • Add every real failure from production to the test set so it can never come back unnoticed.
  • Ask the generator for a second round focused only on the group where most failures occurred.
  • Combine with an evaluation set built from real user data, as described in our guide to building an evaluation set for LLM apps.
  • Keep the tests in version control next to the prompt.