CCA-P start here · Trap gym · Trap 2

Code for musts, prompt for shoulds

D2 · Models, Prompting & ContextGuide lines 2.2, 5.1, 7.1

At a glance: A rule that must hold every time belongs in code or permissions; a prompt rule makes it likely, not certain. Soft preferences stay in the prompt, and judgement calls go to a person.

A system prompt is the right place for role, tone, scope and format. Claude follows clear instructions well, and explaining the reason for a rule helps it handle cases the rule did not list. But a prompt instruction is probabilistic: it makes the right behaviour very likely, not certain. A persistent user, an odd input or a hidden instruction in a document can still push the model past it.

So the first question about any rule is: what happens on the one time in a thousand it is broken? If the answer is a legal breach, a lost sum of money or an unsafe action, the rule must be deterministic: checked in code (inside the tool, in a validator, in a hook) or enforced by permissions, so it holds whatever the model says. In Claude Code the same split exists: CLAUDE.md is guidance the model reads, while permission rules and hooks are enforced by the tool itself.

The trap runs both ways. A hard limit in a prompt is too weak. A soft preference forced into code is too heavy, and a rule with genuine exceptions blocked in code stops the right answers too. When the exceptions need human judgement, a person approves them before the action runs.

Change one fact

An airline's rebooking assistant chats with passengers after cancellations and rebooks them through a tool. Policy caps the extra cost of a partner-airline seat at $400 per passenger, with no exceptions. The system prompt states the cap. In red-team testing, a persistent tester talked the assistant into booking a $900 partner seat. What should the architect add?

Words in the stem that signal this trap

Rule to remember: Ask what happens the one time the rule is broken. If that is unacceptable, enforce it in code or permissions; if it needs judgement, route it to a person first; if it is a soft preference, the prompt is enough.

Practice

Practice 2.1 · Choose one.

A bank's chat assistant answers questions about savings accounts. Regulation requires that every reply quoting an interest rate includes a set risk warning, word for word. The system prompt asks for the warning, and spot checks find it missing in about one reply in two hundred. What should the architect do?

  1. Move the warning instruction to the end of the prompt and add three examples.
  2. Have a compliance officer check a weekly sample of replies and report misses.
  3. Lower the temperature so the model includes the warning more consistently.
  4. Add a code step that appends the exact warning to any reply quoting a rate.
Show answer

Answer: D. The deciding fact: regulation requires the warning in every such reply. A code step makes it deterministic; a prompt can only make it likely.

  • A ❌ Works, but it improves the odds without making the warning certain.
  • B ❌ Works, but a sample finds misses after customers have seen the replies.
  • C ❌ Works, but lower temperature makes output more consistent, not guaranteed.
  • D ✅ Add a code step that appends the exact warning to any reply quoting a rate.
Practice 2.2 · Choose one.

A water utility's assistant sets up instalment plans for customers behind on bills. Plans up to six months follow a fixed rule and start automatically. Longer plans are allowed, but the hardship team decides each one using evidence the assistant cannot verify, such as medical letters. How should longer plans be handled?

  1. Block any plan longer than six months inside the instalment tool.
  2. Let the assistant propose longer plans, and have an officer approve each first.
  3. Tell the assistant in its prompt to agree longer plans for genuine hardship.
  4. Allow longer plans, and send the hardship team a weekly list to review.
Show answer

Answer: B. The deciding fact: longer plans are allowed, but each needs a judgement on evidence the assistant cannot check. A person approves before the plan starts.

  • A ❌ Works for a hard limit, but here it would refuse plans the policy allows.
  • B ✅ Let the assistant propose longer plans, and have an officer approve each first.
  • C ❌ Works, but it hands a judgement on unverifiable evidence to the model.
  • D ❌ Works, but the review comes after plans have already started.
Practice 2.3 · Choose two.

A sales agent drafts and sends follow-up emails to prospects. Legal requires that it never emails anyone on the company's do-not-contact list, which changes daily, and the prompt already says so. Which two controls make this hold every time?

  1. Check each recipient against the live do-not-contact list inside the send tool.
  2. Paste the day's do-not-contact list into the system prompt each morning.
  3. Let the send tool accept only contacts whose consent flag is set in the CRM.
  4. Ask the model to double-check every recipient before it calls the send tool.
  5. Log each email sent and have sales operations review the log every week.
Show answer

Answer: A and C. The deciding fact: the rule must hold every time. A blocklist check and a consent allowlist, both in the send tool's code, enforce it whatever the model decides.

  • A ✅ Check each recipient against the live do-not-contact list inside the send tool.
  • B ❌ Works, but the model may still miss a name, and a long list costs tokens on every call.
  • C ✅ Let the send tool accept only contacts whose consent flag is set in the CRM.
  • D ❌ Works, but a model checking itself is still probabilistic.
  • E ❌ Works, but the review finds the email after it was sent.

Next trap: A bigger model is not the fix → · All traps