AI Certificates

Domain 2 · 13%

CCAR-P prompting and context engineering, domain 2

Matthew Hartman · CCAR-P certified, scored 965/1000 · 20 min read

Prompting questions on this exam are rarely about wording. They are about what belongs in a prompt at all, and what belongs somewhere the model cannot ignore.

13% of the exam — about 8 of the 63 questions — across 5 sub-objectives.

Domain 2 is smaller than it feels while studying, because prompting is the part of the syllabus with the most material written about it elsewhere. The exam is narrower than that literature. It asks what belongs in a prompt at all, what belongs somewhere the model cannot ignore, and what a context window costs you when it fills.

Four terms get conflated constantly, and several questions turn on keeping them apart. The context window is the model's active attention space. Retrieval fetches external knowledge into that space at query time. Persistent application state, such as an order status or an account balance, is owned by your system and reaches the model only through a tool call. Memory across turns exists because

What the model can actually seeThe context window holds everything the model attends to for one call. Retrieval fetches knowledge into it. A tool call reaches live state a system owns. Memory is text your application stores and replays, because the model keeps nothing between calls.Context windoweverything the model attends to,for this one call onlyRetrievalTool callYour app memorystable knowledge, fetched inlive state a system ownsstored and replayed by youThe model keeps nothing between calls.
Four things that get called the same thing. Only the middle box exists during the call. Everything else is something your application puts there, every time, or the model never sees it.

your application stored something, since the model has none between calls. Mixing these up produces confident, wrong architectures.

Three of these five turned up on my form: system prompts and guardrails, prompt technique, and reuse. Model selection and context-window sizing did not appear at all, which is worth knowing if you are budgeting study time by how much has been written about a topic rather than by how much of it is tested.

Select appropriate Claude models based on trade-offs

Model questions are cost, latency, and capability questions wearing a product name. Opus, Sonnet, and Haiku sit at different points on those three axes, and Sonnet is the sensible default that you move away from deliberately.

The exam rewards a specific discipline: move up only when a quality bar is demonstrably not met, and move down when the task is narrow, high-volume, and latency-sensitive. Scenarios hand you the deciding evidence in the numbers. A tight per-request latency budget, a volume figure in the tens of thousands, and a stable well-documented task all point down the family. Ambiguous reasoning over long documents with a low tolerance for error points up.

The common wrong answer reaches for the most capable model because the domain sounds important. Legal, medical, and financial scenarios invite this, and the credited answer is often a smaller model on a narrow task with a human check on the output. Importance of the domain is not the same as difficulty of the task.

Fine-tuning deserves a note because it appears as a distractor more often than as an answer. Try prompting first. A well-constructed prompt with good examples closes most gaps, and fine-tuning adds a training and maintenance burden that scenarios rarely justify.

From the free practice form

A national insurance carrier processes 1.8 million inbound claims emails per day, routing each into one of 12 claim categories. The routing decision is a short classification with a p95 latency budget of 500 ms, and finance has capped the AI line item at $4,000/day. A pilot with the most capable frontier model achieved 97% routing accuracy but would cost roughly 20x the budget at full volume. Which approach best fits the workload?

Second question, same objective

A legal-tech firm analyzes merger agreements for cross-document inconsistencies: about 200 requests per day, each carrying roughly 150K tokens of contract text, with attorneys reviewing every output. Errors that reach attorneys are expensive to catch, users tolerate multi-minute turnaround, and daily model spend at current volume is under $900 even on the most capable model. The team is debating whether to cut costs with a smaller model. What should they do?

Design system prompts, templates, and guardrails

The design question is not how to word an instruction. It is which instructions belong in a prompt at all.

Where a constraint belongsA constraint written into the system prompt shapes behaviour and can be ignored. The same constraint validated inside the tool cannot be bypassed, because the action runs through it.In the system prompt“never refund more than the original”shapes behavior · can be ignoredInside the toolreject any amount above the originalenforces it · cannot be bypassedAnything that must hold every single time belongs on the right.
A system prompt asks. Code guarantees. When a scenario says a constraint must never be violated, the credited answer moves it out of the prompt and into the boundary where the action actually happens.

A system prompt shapes behavior. It does not enforce it. Anything that must hold every single time belongs somewhere deterministic: validation inside the tool, a hook that fires on an event, a check in your code after the model returns. When a scenario describes a constraint that cannot ever be violated, such as a refund never exceeding the original transaction, the credited answer moves the constraint out of the prompt and into the boundary where the action happens.

Templates matter for a reason the exam tests directly. A stable prefix is cacheable, and a prompt assembled in a different order each call is not. Put the fixed material first and the variable material last.

The other recurring point is where the user's identity comes from. The server injects the role and what data that role may see, before the call. A role the user asserts in their own message is a role the user can change, and options that accept it are wrong regardless of how much validation surrounds them.

From the free practice form

A retail bank's support chatbot must never give personalized investment advice. The current implementation prepends a 900-word policy paragraph, including this prohibition, to the start of every user message; behavioral rules, tone guidance, and the ban are interleaved in one block. In testing, the bot still occasionally recommends specific funds when users push back twice. What is the most effective structural fix?

Apply prompt engineering techniques (zero-shot, few-shot, chain-of-thought)

These questions are about matching technique to failure, so read the failure first.

Output that is right in substance but inconsistent in shape wants few-shot examples, because examples teach form better than description does. Reasoning that skips steps and arrives somewhere wrong wants chain-of-thought, which buys accuracy with tokens and latency. A task the model already performs reliably wants zero-shot, and adding examples to it spends context for nothing.

The trap is treating chain-of-thought as a general quality upgrade. On a high-volume classification task with a latency budget, asking the model to reason step by step makes every call slower and more expensive to fix a problem the scenario never described. Techniques have costs, and the exam prices them.

Structured output is worth its own note. When downstream code parses the result, constrain the shape rather than asking politely for JSON in the prose. A parse failure at three in the morning is a design decision made earlier.

From the free practice form

A logistics company extracts structured fields (origin, destination, weight, hazmat class) from free-text carrier emails into JSON. A zero-shot prompt with detailed field definitions works on clean emails, but output format drifts on messy ones: missing fields are sometimes omitted, sometimes null, sometimes guessed, and units are inconsistent. Volume is 40K emails/day, so per-request token cost matters. What prompting change most directly fixes the inconsistency?

Optimize context windows and manage token usage

Budgeting the context windowThe window should be planned as system prompt, retrieved context, conversation, working room and a margin for growth, with headroom left before the hard limit.systemretrieved contextconversationworkingmarginthe limitWHAT YOU PLAN FOROutside the window the content does not exist to the model. There is no partial credit.
Budget the largest realistic case, not the limit. A design that fits exactly today fails on the first long document, and the window has no partial credit: content outside it does not exist to the model.

The context window has the hardest edge of any property you design around. Inside it the model can attend to everything. Outside it, the content does not exist to the model at all, and there is no partial credit.

The practical rule is that you do not budget the full window. Budget the largest realistic conversation, plus retrieved context, plus the system prompt, plus working room, plus margin for growth. Designs that fit exactly today fail on the first long document.

Questions in this area usually describe a system whose context grows without bound: a conversation that runs past forty turns, an agent loop accumulating tool results, a document set that got bigger. The credited answers separate what must stay exact from what only needs recalling. Recent turns stay verbatim, older ones compress to what was decided, and full detail stays retrievable for the rare question that needs it. Truncating the oldest content is the attractive wrong answer, because the oldest content is usually where the commitments live.

Cost follows tokens, so a cost question is a token question. When spend rises with flat traffic, split prompt tokens from completion tokens before doing anything else. Prompt tokens climbing points at grounding, and completion tokens climbing points at generation length.

From the free practice form

A pharma company's internal RAG assistant retrieves the top 40 chunks per query and stuffs about 120K tokens of retrieved text into each request. Answer quality has degraded as the corpus grew: the model increasingly cites marginally relevant passages while missing the key document, and per-query cost is 6x the original estimate. Latency is acceptable. What change best addresses both problems?

Second question, same objective

A managed-services provider runs an incident-triage agent whose sessions span hours: tool calls return large log excerpts, and long conversations now overflow the context window mid-incident. Engineers report that when the team's current fix, silently dropping the oldest half of the transcript, kicks in, the agent repeats diagnostic steps it already ran and contradicts earlier conclusions. What context-management strategy fixes this?

Implement prompt reuse strategies (caching, modular prompts, Skills)

Prompt order and the cache prefixIn a cacheable prompt the system instructions, tool definitions and reference material come first and repeat unchanged, with per-request content last. Interleaving variable content breaks the prefix.CACHEABLEsystem rulestool definitionsreference materialthis requestidentical every call, so it cachesvaries, so it does notNOT CACHEABLEsystem rulesthis requestreference materialuser nameOne variable field near the front and everything after it stops matching.
A prefix can only be cached while it stays identical. Assemble the invariant part from named pieces and put it first; anything that changes per request goes last. Interleaving the two costs the cache entirely.

Caching rewards structure. A stable prefix that repeats across calls can be cached, which cuts both cost and time to first token, and the design consequence is that you order the prompt to make the front of it invariant. System instructions, tool definitions, and reference material go first. Anything that changes per request goes last.

Scenarios that mention a large fixed corpus consulted on every call, such as a policy manual or a style guide, are usually caching questions even when they do not use the word.

Skills package a repeatable procedure as a versioned unit, which matters when several teams need the same behavior and you would otherwise have the same instructions copied into four codebases drifting apart. The exam frames this as a maintenance question rather than a capability one. Ask where the behavior is defined and what happens when it needs to change.

Modular prompts follow the same logic. Assemble prompts from named pieces you can version and test, rather than long strings edited in place, so that a change is reviewable and a regression is attributable.

From the free practice form

A travel-booking platform serves 400K requests/day. Every request carries the same 28K-token prefix: tool definitions plus policy instructions, followed by per-user data. They enabled prompt caching expecting large savings, but billing shows cache reads on under 10% of requests. Inspection reveals two things: a current-timestamp string is interpolated into the top of the system prompt, and traffic is spread across periods where some prompt variants go many minutes between uses. Which TWO changes will most improve the cache hit rate?

Second question, same objective

A media company runs 14 distinct Claude-powered workflows (ad copy, headlines, social posts, image captions) that each embed a copy of the brand voice guide and legal disclaimer rules directly in their prompts. The guide changed last month; four workflows are still using the old version, and one workflow's prompt has grown past 20K tokens because it inlines style examples most requests never need. What prompt-reuse strategy fixes both problems?

Practice this

Form 1 has 8 Claude Models, Prompting & Context Engineering questions. Free, no signup.

Start form 1 · study mode

Sets 2–6 add 24 more Claude Models, Prompting & Context Engineering questions — on Udemy.