Engineering Articles · 16 min read

A Complete Guide For Claude Certified Architect Foundations (CCA-F) Exam

Guide covering the Claude Certified Architect Foundations exam.

On this page
  1. Domain 1: Agentic Architecture & Orchestration
  2. 1. Mastering Agentic Loops and Stop Reasons
  3. 2. Multi-Agent Patterns and the Hub-and-Spoke Design
  4. 3. Securing Pipelines with Lifecycle Hooks
  5. Domain 2: Claude Code Configuration & Workflows
  6. 1. The CLAUDE.md Hierarchy
  7. 2. Extending Capability via Slash Commands and Skills
  8. 3. Headless Automation in CI/CD Pipelines
  9. Domain 3: Prompt Engineering & Structured Output
  10. 1. Why tool_use Defeats Prompt-Based JSON
  11. 2. Restrictive JSON Schema Design
  12. 3. The Few-Shot Sweet Spot
  13. 4. Structural Reasoning Tags
  14. Domain 4: Tool Design & MCP Integration
  15. 1. The Model Context Protocol (MCP) Blueprint
  16. 2. Advanced Tool Error Handling and Retry Loops
  17. Domain 5: Context Management & Reliability
  18. 1. Defeating Context Inflation and the "Lost in the Middle" Effect
  19. 2. Multi-Pass Batch Architectures
  20. 3. Programmatic Circuit Breakers and Human Escalation Triggers
  21. 4. Claim-Source Mapping and Temporal Data Integrity
  22. Tricks for the Exam

The Ultimate Claude Certified Architect Guide (By me)

Building production-grade applications with Claude requires moving past conversational chat prompts and treating Large Language Models as predictable, well-contained components of a larger system. An LLM itself is never fully deterministic, so the engineering job is to wrap it in code that makes the system behave deterministically. I have tried to break down the five official exam domains into clear, technical, and easy-to-understand blueprints.

(If you're new to how LLMs work underneath, my GenAI Foundations and Tokens and Context Windows articles cover the basics this guide builds on.)

Domain 1: Agentic Architecture & Orchestration

1. Mastering Agentic Loops and Stop Reasons

At the core of any autonomous agent is the Agentic Loop. Claude does not randomly decide when to stop talking or when to use a tool. Instead, the Anthropic Messages API communicates using explicit string signals known as stop_reason.

text
[ Your Application ] -> Sends Payload -> [ Claude Engine ]
        ▲                                          │
        │                                          ▼
        └─────────── Evaluates stop_reason ────────┘
                    • tool_use: Run local code
                    • end_turn: Deliver final answer

An architect must program the application shell to inspect this stop_reason field on every API response:

  • tool_use: This signal indicates that Claude has stopped generating conversational text and is waiting for you to run a piece of code. The model provides the exact tool name and the matching JSON parameters. Your application must intercept this, execute the local code, and feed the results back.
  • end_turn: This signal confirms that Claude has completed its reasoning path and delivered its final answer. The loop can now safely terminate.

Those two drive the loop, but a robust loop handles the others too:

stop_reasonMeaningWhat your loop does
tool_useClaude wants a tool runExecute it, send back a tool_result, call again
end_turnClaude is finishedReturn the answer, exit the loop
max_tokensHit your output limit mid-answerRaise max_tokens or continue the response; never treat it as finished
stop_sequenceHit one of your custom stop sequencesHandle as your app defines
pause_turnA long server-side tool run was pausedSend the response back to let Claude continue
refusalClaude declined for safety reasonsCheck stop_details and route accordingly
python
while True:
    response = client.messages.create(model=MODEL, max_tokens=16000,
                                      tools=tools, messages=messages)
    messages.append({"role": "assistant", "content": response.content})

    if response.stop_reason != "tool_use":
        break  # end_turn, max_tokens, refusal, ... handle each explicitly

    results = [run_tool(block) for block in response.content
               if block.type == "tool_use"]
    messages.append({"role": "user", "content": results})  # all tool_results in ONE message

2. Multi-Agent Patterns and the Hub-and-Spoke Design

For complex applications, passing an entire project history into a single prompt creates massive Context Pollution. The standard design pattern is the Hub-and-Spoke Architecture, also known as the Orchestrator-Worker Pattern.

In this layout, a single master Orchestrator Agent acts as the manager. It receives the user request, breaks it down into individual tasks, and spawns hyper-focused Worker Subagents to execute those tasks in isolation.

mermaid
flowchart TD
    U[User request] --> O[Orchestrator agent]
    O -->|"only the variables it needs"| W1[Worker subagent 1]
    O -->|"only the variables it needs"| W2[Worker subagent 2]
    O -->|"only the variables it needs"| W3[Worker subagent 3]
    W1 -->|structured result| O
    W2 -->|structured result| O
    W3 -->|structured result| O
    O --> A[Final answer]

To keep your system fast and token-efficient, use a "Need-to-Know" Context Sandboxing strategy. Never copy the main conversation history down to a worker subagent. Instead, extract only the specific variables the worker needs, pass them in a clean miniature payload, and discard that subagent's context window the second it returns its structured answer.

3. Securing Pipelines with Lifecycle Hooks

An AI agent operating inside an enterprise environment must be contained by hard boundaries. Lifecycle Hooks are programmatic code blocks (in your own application code, or configured hooks in Claude Code and the Claude Agent SDK) that execute outside of Claude's probabilistic reasoning.

  • Input validation hooks: These intercept user text before it ever reaches the model. They scan for prompt injection attacks, malicious formatting, or prohibited keywords, blocking the turn immediately if a violation is detected. (In Claude Code this is the UserPromptSubmit hook.)
  • Pre-action validation hooks: These catch Claude's requested action after Claude asks for it but before it runs in your infrastructure. If Claude generates a parameter that violates your system security rules, the hook cancels the operation, keeping your underlying systems safe. (In Claude Code this is the PreToolUse hook, which can block a tool call.)
  • Post-action hooks: These run after a tool has executed, to log, audit, or reshape its result before Claude sees it. (In Claude Code, PostToolUse.)

The key exam point: a hook is code, so it enforces a rule every time. A rule written in the prompt is only a request.

Domain 2: Claude Code Configuration & Workflows

1. The CLAUDE.md Hierarchy

When working with agentic developer tools like Claude Code, the system loads your engineering preferences from CLAUDE.md memory files at several levels. More specific files are closer to the work, and they take precedence when instructions conflict.

LevelLocationUse it for
User (global)~/.claude/CLAUDE.mdUniversal personal preferences, on your machine only
ProjectCLAUDE.md (or .claude/CLAUDE.md) at the repo root, committedCore tech stack, build and test commands, team conventions
SubdirectoryCLAUDE.md inside a sub-folderTargeted rules for one service or package, loaded when Claude works there

(Organizations can also deploy a managed policy file that applies to every user on the machine, above all of these.)

A common mistake is saving team instructions in your personal global configuration space. Because those settings live only on your laptop, your teammates' agents will lack the required context, resulting in broken build loops. The exact production fix is to commit a CLAUDE.md file to the root of your Git repository so the entire team shares the same ruleset.

2. Extending Capability via Slash Commands and Skills

To bypass the fuzzy nature of natural language, you can create Custom Slash Commands. Slash commands act as hard-coded intent routers: a fixed, reusable prompt behind a short name.

In Claude Code, a project command is simply a Markdown file in .claude/commands/, committed with the repo (personal ones go in ~/.claude/commands/). The file name becomes the command, and frontmatter can restrict which tools it may use:

markdown
---
description: Performs a security audit on code changes.
allowed-tools: Read, Grep, Glob
---

You are a Principal Security Architect. Review the current changes
for OWASP Top 10 vulnerabilities and report each finding with its
file, line, and a suggested fix. Focus on: $ARGUMENTS

Saved as .claude/commands/review.md, this becomes /review. When a developer types /review auth module, the file's contents are sent as the prompt (with $ARGUMENTS filled in) instead of whatever the developer would have typed, and the session is limited to the listed read-only tools.

To make larger behaviors maintainable, package them as modular Agent Skills inside a dedicated .claude/skills/ folder. Each skill is a folder with a SKILL.md file (a name and description in frontmatter, then instructions), optionally alongside scripts and reference files. Claude loads a skill only when its description matches the task at hand, which keeps the context window clean and decouples your workflow logic from your main configuration.

3. Headless Automation in CI/CD Pipelines

To run Claude Code inside automated continuous integration and continuous deployment environments like GitHub Actions, you must use non-interactive execution. If you trigger a plain interactive claude session inside a build runner, there is no terminal or person to answer it, and the job hangs or fails.

The non-negotiable rule is to use the -p (or --print) flag. This forces Claude Code into a headless mode that takes an input string, runs the task on its own without interactive prompts, writes the result to stdout, and exits with a clear exit code.

bash
claude -p "Review the diff in this PR and list any bugs" \
  --output-format json \
  --allowedTools "Read,Grep,Glob"

Two details matter in CI. --output-format json returns a machine-readable result (including cost and usage) for the next pipeline step to parse. And since nobody is there to approve tool use, list the tools the job may use up front (--allowedTools), keeping them as narrow as the task allows.

Domain 3: Prompt Engineering & Structured Output

1. Why tool_use Defeats Prompt-Based JSON

If you try to force structured data by typing "Return ONLY a valid JSON object" inside your prompt, your application will eventually experience a parser crash. Claude might add a markdown wrapper, include a trailing comma, or append conversational text.

The professional standard is to use the API's native structured output features instead:

  • Strict tool use: register a tool with an explicit JSON schema and set strict: true on it. Claude's tool arguments are then guaranteed to match the schema.
  • Structured outputs: set a JSON schema in output_config.format when you want the whole response, not a tool call, to be JSON.

With either one, the API uses constrained decoding: while Claude generates, any token that would break your schema is ruled out, so the output always parses and always matches. That eliminates syntax errors, markdown wrappers, and conversational fluff entirely. Note the word strict: a regular tool definition without it makes valid JSON very likely, but only strict mode or structured outputs guarantee it.

2. Restrictive JSON Schema Design

To stop Claude from producing random or inconsistent data values within your JSON objects, you must write highly restrictive schemas. Do not use generic primitive types when you can lock down the fields using strict logical guardrails.

json
{
  "status": {
    "type": "string",
    "enum": ["PENDING", "APPROVED", "REJECTED"]
  },
  "quality_score": {
    "type": "number",
    "minimum": 0.0,
    "maximum": 1.0
  }
}
  • enum (Enumerations): Limits the valid options to a strict array of permitted strings.
  • minimum and maximum: Set hard floors and ceilings on numerical fields to prevent out-of-bounds values.

Strict mode also expects every object to declare additionalProperties: false and list its required fields, so no unexpected keys can appear. Not every JSON Schema keyword is enforced during constrained decoding, so check the docs for the supported set, and keep validating values like ranges in your own code as a safety net.

3. The Few-Shot Sweet Spot

Few-shot prompting is incredibly effective for teaching Claude complex patterns, but injecting too many examples introduces architectural drag. Aim for a small, well-chosen set: a handful of examples (Anthropic's own guidance suggests about 3 to 5) is usually enough.

Providing 8 or 10 examples consumes excessive input tokens on every single API call and can cause overfitting, where Claude locks onto the superficial mechanics of your examples rather than the abstract rule.

Additionally, never waste your few-shot real estate on obvious, easy use cases. Focus your examples on The Gray Zone, the ambiguous boundary lines where surface-level appearances conflict with your true operational logic. Vary the examples too, so Claude learns the rule and not one particular phrasing.

4. Structural Reasoning Tags

If your few-shot examples jump straight from an input text payload to a final output label, you show Claude what to answer but not how to decide. Embed an explicit <reasoning> block inside your few-shot samples.

xml
<example>
  <input>Error: Timeout encountered during TLS handshake.</input>
  <reasoning>
    1. The error occurs during the TLS handshake phase.
    2. TLS operations happen in the connection layer, before any application logic runs.
    3. Therefore, this must map to the NETWORK infrastructure category.
  </reasoning>
  <output>{"category": "NETWORK"}</output>
</example>

Showing this step-by-step structure in your examples nudges Claude to follow the same line of reasoning at runtime, which tends to make classifications more accurate and consistent. (Nothing is being retrained: the examples shape the response through the prompt alone. Current Claude models can also think before answering on their own with adaptive thinking, and examples like this steer what that reasoning checks.)

Domain 4: Tool Design & MCP Integration

1. The Model Context Protocol (MCP) Blueprint

The Model Context Protocol (MCP) is an open standard that decouples your AI models from your data layers. Instead of writing custom, fragile API integrations for every new database or internal platform, you build or connect standalone MCP Servers.

text
[ Claude Agent Client ] -> ( Standardized MCP Protocol ) -> [ MCP Server ] -> [ Your Private Database ]

The MCP Server acts as an isolated boundary gate. It exposes three primitives to the client:

PrimitiveWhat it isWho controls it
PromptsPre-configured prompt templates that standardize how tasks are framedThe user picks them
ResourcesRead-only data (such as files or API data) that Claude can safely take in as contextThe application decides what to attach
ToolsExecutable functions that let Claude perform actions in your environment under explicit security constraintsThe model decides when to call them

2. Advanced Tool Error Handling and Retry Loops

When a tool fails inside a multi-step agent pipeline, you must be able to differentiate between two distinct types of errors:

Error ClassificationCore Litmus TestResolution Strategy
Syntax ErrorDoes the structure break basic parsing rules (like JSON.parse())?Fast local code fix or structural schema enforcement (strict tool use)
Semantic ErrorIs the structure valid, but the data inside breaks business rules?Route back to Claude via a Self-Correcting Retry Loop

To implement a self-correcting loop, intercept the validation failure in your code. Do not clear the conversation history. Instead, reply to the tool call with a tool_result block that sets is_error to true and carries the exact error message:

json
{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01A2B3C4D5",
      "is_error": true,
      "content": "Validation Failed: 'URGENT' is not a valid enum member. Allowed values are ['CRITICAL', 'MAJOR']."
    }
  ]
}

Claude will analyze its previous mistake, read your error message, and generate a corrected call on its very next turn. Make the error message specific (what was wrong and what's allowed): that's what lets Claude fix it in one try.

Domain 5: Context Management & Reliability

1. Defeating Context Inflation and the "Lost in the Middle" Effect

Claude reads the whole conversation again on every turn, and its recall isn't even across a long prompt. Models tend to recall information at the very top of the prompt (system instructions) and the very bottom (the current user turn) far better than information buried in the middle of a large context window. This is known as the "Lost in the Middle" Effect.

text
Position in a long context        How well it's used
--------------------------------  ----------------------
Top: system prompt, rules         ██████████  high
Middle: old turns, tool output    ███         low
Bottom: latest user message       ██████████  high

The primary driver of context inflation is unmanaged tool responses. If your agent queries a database and injects thousands of tokens of raw JSON metadata into the conversation, your core rules get pushed further from the end of the prompt and the useful facts get buried in the low-attention middle.

To resolve this, implement two context engineering patterns:

  • Hook-Layer Tool Output Trimming: Use a local code middleware layer to strip out unnecessary database keys, truncate long arrays, and flatten sprawling JSON blocks into compact, token-efficient Markdown tables before appending them to the conversation history.
  • The Case Facts Block Pattern: Programmatically extract and re-pin a small, structured summary box containing your most critical variables to the most recent user message on every turn. This drags vital facts out of the fading middle zone and puts them where the model pays the most attention.

2. Multi-Pass Batch Architectures

When managing large-scale workloads (like auditing 50,000 back-office transaction records), running synchronous, real-time API calls wastes money. The Anthropic Message Batches API is specifically designed for these high-volume, asynchronous workflows.

The Batch API gives you a 50% cost discount on both input and output tokens in exchange for asynchronous processing that completes within 24 hours (most batches finish much faster).

Because results come back in no particular order, every request carries a custom_id that you use to map Claude's responses back to your own database record keys:

json
{"custom_id": "product_sku_1092A", "params": {"model": "claude-opus-5-5", "max_tokens": 1024, "messages": [...]}}

When to use Batch: Nightly legal compliance reviews, data enrichment pipelines, large-scale ETL transformations, and Multi-Pass Review Patterns where Phase 1 generates analysis and Phase 2 (a second batch) critiques the findings.

When NOT to use Batch: Pre-merge CI/CD blocking gates, live chat user interfaces, and Multi-Turn Tool Calling loops. Each request in a batch is a single, isolated request-response turn, run asynchronously on Anthropic's side, so there is no client-side code running to intercept a tool call and inject a result back mid-stream. (A tool loop over batches would need a whole new batch for every turn.)

3. Programmatic Circuit Breakers and Human Escalation Triggers

To prevent an autonomous agent from getting trapped in an infinite loop of failing validation checks and burning your API budget, you must implement a strict Circuit Breaker pattern. Limit your system to a small number of consecutive retries for any single task step (two is a sensible default). If the agent cannot self-correct within two feedback loops, trip the circuit breaker and route the transaction to a manual review queue.

mermaid
stateDiagram-v2
    [*] --> Attempt
    Attempt --> Done: valid
    Attempt --> Retry1: semantic error
    Retry1 --> Done: valid
    Retry1 --> Retry2: still invalid
    Retry2 --> Done: valid
    Retry2 --> HumanReview: still invalid (breaker trips)

The Non-Negotiable Escalation Law: If at any point in the conversation a human user explicitly requests to speak to a person, types "support", or asks to opt out of the AI interaction, the orchestration framework must halt all automated processing immediately and transfer the entire transaction context to a human operator. Detect this in code, not by hoping the model notices. You do not attempt to prompt-engineer a persuasion layer; you route the session on the very next turn.

4. Claim-Source Mapping and Temporal Data Integrity

When designing synthesis or reporting agents, you face a high risk of Attribution Loss, the failure mode where an agent states a valid fact but attaches it to the wrong source document.

To eliminate attribution loss, your JSON output schemas must require explicit Claim-Source Mappings. Claude must be barred from generating a narrative claim unless it pairs it with an exact quote and a matching document identifier.

json
{
  "claims": [
    {
      "claim": "Revenue grew 18% year over year.",
      "source_id": "q3_report.pdf",
      "quote": "Total revenue increased 18% compared to Q3 last year."
    }
  ]
}

Your code can then verify each quote actually appears in the named document. (The API's built-in citations feature does much of this for you: send documents with citations enabled and every cited passage comes back tied to its source.)

Finally, you must defend your models against Temporal Data Pitfalls. Models have no sense of the current date unless your infrastructure provides it. To stop Claude from treating a 2019 financial statistic as a current fact, your ingestion pipeline must execute a two-step Time-Anchoring Pattern:

  1. Programmatically stamp an explicit metadata_timestamp header onto every raw document before injecting it into the context window.
  2. Inject the current calendar date into the prompt (for example, Current Time Anchor: Monday, June 22, 2026).

This gives Claude the explicit chronological baseline it needs to judge temporal relevance, prioritizing fresh data over expired context.

One placement detail: put the date after your stable system prompt (for example in the latest user message), not at the very top. The date changes every day, and anything that changes at the start of the prompt breaks prompt caching for everything after it.

Tricks for the Exam

DomainRemember
1Check stop_reason programmatically (tool_use vs end_turn, and handle max_tokens). Use sandboxed context isolation to prevent multi-agent pollution. Enforce rules with hooks, not prompts.
2Commit CLAUDE.md to the repository root for team sync. Put shared commands in .claude/commands/ and skills in .claude/skills/. Use claude -p for headless CI/CD automation.
3Use strict tool use or structured outputs instead of prompt-based text requests to guarantee valid JSON. Focus a handful of few-shot examples on Gray Zone edge cases and include <reasoning> tags.
4Use MCP servers to cleanly expose prompts, resources, and tools. Use tool_result blocks with is_error: true for self-correcting semantic loops.
5Defeat the "Lost in the Middle" effect with hook-layer tool trimming and Case Facts Blocks. Use the Message Batches API for a 50% cost discount on single-turn asynchronous tasks. Escalate immediately on explicit human requests.