Key Principle
Two levers run through every chapter: context richness is the quality lever, human verification is the safety lever. Most rules below are one of those two, applied to a specific situation. The single most-repeated fact underneath them: Claude "simulates reasoning but cannot execute actual code or external requests" (Chapter 4) — so the human is always the verification gate.
Why This Matters
Heuristics are how the book's mechanisms survive contact with a real task. A memorized script breaks when inputs shift because "Claude responds dynamically"; a heuristic is a mental model that transfers. "The goal is mastery through understanding, not dependence on pre-written scripts." (Chapter Preface)
Rules of Thumb
Prompting
- Answer the three unspoken questions in every prompt: what to build, how it behaves, what format (Chapter 3).
- Make it specific: "If your question is vague, the reasoning path will be broad; if specific, Claude narrows its reasoning." (Chapter 3)
- Outline the approach before generating code; separate reasoning from execution (Chapter 3).
- Curate, don't dump — more context is not better; overload "blurs focus" (Chapter 2).
- Anchor session-wide standards and guardrails once in a system prompt; reinforce mid-session to fight drift (Chapter 3).
- Treat prompt failures as communication failures: "Reframe the prompt rather than correcting the model." (Chapter 3)
- Remember the cookbook law: "prompt specificity equals reliability." (Chapter 14)
Debugging & Review
- Supply intent and libraries used, or "Claude can only guess the goal" when debugging (Chapter 4).
- Calibrate trust: accept corrective fixes after verifying, judge advisory suggestions, re-prompt when context-limited (Chapter 4).
- Trust the reasoning when it explains why; verify when performance, security, or architecture trade-offs are involved (Chapter 4).
- Treat output as a starting point, not a command: "It's an intelligent collaborator, not an infallible compiler." (Chapter 4)
- The antidote to ambiguity is explicitness — add quantifiers, output structure, examples, persona, self-checks (Chapter 13).
- Read every ambiguous response as "a free diagnostic report" revealing the missing constraint (Chapter 13).
- Layer review: static validation → semantic tests → human as "the final authority." (Chapter 11)
- Have Claude review its own prompt+response to flag gaps when no human is in the loop (Chapter 13).
Refactoring
- Preserve behavior: output before and after must be identical for the same input (Chapter 5).
- Generate a parity test asserting
original == new, or "refactoring" silently becomes "rewriting with bugs" (Chapter 5). - Refactor one module/class/function at a time — never "refactor the project" (Chapter 10).
- Validate each step and record why in commits/docs for traceability (Chapter 10).
- Earn optimization; don't reflex to it: "the smartest optimization is often restraint." (Chapter 5)
- Chase asymptotic wins (O(n²) list → O(1) set lookup, batch DB reads, async I/O, memoize) over microsecond tweaks (Chapter 5).
- Introduce seams (repository, service layer, composition root) so structure can evolve without touching route code (Chapter 10).
Context Management
- You are the keeper of memory — restate language, framework, and goals every few turns (Chapter 2).
- Claude stores no long-term memory between prompts; it "only uses the context you provide" (Chapter 10).
- Maintain a persistent
claude_context.md(conventions, architecture, goals) pasted each session as single source of truth (Chapter 10). - For large repos, feed summaries and references, not full file dumps; add files only when Claude asks (Chapter 10).
- Externalize, re-inject constraints: "When Claude remembers, it doesn't just recall — it reasons in context." (Chapter 16)
Cost Discipline
- Pull the four cost levers: model selection, context discipline, interaction design (batch + reusable summaries), output control (Chapter 5).
- Optimize for intent per token, not word count: "Token efficiency isn't about writing short prompts — it's about writing smart ones." (Chapter 12)
- Constrain output explicitly ("≤150 words," "return only the final script") — output length is the cheapest cost lever (Chapter 12).
- Estimate cost before execution; on breach, downshift model or trim context (Chapter 12).
- Read
message.usageso spend is measured, not guessed: "clarity beats verbosity." (Chapter 6) - Define the fixed system prompt once and inject only variable parts; stop resending what hasn't changed (Chapter 12).
- Keep generation under ~40% of input size, and fix temperature ≤ 0.2 for CI/CD and production prompts (Appendix A.4 / Chapter 16).
Security & Governance
- "Treat it as a tool, not a teammate. Assign accountability to humans, not the AI." (Chapter 11)
- "No AI-generated output should ever be trusted blindly." (Chapter 11)
- Govern because speed scales harm: a single unvalidated input can propagate through many modules (Chapter 11).
- "never send what you wouldn't email to a third-party system" — redact secrets/PII before prompting (Chapter 11).
- Redact freely — "Claude's contextual reasoning still functions" without seeing real keys or PII (Chapter 11).
- Halt the build on any audit violation (Bandit, license gate) — volume makes manual catch impossible (Chapter 11).
- Apply least privilege per environment and per agent role (dev broad/dummy, staging limited, prod read-only) (Chapter 11).
- Treat persistent context as persistent data risk — make sessions inspectable, limitable, resettable (Chapter 15).
Workflow & Future-Proofing
- Think in cycles: Intent → Reasoning → Execution → Verification → Reflection (Chapter 6).
- Keep the methodology, not just the artifact — the reusable asset is the prompt-driven cycle (Chapter 7).
- Use deterministic image tags (commit SHA, not
latest) so rollback and forensics aren't guesswork (Chapter 7). - Version prompts as tested assets: "every successful prompt turns into a tested component." (Chapter 13)
- Structure workflows around data, not assumptions; read model IDs from config, never inline (Chapter 16).
- Run the reflective loop after each project: what can Claude learn, what can I learn, how do both improve (Chapter 16).
- Invest in clarity and modularity now: "the future of software development won't belong to those who code the fastest, but to those who communicate the clearest." (Chapter 16)
Key Quotes
"Cost control with Claude Code is a product of clarity and structure." — Kilian Voss, Chapter 5
"Treat it as a tool, not a teammate. Assign accountability to humans, not the AI." — Kilian Voss, Chapter 11
"Token efficiency isn't about writing short prompts — it's about writing smart ones." — Kilian Voss, Chapter 12
Rules of Thumb
- (See the grouped lists above — this file is itself the consolidated rule set.)
Related References
- Prompt Anatomy — Specificity, Chain-of-Thought, and Context as Bandwidth - the prompting rules in depth
- The Claude Loop - the workflow-cycle rules
- Cost and Latency Optimization — Tokens as a Financial Control - the cost-discipline rules
- Security, Governance, and Human-in-the-Loop Verification - the governance rules
- Implementation Playbook — From Per-Task Loop to Enterprise Scale - how to sequence these into practice