Guides · Series · 11 parts

The Claude Code Engineering Playbook

Claude Code has four layers — context, skills, subagents, hooks — and the variable that decides which one you need is enforceability, not capability.

The common mistake is layer selection

Most teams that struggle with Claude Code are not misconfiguring it. They are reaching for the wrong layer. A workflow the agent keeps forgetting gets written as a longer prompt when it should be a skill. A policy that must hold every time gets written as a skill when it should be a hook. A task that pollutes the main session gets run inline when it should be a subagent.

The layers are not interchangeable and they are not a hierarchy of sophistication. They differ on one axis that matters more than any other: enforceability. A skill is a suggestion the model may follow. A hook is a gate it cannot see and cannot argue with. Confusing those two is where most production agent failures come from, because it produces a system whose safety guarantees are probabilistic while everyone believes they are absolute.

This playbook works through each layer, what it is genuinely for, and how to tell which one your problem needs.

Operating model, not configuration

The other half of the series is about running the thing. Context engineering determines whether the agent can do the task at all — prompt engineering tells the model what to do, context engineering decides whether it is equipped to. Subagents let you parallelise inside a session without poisoning the parent’s context. Observability is how you find out what actually happened, since most Claude Code failures leave no trace by default. Testing tells you whether your setup produces consistently good output, which skill-level evals cannot.

And when the human leaves the loop entirely — headless runs in CI — every safety net that depends on a person is gone: no approval, no rewind, nobody reading the output. What is left is exactly what you enforced in advance. That is the sharpest possible statement of the series’ argument, which is why it comes last.

Which part solves my problem

The series reads in order, but if something is already broken, start here.

  • The agent has the right instructions and still cannot do the task.Part 1
  • I am re-teaching the agent the same workflow on every single call.Part 2
  • One big exploratory task fills the context and derails everything after it.Part 3
  • I told it never to do X in the prompt, and it did X.Part 4
  • I do not know whether this problem needs a skill, a subagent, or a hook.Part 5
  • My setup works but I am nowhere near the throughput I see other people getting.Part 6
  • Something went wrong in a long session and there is no trace of why.Part 7
  • My skills pass their evals and the output quality is still inconsistent.Part 8
  • I cannot tell which of my guardrails are actually binding.Part 9
  • I have been relying on /rewind as if it were version control.Part 10
  • I want to run this in CI with no human watching it.Part 11

The series

11 of 11 published

Part1

Context Engineering: The Skill That Separates Production Agents from Demos

Prompt engineering tells the model what to do. Context engineering determines whether it can actually do it.

Part2

Agent Skills Are Not Prompts. They Are Production Knowledge Infrastructure.

Every team is re-teaching their agent the same workflows on every call. Skills are how you stop paying that tax.

Part3

Subagents: How to Run Parallelism Inside a Single Agent Session Without Poisoning the Parent

Every subagent burns its own context so the parent doesn't have to. That's the entire architecture.

Part4

Hooks: The Enforcement Layer That Turns Agent Policy Into Agent Fact

Prompts suggest. Hooks enforce. Until you know the difference, your agent's safety guarantees are probabilistic.

Part5

Which Claude Code Layer Solves Your Problem? A Diagnostic Guide for AI Engineers

Reaching for a subagent when you needed a skill is the most common mistake teams make. Here is how to stop making it.

Part6

Four Habits from the Creator of Claude Code That Will Change How You Ship

Boris Cherny runs 10-15 parallel sessions, ships 20-30 PRs a day, and calls his setup 'surprisingly vanilla.' The gap is not configuration. It is operating model.

Part7

You Can't Debug What You Can't See: Observability for Claude Code Sessions

Most Claude Code failures leave no trace. Here is how to build the audit trail that tells you exactly what happened, why it went wrong, and how to stop it happening again.

Part8

How to Know Your Claude Code Setup Actually Works: Testing Beyond the Skill Level

Skill evals tell you a skill works in isolation. They do not tell you whether your agent produces consistently good code. That requires a different kind of test.

Part9

Skills vs Hooks in Claude Code: Enforceability Is the Design Variable

A skill is a suggestion the model may follow. A hook is a gate it cannot see and cannot argue with. Most production agent failures come from confusing the two.

Part10

Checkpoint Complacency: Claude Code /rewind vs Git Commits

Checkpointing feels like git. It covers a fraction of what git covers - and that gap is exactly where real work gets lost.

Part11

Headless Claude Code: When the Human Leaves the Loop, Hooks Are All You Have Left

Running Claude Code in CI strips away every safety net that needs a human - approval, rewind, reading the output. What's left is what you enforced in advance.

Other guide series

Books by Ranjan Kumar

Building Real-World Agentic AI Systems with LangGraph cover

Building Real-World Agentic AI Systems

The Chat Templates Handbook cover

The Chat Templates Handbook