Lesson 01.05 · Phase 01 · LLM Foundations for Agents

System prompts as contracts

A system prompt is a spec. Write each rule so it can be tested, then test it, because "be helpful and concise" can't fail and so can't be checked.

Learning objectives

  • Write a system prompt as a contract: role, scope, numbered rules, output format, and an exact out-of-scope reply.
  • Turn each rule into an automatic check, and run a test suite of user inputs against a real model.
  • Compare two prompts by pass rate, measured over several runs.
  • Catch the two ways a prompt fails: rules ignored, and rules over-applied (refusing what's in scope).

Most system prompts read like a wish: "You are a helpful and friendly support bot for Acme. Be concise." It sounds fine, and you can't tell whether it works. Concise how? What happens with off-topic questions? With "ignore your instructions"? With a customer demanding a refund the bot can't give?

Loading the full lesson…