Home / Claude Certified Architect – Foundations / Objective 4.2

Domain 4: Prompt Engineering & Structured Output · 20% of the exam · Full exam outline

4.2 Apply few-shot prompting to improve output consistency and quality

What this objective covers

Few-shot examples as the most effective technique for achieving consistently formatted, actionable output when detailed instructions alone produce inconsistent results. The role of few-shot examples in demonstrating ambiguous-case handling (e.g., tool selection for ambiguous requests, branch-level test coverage gaps). How few-shot examples enable the model to generalize judgment to novel patterns rather than matching only pre-specified cases. The effectiveness of few-shot examples for reducing hallucination in extraction tasks (e.g., handling informal measurements, varied document structures). Creating 2-4 targeted few-shot examples for ambiguous scenarios that show reasoning for why one action was chosen over plausible alternatives. Including few-shot examples that demonstrate specific desired output format (location, issue, severity, suggested fix) to achieve consistency. Providing few-shot examples distinguishing acceptable code patterns from genuine issues to reduce false positives while enabling generalization. Using few-shot examples to demonstrate correct handling of varied document structures (inline citations vs bibliographies, methodology sections vs embedded details). Adding few-shot examples showing correct extraction from documents with varied formats to address empty/null extraction of required fields.

Practice questions

Question 1easy

A prompt pastes four sample ticket-and-answer pairs directly between the task instructions and the live ticket. Claude sometimes treats a sample ticket as part of the request it must answer. What fix does the guidance recommend?

Included in Sample: sample every domain.See plans

Choose an answer to check it. Afterward, select any option to review its explanation.

Relocating unlabeled samples does not mark where each one starts and ends, so Claude still has nothing that separates them from the real request.

Making samples look like instructions blurs the boundary even more; the goal is to make them clearly distinct.

Dropping the examples throws away a reliable way to steer format. The problem is the missing boundaries, not the examples themselves.

Structured examples, each in its own example tag and grouped in an examples tag, let Claude tell samples apart from instructions and from the live input, which is exactly the confusion described.

Question 2easy

A feedback classifier labels messages as complaint or praise. It handles most messages well, but rhetorical questions such as 'Why would anyone ship a charger this good?' are often labeled complaint. What should the team add to the prompt?

Included in Master: master every domain.See plans