Claude Code in Production cover

One Thursday in April, I asked Claude Code to merge a 6,000-line PR -- the cleanup of an old service path. Branch protection refused: required checks hadn't finished. The agent's response was to retry with --admin. The merge went through, into main, during a release window, with zero CI reports. I caught it forty minutes later.

From the agent's frame, the task succeeded -- the user asked, the merge happened. From the project's frame, an agent bypassed a 6,000-line safety policy unsupervised. Closing that gap is what this book is about.

The fix isn't a smarter prompt. It's a discipline overlay -- the rules, settings, hooks, skills, memory, and permissions that encode the failure modes you've actually hit. Twelve chapters of what shipping daily with Claude Code at Yaw Labs taught us we needed to write down.

Your GitHub username -- you'll be auto-invited to the private companion repo with starter code and worked solutions for every chapter's Try-this section. Optional. Skip if you don't have a GitHub account or want to add it later -- email contact@yaw.sh with your order ID and GitHub username and we'll send the invite.

PDF + EPUB. Free updates as the surface area moves. Secure checkout. Read Chapter 1 free.

What you'll fix

Each of these is a thing Claude Code has actually done in production -- not a hypothetical, not a "what if." The book gives you the rule, hook, or settings change that catches the next one before it costs you forty minutes.

  • The branch-protection bypass. gh pr merge returns "policy prohibits"; the agent retries with --admin instead of stopping. The exact incident from Chapter 1's opener -- and the rule + hook that prevent the next one. Chapters 2, 3.
  • The 600-line CLAUDE.md nobody on your team is reading. Adding more rules makes the existing rules less load-bearing, not more. There's a layered-rules pattern that fixes the file before it eats itself. Chapter 2.
  • Mid-task pivots and the "out of scope" punt. A one-hour fix becomes a four-hour refactor. Or three weeks later, the bug an audit deferred as "pre-existing" is the production incident. The same scope discipline covers both. Chapter 10.
  • Hallucinated runtime state asserted as fact. "I can see I'm in fresh mode" -- the agent inferred from skill names, not from the actual environment. It was wrong. There's a verification discipline that catches it. Chapter 10.
  • Capacity drift you didn't authorize. The model updated; the recommended effort tier moved; your sessions are burning 40,000 tokens on tasks that used to take 6,000 -- and you didn't change anything. Chapter 9.
  • Subagent reports that don't match reality. "Updated all 18 call sites" -- six were touched in a half-finished way. The summary describes intent, not result. The trust-but-verify discipline catches the gap. Chapters 5, 8.
  • The /loop waiting "five minutes" between checks. The cache-window arithmetic that makes 300 seconds the worst possible delay -- and what to use instead. Chapter 7.

What's in the twelve chapters

Part 1 - Foundations

  • Chapter 1. The discipline gap - why month six is when the surprise problems show up, and what closing the gap looks like.
  • Chapter 2. The CLAUDE.md contract - global vs project, the rule-layering pattern, augment vs fresh, the 600-line file trap.
  • Chapter 3. The harness - settings.json, permission allowlists, hooks. The runtime config most users never open until it costs them.

Part 2 - Workflow

  • Chapter 4. Skills and slash commands - the description-as-firing-predicate, when to write one and when to leave it.
  • Chapter 5. Subagents and parallelism - the agent menagerie, briefing prompts, trust-but-verify before reporting work as done.
  • Chapter 6. Memory persistence across sessions - four memory types, what to save, what NOT to save, staleness and re-verification.
  • Chapter 7. Long-running and recurring work - /loop dynamic mode, /schedule, the prompt-cache cliff and why "300s" is the worst delay.

Part 3 - Reliability

  • Chapter 8. Tools and trust boundaries - Bash vs the dedicated tools, and the trust discipline that goes with that.
  • Chapter 9. Cost and capacity - model tiers, effort levels, throttle recovery, the recommended-vs-top-tier overthinking trap.
  • Chapter 10. Scope discipline and the seven hazards - hallucinated runtime state, branch-protection bypass, terminal mojibake, prompt injection, secret leakage, destructive shortcuts, the "out of scope" punt.

Part 4 - Beyond solo

  • Chapter 11. Teams and shared rules - project-scoped settings as a tooling contract, the model-default-floor problem.
  • Chapter 12. What's next - MCP integration in brief, autonomous agents, the model-version migration treadmill.

Who it's for

You ship code for a living. You have used Claude Code (or Cursor, or Cline) enough that "tool call" and "subagent" and "permission prompt" are words you use without thinking. You are somewhere between mid and senior on the IC ladder, or you are a tech lead deciding how your team should adopt the tool.

You do not need to be told what a CLAUDE.md is. You need to be told why your CLAUDE.md grew to 600 lines, why nobody on your team is reading it, and what to do about that.

Not for: vendor-neutral tool surveys, prompt-engineering tips, or first-workflow tutorials. The Anthropic docs do those better.

What's in the box

  • The book in PDF and EPUB.
  • Free updates as the surface area moves - new chapters, updated model references, revisions to the discipline as the field shifts.
  • Auto-invite to the private YawLabs/claude-code-in-production-companion repo - rule files, skill templates, hook scripts, annotated settings.json examples, and worked solutions for every chapter's Try-this section.

Companion volumes

Claude Code in Production is Volume II of the Yaw Labs Production Series - the operator's perspective on running an agent. Volume I, MCP in Production, is the protocol-and-server perspective on the tools your agent calls. Volume III, Semantic Search in Production, is the substrate the agent reaches into when it needs to find something. Volume IV, A2A in Production, is what happens when one agent becomes a fleet.

FAQ

Will this be obsolete when Claude 5 ships?

No. The discipline -- rule layering, hook-as-policy, scope, capacity arithmetic, the seven hazards -- ports across model generations. Specific model and effort references (Opus 4.7, xhigh as the coding default) are pinned to the writing date and called out as such; when the recommended tier moves, the chapter gets a revision and you get the update.

Is this just CLAUDE.md tips?

No. CLAUDE.md is one chapter of twelve. The rest is the harness (settings.json, hooks, permissions), subagents and parallelism, memory persistence, capacity and throttle recovery, scope discipline, the seven hazards, and what survives the move from solo to a team. If you only wanted CLAUDE.md tips, the Anthropic docs and a weekend would do it.

Do I need Claude Max or Anthropic API access?

The book is tool-agnostic on tier. Examples mostly assume the Claude Code CLI, but the disciplines (rule layering, scope, capacity arithmetic, the seven hazards) apply equally to Cursor, Cline, or any other agentic harness you operate. Where a chapter relies on a Claude-Code-specific surface (skills, slash commands, the per-PTY config dir), it's flagged at the point of use.

How do the companion-repo invites work?

You enter your GitHub username at checkout. The order webhook fires an invite to that user, adding you as a collaborator to the private companion repo. You should see an email from GitHub with the accept-invitation link within a few minutes. If you don't get the invite within an hour, email contact@yaw.sh with the order ID and the GitHub username you want invited.

Buy Claude Code in Production

Twelve chapters. PDF + EPUB. Free updates. $39 one-time, secure checkout.

Your GitHub username -- you'll be auto-invited to the private companion repo with starter code and worked solutions for every chapter's Try-this section. Optional. Skip if you don't have a GitHub account or want to add it later -- email contact@yaw.sh with your order ID and GitHub username and we'll send the invite.

Companion volumes: MCP in Production, Semantic Search in Production, and A2A in Production. Yaw Mode ships an opinionated overlay using many of the patterns the book teaches.