Lesson 2 · 7 min
Structured Output
JSON mode, schema-guided generation, and post-validation.
For machine-readable output, give Claude an example *and* a schema. JSON-mode + Zod validation in code is the safest combo: model produces JSON, code parses and validates, retry on parse error with the validator's message.
Quick check
Prompt EngineeringSelect one
How long does Anthropic's prompt cache persist by default?
