Claude, Nutshell Series

Claude Exam Quick Revision 6: Tools, Configuration & Rules

Built-In Tools

  • Read: Read a known file.
  • Edit: Targeted replacement inside an existing file.
  • Write: Create or overwrite an entire file.
  • Glob: Find files by filename/path pattern.
  • Grep: Search text inside files.
  • Bash: Run shell commands.
  • Agent: Delegate work to a separate-context subagent.

Memory: Glob finds files. Grep finds text.

Configuration Scopes

  • User: ~/.claude/ → me across projects.
  • Project: repository configuration → team/repository.
  • Local: personal settings for one repository.
  • Managed: organization-enforced configuration.

Important Files

  • CLAUDE.md: Instructions and project guidance.
  • settings.json: Claude Code configuration.
  • settings.local.json: Personal project overrides.
  • .claude/rules/*.md: Modular/path-specific instructions.
  • .mcp.json: Shared MCP configuration.
  • SKILL.md: Reusable skill definition.
  • .claude/agents/: Custom subagents.

Path-Specific Rules

---
paths:
  - "**/*.tf"
---

Use path-scoped rules when standards should apply only to particular files.

Global standards → CLAUDE.md
File-specific standards → .claude/rules/

Important Principle

CLAUDE.md provides instructions but does not provide deterministic security enforcement.

Claude, Nutshell Series

Claude Exam Quick Revision 5: Multi-Agent Workflow Patterns

Prompt Chaining

Use when the sequence is predictable and known in advance.

Example: Extract → Validate → Transform → Publish.

Dynamic Adaptive Decomposition

Use when intermediate discoveries determine the next step.

Example: Debug issue → inspect logs → discover database problem → inspect queries.

Routing

Classify the input and send it to the appropriate specialist or workflow.

Parallel Sectioning

Run different independent subtasks simultaneously.

Example: Security review + performance review + maintainability review.

Parallel Voting

Run the same task multiple times and aggregate results for greater confidence.

Orchestrator-Workers

A coordinator dynamically creates and delegates subtasks to specialized workers.

Evaluator-Optimizer

Generate → critique → improve → repeat.

Context Efficiency

Let subagents perform verbose exploration and return concise synthesized findings to the coordinator.

Memory:
Chain = fixed path.
Route = choose path.
Parallel = many paths.
Orchestrator = create paths dynamically.
Agent = decide next step dynamically.

Claude, Nutshell Series

Claude Exam Quick Revision 4: Hooks, Enforcement & Escalation

PreToolUse

Runs before a tool executes.

Best for:

  • Blocking unauthorized transactions.
  • Enforcing refund limits.
  • Checking prerequisites.
  • Preventing policy violations.

Example: Refund > $500 → block and escalate before process_refund executes.

PostToolUse

Runs after a tool returns.

Best for:

  • Trimming verbose results.
  • Normalizing MCP outputs.
  • Keeping only fields needed by the agent.

Example: Tool returns 40 fields → retain status, shipping date and tracking number.

Escalation: Good Triggers

  • Explicit request for a human.
  • Policy gap.
  • Permission boundary.
  • High-risk operation.
  • Deterministic hook blocks an action.

Escalation: Bad Triggers

  • Negative sentiment alone.
  • Profanity alone.
  • Self-reported model confidence alone.

Memory: Prompts guide. Hooks enforce.

Claude, Nutshell Series

Claude Exam Quick Revision 3: Agentic Loops & Tool Calling

Agentic Loop

Flow:

Claude → tool_use → execute tool → tool_result → Claude → next action → end_turn

When Should the Loop Stop?

  • stop_reason = tool_use: Execute tool and continue.
  • stop_reason = end_turn: Claude has finished the turn.

Do not: Parse phrases such as “task complete” or “I am done.”

A maximum-turn limit is useful as a safety guard, but it is not the primary completion signal.

Returning Tool Results

  • Return the result in a user-role message.
  • Use a tool_result block.
  • Match the original tool_use_id.
  • The result does not have to be JSON-only.

Multi-Turn Tool Calling

Each tool result can influence Claude’s next decision.

Example: Search → Read → Analyse → Call API → Final answer.

Memory: tool_use = continue. end_turn = finish.

Claude, Nutshell Series

Claude Exam Quick Revision 2: Context & Session Management

Important Commands

  • /compact: Summarise conversation and reclaim context.
  • /clear: Start with an empty conversation context.
  • /resume: Continue a previous session.
  • /context: Inspect context-window usage.
  • /branch: Explore an alternative path from the current conversation.
  • –fork-session: Inherit context but create an independent session.
  • /rewind: Return to an earlier checkpoint.

Preserving Critical Information

  • Immutable facts: Account ID, agreed price, transaction ID.
  • Mutable facts: Status, progress, next action.
  • Derived facts: Conclusions based on evidence.
  • Unverified facts: Claims still requiring confirmation.

Do not repeatedly summarise critical transactional facts. Keep them in a structured case-facts block or external state.

Long-Running Tasks

Persist important discoveries to external scratchpad/state files so they survive compaction, context resets and session boundaries.

Resuming Multi-Agent Work

Best pattern: each agent persists structured output, while a coordinator maintains a manifest/checkpoint and restores only relevant state.

Memory: Compact history. Persist facts. Rehydrate only what is needed.

Claude, Nutshell Series

Claude Exam Quick Revision 1: Prompt Engineering & Few-Shot Prompting

Core rule: Precise instructions beat vague instructions.

Prompting Types

  • Zero-shot: Instruction only, no examples.
  • One-shot: One example demonstrates expected behaviour.
  • Few-shot: A small number of examples guide difficult decisions.
  • Negative examples: Show what Claude should NOT identify.
  • Contrastive examples: Show why one similar case is correct and another is not.

When to Use Few-Shot Prompting

  • Ambiguous classification.
  • Sarcasm or mixed sentiment.
  • Subjective boundaries.
  • Important edge cases.

Good pattern: Use 2–4 diverse examples including at least one difficult edge case.

Reducing False Positives

Use explicit and measurable criteria instead of instructions such as “flag anything suspicious.”

Example: “Flag functions longer than 50 lines” is better than “flag overly complex functions.”

Exam Traps

  • Temperature 0 improves consistency, not correctness.
  • Few-shot examples guide behaviour but do not guarantee enforcement.
  • Critical business rules should be implemented programmatically.

Memory: Ambiguity → examples. Hard rule → code.