Whetstone.
Sign in
All courses
promptingIntermediate

Prompt, Context and Safety on Claude

Four exam domains in one course: Prompt and Context Engineering (11.0%), Security and Safety (8.1%), Claude Code (3.1%) and Debugging (2.6%). You learn the consolidated prompting docs as they actually exist today, the long-context ordering rule with the number attached to it, the caching economics that decide whether your prompt caches at all, the catalogue of things that now hard-400, and the security material that separates someone who read the docs from someone who shipped.

10 lessons 214 min
PCCrash course
Curriculum

10 lessons across 4 modules

Capstone

Audit and rebuild one real prompt end to end

The capstone

Take one prompt you have actually shipped. Not a toy. Something with real inputs, real users, and a bill attached. Then run it through every domain in this course and write the audit down.

Part 1: the prompt itself

Rewrite it against the consolidated best-practices structure. Specifically:

  • Is the instruction clear and direct, or is it hedged prose that a reader would have to interpret?
  • Does it carry 3 to 5 examples, wrapped as <example> inside <examples>?
  • Is it structured with XML tags, using <instructions>, <context> and <input> rather than markdown headers and hope?
  • Does it give Claude a role that does real work, or a decorative one?
  • Does it contain leftover "CRITICAL: You MUST" tool language that current models overtrigger on?
  • If it targets Opus 5, does it still contain self-verification instructions that the model no longer needs?

Part 2: the context layout

Measure the prompt. If it is 20k tokens or more, the longform data belongs at the top, above the query, the instructions and the examples. Move it if it is not already there, and note what you had to reorder.

Then wrap the longform data properly: <documents>, then <document index="n">, then <source> and <document_content> inside each.

Part 3: the money

Work out whether your prompt actually caches.

  1. What is your model's minimum cacheable prompt length? Look it up, do not infer it from the tier.
  2. Is your static prefix above that minimum? If not, it is silently not caching and nothing has ever told you.
  3. At 1.25x write / 0.1x read for the 5 minute TTL, how many reads per write do you need before caching pays for itself? Do the arithmetic and write down the number.

Part 4: the failure modes

Grep your codebase for every one of these, and record whether you are exposed:

  • assistant prefill on the final assistant turn (400 on 4.6+)
  • thinking.type: "enabled" with budget_tokens (400 on 4.7+)
  • non-default temperature, top_p or top_k (400 on Opus 4.7+)
  • citations together with structured outputs (400)
  • output_format where output_config.format is now current

Part 5: the security pass

For every place untrusted text reaches the model, answer three questions in writing:

  1. Where does untrusted content enter the context, and is it delimited and labelled as untrusted?
  2. Is there any secret in a prompt, a system prompt, a tool definition, or a sandbox? Name it and get it out.
  3. If the model is compromised by injected instructions, what is the worst tool it can reach, and what stops it?

Done looks like

A written audit with a finding for every part, at least one concrete change you made to the real prompt, and one number you computed yourself rather than read. If you finish and every section says "already fine", you picked a prompt that was too easy. Go get a worse one.

Your progress0%

0 of 10 lessons complete

prompting
context
security
claude-code
debugging