← Lab Overview Claude Foundations

Quick Reference Sheet

Essential patterns, signals, and decision rules for the five exam domains. Keep this open while you review.

1. Core Technical & API Limits

Feature Limit / Value
Context Windows1M tokens (Opus 4.7/4.6, Sonnet 4.6) • 200k tokens (most other active models)
Description LengthTool and Skill descriptions must be under 1024 characters
Batch Discount50% off vs synchronous requests
Batch WindowUp to 24h to process; unfinished requests expire • no latency SLA
Batch CorrelationMatch results via custom_id only; results are unordered • no multi-turn tool calling inside a batch

2. Agentic Loop & Orchestration Signals

The orchestrator must drive control flow using structured API signals rather than natural language parsing.

Signal / PatternMeaning
stop_reason == "tool_use"The loop continues. Execute the tool, append the tool_result to history, and re-call the API.
stop_reason == "end_turn"The only reliable signal for termination.
Task ToolMechanism for spawning subagents. Coordinator allowed_tools must include "Task" to delegate.
Findings → Prompt ContractSubagents are isolated by default and do not inherit the coordinator's history. Coordinators must explicitly pass findings into the subagent's prompt.

3. Structured Error & Recovery Framework

Every tool should return structured metadata to enable intelligent coordinator-level recovery.

CategoryRecovery Behavior
TRANSIENTTimeouts or service outages; Claude should attempt a retry.
VALIDATIONInvalid input, such as bad email format; agent should clarify with the user.
PERMISSIONAuthorization gaps; agent should inform the user.
BUSINESSPolicy violations, such as refund over limit; agent should communicate the rule.
isRetryableBoolean metadata that prevents the model from wasting turns on non-fixable errors.

4. Prompting & Schema Design Patterns

PatternUse
Tool Description Pattern[Input Shape] + [Canonical Use Case] + [Boundary / DO NOT use for X]. Eliminates misrouting between similar tools.
Reasoning-Led Few-ShottingInclude a Why: line in examples to teach the underlying logic so the model generalizes to novel cases.
Nullable FieldsUse ["string", "null"] to allow null when data is missing from a source, preventing hallucinations.
Extensible EnumsUse an enum field with an other option paired with a separate detail string field.

5. tool_choice Modes

ModeBehavior
autoModel may answer in plain text instead of calling a tool.
anyModel must call SOME tool; use for an unknown document type with multiple candidate schemas.
{"type":"tool","name":...}Model must call that specific tool; use for a forced prerequisite step.
strict: trueSet on a tool definition; guarantees schema-valid tool inputs.

6. Built-In Tool Selection

ToolUse For
GrepSearch file CONTENTS.
GlobFind files by NAME pattern.
Read / WriteWhole-file operations.
EditUnique-anchor replacement; fall back to Read + Write when anchors are not unique.
BashEverything else.

7. MCP Configuration

ConceptRule
.mcp.jsonProject scope — version-controlled and shared with the team.
~/.claude.jsonUser scope — personal configuration.
${ENV_VAR} expansionKeeps secrets out of the repository.
Resources vs ToolsResources are read-only content catalogs that cut discovery calls; Tools perform actions.
Community ServersPrefer existing community MCP servers for standard integrations over building your own.

8. Claude Code CI/CD Flags

Flag / PatternPurpose
-p / --printNon-interactive mode; prevents CI hangs.
--output-format jsonMachine-parseable output.
--json-schemaEnforce structured findings.
Independent ReviewerRun review in a separate instance, because a generator will not question its own reasoning.
Prior FindingsInclude earlier findings in the prompt to avoid re-reporting known issues.

9. Plan Mode vs Direct Execution

ApproachWhen
Plan ModeArchitectural decisions, multi-file changes, or multiple valid approaches.
Direct ExecutionScoped single-file fixes.
Explore SubagentIsolates verbose discovery from the main context.
/compactReduces context bloat mid-session.

10. Session Lifecycle

Command / ScenarioBehavior
--resume <session-id>Continue a prior session with its context.
--fork-sessionBranch from a shared baseline to compare approaches.
Stale Tool ResultsStart a fresh session and inject a summary rather than resuming misleading context.
/memoryShows which memory files are currently loaded.

11. Skill Frontmatter Keys

Key / LocationEffect
context: forkRuns the skill in an isolated sub-agent context.
allowed-toolsRestricts which tools the skill may use.
argument-hintPrompts the user for missing arguments.
.claude/commands/ vs ~/.claude/commands/Team-shared slash commands vs personal slash commands.
.claude/rules/ + paths:Rules files use a paths: glob list to load conditionally.

12. Repository & Workflow Governance

Governance AreaRule
CLAUDE.md HierarchyUser (~/.claude/CLAUDE.md) → Project (root/CLAUDE.md) → Directory (subdir/CLAUDE.md). Directory-level files override project-level files.
Path-Scoped RulesLocated in .claude/rules/ using glob patterns such as **/*.test.tsx to load conventions only when matching files are edited.
Progressive DisclosureThree-level skill structure: YAML frontmatter for trigger conditions, SKILL.md body for actionable steps, linked files for deep reference docs.
Session StateResume if context is valid; fork to compare divergent what-if approaches; fresh start if context is stale or misleading.

13. Escalation Triggers

TriggerRule
Explicit Customer RequestEscalate immediately.
Policy Gap or SilenceEscalate; do not improvise policy.
No Meaningful ProgressEscalate rather than looping.
Sentiment / Self-ConfidenceREJECT customer sentiment and the agent's self-reported confidence as escalation triggers.
Multiple Identity MatchesAsk for another identifier rather than guessing.

14. Reliability & Evaluation Checklist

Checklist ItemWhy It Matters
Case Facts PatternPlace non-negotiable transactional data, such as Max Budget, in a persistent block outside summarized history; it is re-injected every prompt and survives summarization.
Stratified Random SamplingMeasure error rates across document or prospect segments, such as small startups versus large firms, so aggregate accuracy does not mask a weak segment.
Independent Review InstanceFinal outputs should be audited by a fresh Claude session isolated from the generator's reasoning bias.
Information ProvenanceRequire subagents to output structured claim-source mappings, including URLs, excerpts, and dates, for downstream synthesis.
Back to Module 11 Lab Overview