CCDV-F Cheatsheet
Claude Certified Developer – Foundations
Download free PDFAgents and Workflows (14.7%)
Workflow, agent and graph patterns
- A **workflow** encodes known steps and deterministic transitions. An **agent** selects steps and tools dynamically as new information arrives.
- Split fixed transformations into separate calls when stages such as triage and response have distinct inputs, outputs and success criteria.
- Use routing for known categories, parallel execution for independent work and a state graph for conditional transitions or bounded retries.
- An **orchestrator** dynamically assigns subtasks to specialists. It allocates budgets, validates their outputs and resolves overlaps and disagreements.
- Keep predictable stages deterministic. Use bounded agent reasoning where the work depends on information discovered at runtime.
Agent loops and recovery
- A harness sends context, processes **tool_use**, executes authorized tools, appends matching **tool_result** blocks and calls Claude again as needed.
- An **Agent SDK** provides an execution loop, tools and session facilities. A custom harness owns these responsibilities and permits tailored controls.
- Managed hosting can provide agent execution and session infrastructure. Self-hosting places environment, isolation and lifecycle controls with the application team.
- Give each subagent a scoped brief, isolated history, a tool budget and a return schema. Validate handoffs centrally to detect duplicate work and contradictory results.
- Persist **checkpoints** after validated progress. Track completed side effects separately so resumption can avoid executing the same action twice.
Applications and Integration (33.1%)
Messages API and SDK integration
- The **Messages API** is stateless. Send the conversation history needed for the next response, with durable instructions in the top-level **system** field.
- Messages use roles and typed **content blocks**. Process text, images, tool calls and tool results according to their types.
- Inspect **stop_reason** and content before delivery. Natural completion, tool requests and token-limit truncation require different handling.
- Use an official **SDK** for authentication, serialization and typed responses. Use its async client when integrating with an asynchronous service.
- Direct API and providers such as **Amazon Bedrock** differ in credentials, model identifiers and available features. Isolate those details at the provider boundary.
Realtime, streaming and batching
- **Streaming** delivers server-sent events progressively over HTTP. Assemble deltas by content block index and confirm **message_stop** and the final stop reason before treating the result as complete.
- A tool's streamed JSON input can be partial. Wait for the block to finish, then parse and validate its arguments before dispatch.
- An error can arrive after stream headers indicated success. Track partial progress and use a recovery path appropriate to the content already delivered.
- **Message Batches** suit asynchronous, non-interactive jobs. Correlate each result using its **custom_id**, then handle successes and failures individually.
- A **WebSocket** supports persistent bidirectional communication. Claude streaming uses server-sent events for one-way delivery of response events.
Application and lifecycle design
- Translate a business goal into functional requirements, infrastructure constraints and measurable service expectations before committing to an architecture.
- Maintain a clear boundary between integration code, application policy, prompt construction and output consumption. Refactor duplicated logic under regression tests.
- In a session store, isolate tenants and tasks. Expire stale sessions and make reset boundaries explicit.
- Review SDK customizations individually against their original purpose and current SDK features. Prefer the direct SDK when provider portability has no demonstrated value.
- Operate software after launch with monitoring, maintenance, incident ownership and an end-of-life plan.
Versioned configuration and deployment
- Use a reviewed, version-controlled **source of truth** for prompts, model IDs, plugin versions and environment configuration. Record the effective combination in traces.
- Pin known-good model and plugin versions where possible. Recheck output shape and original quality gains on representative inputs before approving a model migration.
- Handle changed or deprecated API semantics with regression cases and deliberately sized migration batches.
- Review output-affecting changes with downstream owners. Use a **feature flag** or staged rollout with a rollback path for model, prompt or configuration changes.
- Match a portability layer to provider requirements and maintenance cost. Test provider-specific features and failures at the adapter boundary.
Claude Code (3.1%)
Claude Code instructions and settings
- Keep shared repository instructions in root **CLAUDE.md**, checked into source control. Broad policies and local preferences can use their own scopes.
- Use **.claude/rules/** for modular instructions, including path-specific rules where applicable. Keep task-specific details in the session.
- Use project **.claude/settings.json** for shared model selection, permissions, hooks and nonsecret environment variables. Review it alongside code and keep secrets outside the repository.
- A **Skill** packages procedure instructions in a discoverable **SKILL.md** and can include scripts or resources. **Auto memory** stores learned notes separately.
- Store shared Skills under **.claude/skills/** for the project. Keep each Skill self-contained so Claude can discover and invoke it during sessions.
Sessions, headless use and hooks
- Resume a session to continue its context. Start a fresh one for an unrelated task, and preserve only relevant state when handing off.
- Use headless **Claude Code** in CI with permissions scoped in settings and output captured for downstream processing. Scope tools and credentials to the job.
- Skills can provide reusable commands and procedures. Subagents have their own context and can have restricted tools.
- **PreToolUse** hooks can enforce applicable checks before execution. Match the operations requiring controls and handle policy decisions in code.
Eval, Testing, and Debugging (2.6%)
Testing and diagnosis
- Use unit tests for deterministic logic, integration tests for Claude boundaries and end-to-end tests for critical journeys. Run applicable tests, lint and security checks in CI.
- Build an **eval set** from representative inputs, edge cases and observed failures. Score against explicit criteria and retain the baseline.
- Compare request traces across successful and failed cases. Check input, system instructions, message history, parameters, tools, retrieved context and response, with sensitive fields redacted.
- Compare refused or malformed requests with valid cases. Distinguish API rejection, model refusal, response truncation and consumer parsing errors.
Rate limits, failures and retries
- Read rate-limit headers and distinguish request, input-token and output-token budgets. Limit concurrency and smooth bursts across the workload.
- SDKs retry many transient errors by default, with behavior configurable by client. Cap total attempts, use exponential backoff with jitter and respect **retry-after**.
- Correct invalid requests and authorization errors at the source. Treat persistent failures and material degradation as operational signals.
- Classify failures by impact and recoverability. Page for high-impact faults that need intervention and log recovered faults at an appropriate severity.
Model Selection and Optimization (16.8%)
Capability and reasoning controls
- **Haiku** targets fast, high-volume tasks, **Sonnet** balances performance and cost, and **Opus** suits demanding reasoning.
- Define quality, latency, and cost targets. Benchmark representative work, then pick the most efficient model meeting all required thresholds.
- **Extended thinking** supports deeper multi-step reasoning on supported models. **Adaptive thinking** and **effort** control reasoning behavior where available and affect time and cost.
- **Fast mode** availability and trade-offs differ by model and platform. Measure the full workload before changing model or speed settings.
Tokens, sampling and cost
- LLMs generate next tokens from conditional probabilities. Identical inputs can yield different wording, including echoed text. Check the trace when variation violates the contract.
- **Temperature** changes sampling where supported. Usable **context window** and output limits are separate model properties.
- Estimate cost from volume, separate input and output token rates, plus cache or tool charges. Generation often has a higher per-token rate than input.
- Record input, output, cache writes and cache reads by feature. Find expensive workloads before changing prompts or models globally.
Prompt caching
- **Prompt caching** reuses processing for an eligible repeated prefix. Put stable tools, system instructions and reference material before variable request data. The prefix order is **tools**, **system**, then **messages**.
- A **cache breakpoint** marks a reusable prefix boundary. Cache hits depend on matching content, supported configuration and timing.
- Cache writes and reads can have different rates. Compare the expected reuse and observed hit rate before assuming savings.
- The reused prefix still occupies **context**. Caching accelerates repeat processing while pruning or compaction reduce supplied content.
Prompt and Context Engineering (11.0%)
Prompts and examples
- Place durable behavioral rules in **system** instructions. Put per-request work and data in messages and distinguish quoted sources from instructions.
- **Zero-shot** supplies instructions alone. **One-shot** supplies one demonstration, and **few-shot** uses several representative examples, including unusual cases.
- Use **prompt engineering** to shape instructions and output constraints, and **context engineering** to manage relevant information across turns, tools and steps.
- Audit long system prompts for obsolete rules, duplication and contradictions. Keep each durable instruction clear, current and stated once.
Context management
- Maintain current objectives, constraints and decisions in a concise **state summary**. Prune irrelevant conversation and completed tool output.
- **Compaction** preserves relevant state in less space. Retain durable references outside the transcript and verify summaries before relying on them.
- Scope context to each stage or subagent and pass prior findings only where required. Chunk long documents, preserve source identifiers and combine verified extracts as needed.
- Choose document chunking based on the real objective. Preserve source location for precise citations and retain or combine cross-section evidence for synthesis; evaluate both on representative documents.
Structured output and downstream checks
- Define a narrow schema with required fields, allowed values and explicit handling of unknowns. Use native **structured outputs** where available.
- **JSON outputs** constrain the response shape. **Strict tool use** constrains supported tool inputs. Enforce application policy and domain rules separately.
- Validate required semantics before consumption. Check **stop_reason** before parsing. A refusal or **max_tokens** truncation can prevent schema-conforming output even when structured outputs are enabled.
- Treat confidence as a signal to test. Verify consequential claims against supporting sources and calibrate any confidence score against observed accuracy before downstream use.
- Parse JSON defensively and validate required fields, data types and unknown keys before downstream use. Route malformed results through bounded retry, repair or fallback.
- For text-based JSON, state the required field shape and require JSON-only output. Prefer native schema constraints where supported, and keep application validation.
Security and Safety (8.1%)
Trust boundaries and guardrails
- Treat user-supplied and retrieved content as **untrusted data**. Separate it from instructions and never let it authorize a tool or disclosure.
- Filter or redact sensitive data **before** sending it to Claude. Apply authentication, authorization and data scope at the integration boundary.
- Layer controls across input, tools and output. Apply deterministic pre-delivery checks for policy rules that can be encoded, with appropriate review for ambiguous classifications.
- Apply **least privilege**, sandboxing and scoped hooks. Require approval for high-impact actions and monitor for violations.
- Verify hosting and provider configuration against residency, retention and data-flow requirements before placing regulated workloads.
- Threat-model **prompt injection**, **jailbreak attempts**, disclosure of sensitive context and unsafe generated output. Keep retrieved content within its data boundary.
Credentials and environment boundaries
- Store **API keys** outside source control in a secrets manager or protected environment configuration. Inject credentials at runtime.
- Use separate credentials for development and production. Scope access, rotate or revoke keys and monitor authorized usage.
- Exclude secrets and unnecessary personal data from logs, error messages, prompts and tool payloads.
Tools and MCPs (10.6%)
Tool definitions and dispatch
- Define each tool with a name, specific **description** and input schema. Explain use cases, limits and what the result represents.
- Keep tool responsibilities distinct and expose a task-appropriate set. Overlapping tools increase selection ambiguity.
- A **client tool** returns a request for the app to execute. A **server tool** runs through the supporting Claude platform.
- Validate **tool_use** arguments before dispatch. Return structured errors for invalid parameters, denied operations or upstream faults, so permitted recovery can target the cause.
- Map **tool_result** back to its **tool_use_id** and preserve the actual tool outcome. Apply approval or retry logic in the harness.
MCP integration and capability reuse
- **MCP** standardizes how clients discover and call capabilities provided by external servers.
- A server can expose **tools** for operations, **resources** for contextual data and **prompts** for reusable interaction templates. Client support varies.
- Use **stdio** for local subprocesses and **Streamable HTTP** for remote servers. The Messages API MCP connector exposes remote tools; client-managed MCP can access resources or prompts.
- A **Skill** packages guidance and optional assets. Use a custom tool for an app-specific action and MCP when multiple clients need a reusable interface.
- Check whether a built-in tool can cover the missing behavior with a supported extension. Compare the remaining gap, reuse needs and maintenance cost before creating a custom tool.