Skip to content
CCAF Preparation

Domain 4 · 20% of the exam · ~12 of 60 questions

Prompt Engineering & Structured Output

Explicit criteria, few-shot prompting, structured output via tool use, validation and retry loops, batch processing, and multi-pass review.

6 lessons·65 practice questions·Flashcards·Cheat sheet

What this domain covers

Not prompt engineering in the tips-and-tricks sense. This domain is about making output reliable enough to put into a downstream system: enforcing shape with a JSON schema through tool use, deciding when a nullable field beats an optional one, and building the validation-and-retry loop that catches what slips through. A recurring exam pattern offers you four fixes for an inconsistent extraction — more instructions, a lower temperature, a confidence threshold, or a few-shot example — and only one of them is the technique the guide endorses.

What the exam asks here

Drawn from the in-scope topic list in the official exam guide.

  • Structured output via tool_use: schema design, tool_choice configuration, and nullable fields to prevent hallucinated values
  • Few-shot prompting for ambiguous scenarios, format consistency, and reducing false positives
  • System prompts with explicit criteria, and why precision comes from stated boundaries rather than added emphasis
  • Validation, retry and feedback loops, including semantic validation errors fed back to the model
  • Batch processing with the Message Batches API: assessing latency tolerance and handling failures by custom_id
  • Multi-instance and multi-pass review architectures for work that one pass cannot verify

The 6 task statements in this domain

  1. 4.1System Prompts with Explicit CriteriaDesign prompts with explicit criteria to improve precision and reduce false positives
  2. 4.2Few-Shot PromptingApply few-shot prompting to improve output consistency and quality
  3. 4.3Structured Output with Tool UseEnforce structured output using tool use and JSON schemas
  4. 4.4Validation, Retry, and Feedback LoopsImplement validation, retry, and feedback loops for extraction quality
  5. 4.5Batch Processing StrategiesDesign efficient batch processing strategies
  6. 4.6Multi-Instance and Multi-Pass ReviewDesign multi-instance and multi-pass review architectures

Common questions about Domain 4

How much of the CCAR-F exam is Prompt Engineering & Structured Output?

20%, or about 12 of the 60 items. Despite the name, very little of it is about phrasing — most questions are about enforcing and validating the shape of what comes back.

How do you guarantee Claude returns valid JSON?

By defining the shape as a tool schema and using tool use to enforce it, rather than asking for JSON in the prompt and hoping. Setting tool_choice to require that tool removes the remaining ambiguity. Nullable fields matter too: a field the model must fill invites a plausible invention when the source genuinely lacks the value.

What actually fixes inconsistent extraction output?

Few-shot examples, in most of the cases the exam presents. Adding more instructions, lowering temperature or introducing a confidence threshold are the standard distractors — they address symptoms. A targeted example showing the ambiguous case handled correctly is the technique the guide endorses.

When is the Message Batches API the right choice?

When the workload is large, asynchronous and tolerant of latency measured in hours rather than seconds — bulk document extraction being the canonical case. It is the wrong choice for anything a user is waiting on. Failures come back keyed by custom_id, which is how you reconcile a partial batch.

Also for this domain