Skip to content

CCAR-P · Domain 2: Claude Models, Prompting, and Context Engineering · 13% of the exam

Task 2.5: Cache Breakpoints and Reusable Packaging

Placing cache breakpoints and packaging prompts as modules or Skills so that stable content comes before changing content and a repeated call pattern reuses as much as possible.

Study it

  • Cache breakpoints, stable content first, and reusable modules and Skills

    Partly covered by: The KV Cache

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

A platform team ships one Python Claude Agent SDK configuration to 200 developer machines and CI runners, all calling the API with keys from the same workspace. Every session sets system_prompt to the claude_code preset object and nothing else changes the system prompt. Each machine checks out the monorepo at its own path under its own user account. Usage reports show that every machine writes its own cache entry for the system prompt and never reads one that another machine wrote. Which change lets the identical configurations share one cache entry?

  1. ADelete the repository's CLAUDE.md, whose project context differs from one checkout path to the next
  2. BGive every machine the same API key, since a cache entry is shared only among requests made with one key
  3. CSet "exclude_dynamic_sections": True on the claude_code preset object in every session's configuration
  4. DUse the one-hour cache lifetime for the system prompt, so that each machine's entry stays available for longer
Show the answer and why
  • ADelete the repository's CLAUDE.md, whose project context differs from one checkout path to the next

    Incorrect

    CLAUDE.md content is delivered in the conversation, not the system prompt, so it doesn't affect the system prompt cache.

  • BGive every machine the same API key, since a cache entry is shared only among requests made with one key

    Incorrect

    Caches are isolated by organization and, on the Claude API, by workspace; keys of one workspace already share them.

  • CSet "exclude_dynamic_sections": True on the claude_code preset object in every session's configuration

    Correct

    The preset embeds each machine's auto memory location in the system prompt; this moves that per-user context out of it.

  • DUse the one-hour cache lifetime for the system prompt, so that each machine's entry stays available for longer

    Incorrect

    A longer lifetime doesn't help when the prompts differ; a cache hit needs 100 percent identical prompt segments.

The claude_code preset embeds the session's auto memory location in the system prompt. That location is an absolute path under ~/.claude/projects/ named for the repository's path on disk, so it differs across users, machines and checkouts, and identical configurations write separate cache entries. Setting exclude_dynamic_sections on the preset object moves the per-user context into the first user message, leaving only static preset text in the system prompt, so the configurations share a cache entry across users and machines. CLAUDE.md and environment details reach Claude in the conversation and don't affect the system prompt cache.

Question 2 · choose 1

A contract-review service on the Claude API sends each new contract as 30 requests released together, one per clause checklist. Every request has the same tools, system prompt and contract text, with a cache_control breakpoint on the contract block, followed by a different checklist. Usage shows cache creation tokens on all 30 requests and no cache reads on any of them. Which change lets most of the 30 requests read the contract from the cache?

  1. ASubmit the 30 requests as one Message Batches API batch, so that they share a single cache entry for the contract
  2. BGive the contract's breakpoint the 1-hour cache duration, so that its entry outlives the burst of requests
  3. CSend one of the 30 requests first, and release the other 29 only once the first response has started
  4. DAdd automatic caching at the top level of each request, beside the breakpoint on the contract block
Show the answer and why
  • ASubmit the 30 requests as one Message Batches API batch, so that they share a single cache entry for the contract

    Incorrect

    Batch requests can be processed concurrently and in any order, so cache hits in a batch are best-effort.

  • BGive the contract's breakpoint the 1-hour cache duration, so that its entry outlives the burst of requests

    Incorrect

    The duration sets how long an entry lives; it doesn't make an entry available to requests sent at the same moment.

  • CSend one of the 30 requests first, and release the other 29 only once the first response has started

    Correct

    For concurrent requests, a cache entry only becomes available after the first response starts.

  • DAdd automatic caching at the top level of each request, beside the breakpoint on the contract block

    Incorrect

    Automatic caching places its breakpoint on the last cacheable block, here the checklist that differs in every request.

Prompt caching writes an entry for the prefix up to a breakpoint, and later requests with the same prefix read it. For concurrent requests, a cache entry only becomes available after the first response starts, so requests released together each write their own entry; to get cache hits for parallel requests, wait for the first response before sending the rest. The cache duration only sets an entry's lifetime, batch cache hits are best-effort because requests run concurrently and in any order, and automatic caching moves a breakpoint to the last cacheable block.

Practice domain 2 →Practice all domains →