Study guides / CCAR-F

Quick reference

One condensed cheat-sheet per domain - the tables and rules worth re-reading right before the exam.

System Prompts

Concrete code examples beat prose descriptions. Instead of writing "use clear variable names", show a before/after code snippet.

Severity calibration: Without examples of what constitutes "critical" vs. "minor", the model treats all issues as equally important. Provide 2–3 calibration examples showing severity levels with specific code samples.

Structure a system prompt as:

  1. Role and context (who the model is, what it is doing)
  2. Rules and constraints (what it must/must not do)
  3. Output format specification
  4. Calibration examples (severity, tone, detail level)

Key rule: System prompts are the most cost-effective way to control behaviour - they're cached and reused across requests via prompt caching.

Structured Output - tool_use vs Text

MethodGuaranteeUse When
Forced tool_choice ({ type: "tool", name: ... })Tool call guaranteed; the tool's JSON schema constrains the shapeYou need one specific structure every time
tool_choice: anyA tool call is guaranteed, model picks which toolMultiple extraction schemas, document type unknown
tool_choice: autoModel may or may not use the toolAgentic loops where text responses are also valid
Prompt-based JSONNo schema enforcementSimple cases, prototyping only

The exam's preferred pattern: Define a tool whose sole purpose is to structure output (e.g., extract_entities), then force it with tool_choice: { type: "tool", name: "extract_entities" }. This guarantees the response matches your schema.

Why tool_use over prompt-based JSON:

Schema Design for Structured Output

Fabrication prevention rule: If a field might not have a real value, make it nullable: true or required: false. This gives the model permission to return null instead of inventing data.

Few-Shot Examples

When to use few-shot: When instructions alone produce inconsistent output. Few-shot examples demonstrate the exact format and reasoning you expect.

Best practices:

Diminishing returns: Going from 0 to 2 examples has the largest impact. Going from 4 to 8 rarely improves quality and costs more context.

Prompt Chaining

Multi-step pipelines where each step is a focused prompt with a single responsibility.

Pattern: Step 1 (extract) → Step 2 (validate) → Step 3 (format) → Step 4 (synthesise)

Advantages:

When to chain vs. single prompt: Chain when the task has distinct phases with different requirements. Use a single prompt when the task is cohesive and the output format is straightforward.

Retry Pattern - retry-with-error-feedback

When output fails validation, send back: original prompt + failed output + specific validation error.

The model sees what it produced, what was wrong, and can correct specifically. Never just say "try again" - always include the specific error.

When to retry vs. escalate:

Pydantic's role (Python): parsing enforces the schema; custom validators enforce semantic rules a JSON schema cannot express (sums that must match, ordered dates). Its ValidationError yields per-field messages you feed straight into the retry prompt.

Batch API

PropertyValue
Cost saving50% cheaper than synchronous
LatencyUp to 24 hours (not guaranteed faster)
Use caseLatency-tolerant bulk workloads
Not forReal-time, interactive, or user-facing requests

Key exam point: Batch API is for throughput and cost, not speed. If the question mentions "real-time" or "user-facing", Batch API is wrong.

Self-Review Limitation

A model cannot effectively review its own output in the same session. It retains the reasoning that produced the original output and is biased toward confirming it.

Fix: Use a separate model instance (new conversation, no shared history) for review. The reviewing instance sees only the output, not the reasoning that produced it.

For large inputs: Use per-file passes (analyse each file independently) plus a cross-file integration pass (synthesise findings). This is the "attention dilution" mitigation - processing everything in one pass causes the model to miss details.

Decision Rules for the Exam

If the question says...The answer is likely...
"guaranteed schema compliance"Forced tool_choice with specific tool; tool_choice: any when the document type is unknown
"output sometimes has wrong format"Add few-shot examples (2–4)
"model fabricates missing data"Make schema fields optional/nullable
"validation failed, need to fix"retry-with-error-feedback (original + failed + error)
"50% cost reduction", "bulk processing"Batch API
"real-time", "user-facing"NOT Batch API - use synchronous
"inconsistent output quality"Few-shot examples or prompt chaining
"review its own output"Separate instance (not same session)
"large document, missing details"Per-file passes + cross-file integration
"instructions alone aren't working"Add few-shot examples

Common Exam Traps

TrapCorrect Answer
"Use prompt-based JSON for production"Wrong - use forced tool_choice for guaranteed schema
"Just say 'try again' on validation failure"Wrong - include original + failed output + specific error
"Batch API for faster responses"Wrong - Batch API trades latency for cost savings
"Review output in the same conversation"Wrong - same-session review is biased; use separate instance
"Add 10+ few-shot examples for best results"Wrong - 2–4 is the sweet spot; diminishing returns after that
"Required fields prevent fabrication"Wrong - required fields CAUSE fabrication when data is missing
"One big prompt handles everything"Wrong - chain prompts when task has distinct phases

Previous

Domain 3: Claude Code Configuration & Workflows

Next

Domain 5: Context Management & Reliability