Study guide for the CCA-F prompt domain: system prompts, few-shot, XML structure, reasoning, JSON schemas, tool_choice and validation-retry.
Prompt Engineering & Structured Output is 20% of the Claude Certified Architect – Foundations blueprint, about 12 questions per 60-question form. It is the most familiar domain for many candidates, but the exam pushes past wording tips into production concerns: output that code can parse, schemas that do not force hallucination, and changes you can measure.
What the domain covers
Clear, explicit instructions. State the context, the task, the criteria and the output format. "Review this code" produces generic reviews; a prompt that names the language, the review criteria, the severity scale and the format of each finding produces consistent ones. When a rule has a reason, give the reason: absolute rules without context are applied in situations their authors never intended.
System prompt versus messages. Stable instructions — role, policies, tone, tool guidance, escalation rules — belong in the system prompt. Per-request content belongs in messages. Long inputs are easier for the model to handle when separated with clearly named XML-style tags, so instructions, documents and examples cannot be confused with each other.
Examples and reasoning. A few varied examples that include the hard edge cases show the model where boundaries are drawn. For multi-step problems, give the model room to reason before it commits — extended thinking or a separate reasoning section — and parse only the final answer.
Structured output. When downstream code needs JSON, constrain the shape: define a tool whose input schema is the target object and force it with tool_choice naming that tool, or use the structured-output feature. Know the tool_choice options: auto (Claude decides), any (must call some tool), a specific named tool, and none. Design schemas for honesty: make fields nullable when the source may not contain them, and use enums for fixed vocabularies.
Validation and retry. Always validate output in code. On failure, retry with the specific error — which field, which rule — rather than resending the same request, cap the retries and send persistent failures to review. Check stop_reason: "max_tokens" means truncated output, which needs a higher limit or a smaller input.
Throughput and cost. Large, non-urgent jobs fit the Message Batches API, which processes requests asynchronously at a lower price. Interactive features need the standard API.
Evaluation. Prompts are tuned empirically. Build an evaluation set from representative inputs, including edge cases, measure before and after each change, and watch for regressions. Optimising for five hand-picked examples is overfitting.
How questions are framed
Many questions present an output defect — inconsistent labels, invented values, broken JSON, generic reviews — and ask for the most effective fix. Distractors tend to be emphasis ("IMPORTANT", repetition), sampling changes (temperature) or post-hoc patching. Prefer answers that change what the model is given or how output is constrained and verified.
Study checklist
- Rewrite a vague prompt with context, criteria, format and examples.
- Build a forced-tool extraction with a nullable field and an enum.
- Write a validation-retry loop that feeds back the exact error and stops after a limit.
- Explain when you would use the Batches API.
- Create a ten-item evaluation set for a classifier and track its score across prompt versions.
Domain weights and the 60-question form size come from published summaries of Anthropic's exam guide, which is available to registered partners; see our exam guide page for what is confirmed by Anthropic's public FAQ.
Free sample questions: Prompts & output
Original questions written for practice, not real exam items. Each one appears again, with fresh option order, in the full practice exam.
Sample question 1
Scenario: Structured data extraction
An extraction pipeline must always return JSON matching a fixed schema so downstream code can parse it. Which approach gives the most reliable structure?
- A. Ask for valid JSON in the prompt, include the schema, and parse whatever comes back
- B. Set a very high max_tokens so the JSON object is never cut off before it closes
- C. Ask for a markdown table and convert it to JSON with a regular-expression parser
- D. Require a tool whose input schema is the target object, then validate the result
Show answer and explanation
Answer: D. Schema-constrained output — a tool with an input_schema that Claude must call, or the structured-output feature — makes the shape explicit, and validation in code catches what remains. Prompt-only JSON requests fail occasionally; regex over tables is brittle; a large max_tokens prevents truncation but not schema errors.
Sample question 2
Scenario: Structured data extraction
You defined a record_invoice tool and want Claude to call exactly that tool on every request, never answering in prose. Which tool_choice setting achieves this?
- A. {"type": "tool", "name": "record_invoice"}, which forces that specific tool
- B. {"type": "none"}, with record_invoice described in the system prompt instead
- C. {"type": "auto"}, with a system prompt that tells Claude to always use record_invoice
- D. {"type": "any"}, which requires Claude to call one of the tools in the request
Show answer and explanation
Answer: A. Naming the tool forces Claude to call that specific tool. "auto" lets Claude decide whether to use a tool at all; "any" forces some tool call but lets Claude pick which, which matters as soon as other tools are present; "none" prevents tool use. (Forced tool choice is not compatible with extended thinking in the same request.)
Sample question 3
Scenario: Structured data extraction
Your validator finds that an extracted record is missing the required due_date field. What is the most effective retry strategy?
- A. Resend the identical request, since a second sample will often include the field
- B. Fill in today's date so the record passes validation and can continue downstream
- C. Retry with the input plus the exact validation error, and cap the number of retries
- D. Retry with a higher temperature so the model is more likely to produce a new answer
Show answer and explanation
Answer: C. Validation-retry works best when the model gets precise feedback about what failed, with a retry cap and a review queue for persistent failures. Resending the same request repeats the same conditions; raising temperature adds randomness rather than information; inventing a value silently corrupts data.
Sample question 4
Scenario: Structured data extraction
Some invoices genuinely have no due date. With a schema that requires due_date as a string, Claude sometimes invents plausible dates. How should you change the design?
- A. Make due_date nullable and instruct Claude to return null when it is not stated
- B. Add a few-shot example in which every invoice shown includes a due date
- C. Tell Claude to infer the most likely due date from the invoice date and payment terms
- D. Remove due_date from the schema and calculate it later in downstream code
Show answer and explanation
Answer: A. If the schema forces a value that may not exist, the model is pushed to fabricate one. A nullable field with a clear instruction makes absence representable and keeps extraction faithful. Inference invents data the document does not state, removing the field loses dates that do exist, and always-filled examples reinforce the problem.