Domain 4 · 20% of the exam
Prompt Engineering & Structured Output
Craft prompts with explicit criteria, apply few-shot prompting, enforce structured output with tool use and JSON schemas, and build validation, retry, batch, and multi-pass review architectures.
4.1 System Prompts with Explicit Criteria
Fix a noisy reviewer by replacing vague confidence language with explicit, categorical report-vs-skip criteria and concrete examples — not by telling the model to "be conservative."
4.2 Few-Shot Prompting
When instructions alone give inconsistent format or judgment, add 2–4 targeted examples that show the reasoning — the most effective technique for consistency, generalization, and reduced hallucination.
4.3 Structured Output with Tool Use
Guarantee schema-valid output with tool_use + a JSON schema — it eliminates syntax errors (not semantic ones) — and design the schema with nullable/optional fields and enum + "other"/"unclear" patterns to prevent fabrication.
4.4 Validation, Retry & Feedback Loops
Catch semantic errors that tool_use can't, then retry with the exact error and the original document — but recognize that retry can't conjure information that is simply absent from the source.
4.5 Batch Processing Strategies
Route latency-tolerant, non-blocking work to the Message Batches API for 50% savings — but never batch a blocking gate like a pre-merge check, where someone is waiting.
4.6 Multi-Instance & Multi-Pass Review
Review generated code with an independent Claude instance that lacks the generator's reasoning context, and split large multi-file reviews into per-file passes plus a separate integration pass.