The Pattern Library
Pattern A: Compliance Enforcement
Scenario: "Agents must always verify X before doing Y"
Option 1: System prompt: "Always verify X before Y"
Option 2: PreToolUse hook that blocks Y until X is verified
Principle: Determinism > Probabilism for compliance
Answer: Option 2 (hook)
30-second reasoning: "must always" + compliance = deterministic enforcement required
Scenario: "Agent needs to do [specific task]"
Option 1: Give agent all 15 available tools
Option 2: Give agent the 3 tools relevant to this task
Principle: Minimum footprint
Answer: Option 2 (scoped)
30-second reasoning: minimum necessary = scoped access. Reliability + blast radius.
Pattern C: Error Handling
Scenario: "When a tool fails, the agent should..."
Option 1: Return default values and continue
Option 2: Return structured error with category and isRetryable
Principle: Fail loudly
Answer: Option 2 (structured error)
30-second reasoning: default values = silent failure = impossible to diagnose
Pattern D: Parallel vs Sequential
Scenario: "Agent needs to run tasks A, B, C which don't depend on each other"
Option 1: Run A, then B, then C sequentially
Option 2: Run A, B, C in parallel
Principle: Performance + correct use of agentic capability
Answer: Option 2 (parallel)
30-second reasoning: no dependencies = parallelize. Sequential is artificial serialization.
Pattern E: Review Architecture
Scenario: "Code was generated by Claude. Review it for bugs."
Option 1: Ask Claude to review its own code in the same session
Option 2: Use a fresh Claude instance with no knowledge of the generation
Principle: Independence eliminates bias
Answer: Option 2 (independent instance)
30-second reasoning: same session = generator's reasoning biases the review
Pattern F: Session Resume vs Fresh Start
Scenario: "Files have been modified since the last Claude Code session"
Option 1: Resume the previous session (--resume)
Option 2: Start fresh with a briefing summarizing prior findings
Principle: Stale context prevention
Answer: Option 2 (fresh + briefing) if significant files changed
30-second reasoning: stale tool results cause Claude to reason about an outdated state
Quick Reference Card
Signal word → Principle → Answer pattern
"must always" / "never" → Determinism → Hook/gate, not prompt
"all available tools" → Min footprint → Scope to necessary
"continue anyway" → Fail loud → Structured error
"independent tasks" → Parallelize → Parallel execution
"same session review" → Independence → Fresh instance
"files changed since" → Stale context → Fresh session
"compliance" / "financial" → Programmatic → Code, not prompt
"might" / "sometimes" → Explicit → Make behavior visible
Key Takeaways
- Pattern-match, don’t analyze — exam conditions require speed
- Signal words change the answer — “must always” vs “should usually” are different questions
- Complexity ≠ correctness — simpler correct architecture beats complex wrong one
- Six patterns cover most questions — memorize and apply
- 30 seconds per two-right-answers question — recognize, apply principle, move on