Domain 4 · 20% of the exam
Prompt Engineering & Structured Output
Domain 4 measures whether you can turn a requirement into prompt text plus API configuration that produces reliable, machine-consumable output. It covers writing explicit categorical criteria instead of vague or confidence-based instructions, using few-shot examples to pin down output format and ambiguous-case judgment, enforcing schema compliance through tool use with JSON schemas, and closing the loop with validation, retry-with-error-feedback and self-correction fields. It also covers the operational side: matching the synchronous API or the Message Batches API to a workload’s latency requirements, and designing multi-instance and multi-pass review architectures. Its two anchor scenarios are Claude Code in CI/CD (actionable feedback, minimal false positives) and structured data extraction from unstructured documents.
6 statements 18 examples 7 diagrams ~18 min
Take the quiz Study map
Choose a task statement
Each statement is a focused page. Your progress and quiz links still connect through the domain.
- 4.1 1 of 6
Design prompts with explicit criteria to improve precision and reduce false positives
Replace vague quality instructions with decidable categorical criteria the model can apply the same way twice. ~2 min · 3 examples · 1 diagrams - 4.2 2 of 6
Apply few-shot prompting to improve output consistency and quality
When detailed instructions still produce inconsistent output, few-shot examples are the highest-leverage next move — not longer instructions. ~3 min · 3 examples · 0 diagrams - 4.3 3 of 6
Enforce structured output using tool use and JSON schemas
A tool whose input_schema is your output schema — not a prompt asking for JSON — is what makes output schema-compliant. ~3 min · 3 examples · 2 diagrams - 4.4 4 of 6
Implement validation, retry, and feedback loops for extraction quality
A retry without the specific validation error in the prompt is just a re-roll; append the errors so the model can self-correct. ~3 min · 3 examples · 1 diagrams - 4.5 5 of 6
Design efficient batch processing strategies
Batch is a cost-for-latency trade: 50% cheaper, up to 24 hours, no latency guarantee. ~3 min · 3 examples · 2 diagrams - 4.6 6 of 6
Design multi-instance and multi-pass review architectures
A model that just generated code retains the reasoning behind it, so it is unlikely to question its own decisions in the same session. ~4 min · 3 examples · 1 diagrams