Claude Code Playbook

Start here

Your first hour with the playbook.

New to Claude Code? Build the core of this playbook into your own project in six short steps. Each one gives you something to copy and a way to check that it worked.

Before you start

Claude Code installedFollow the official quickstart. Ten minutes if you have never used it.
A project in gitAny language. A fresh folder with git init works fine for practice.
Node 18 or newerThe small scripts in the starter kit are plain Node, so they run on macOS, Linux and Windows.

Get the starter kit once. The commands below work in macOS and Linux terminals and in Git Bash on Windows. Run them from your project folder.

git clone https://github.com/mahi9119/claude-code-playbook.git ../claude-code-playbook
1

Give Claude a short set of rules

15 minutes

Claude Code reads a file called CLAUDE.md in your project at the start of every session. It is the one place to tell Claude how your project works and how you want it to work with you. Start small. Twenty lines you mean beat two hundred you copied.

cp ../claude-code-playbook/starter/CLAUDE.md ./CLAUDE.md

Open it and fill in the parts in <angle brackets>: what the project is, and the commands to run and test it. Leave "Rules for this codebase" almost empty. It fills up as Claude makes mistakes. You can also run /init inside Claude Code to have it draft one from your code, then cut it down to the same shape. More in the docs on CLAUDE.md files.

Check it workedStart Claude Code in the project and ask: What are the rules for this project? It should repeat yours back.
2

Start a lessons log Claude reads every session

10 minutes

Claude does not remember yesterday's session. So when it makes a mistake, write the lesson down once, in a file, and have it read automatically every time a session starts. That is what a hook is for: a command Claude Code runs at a fixed moment. Whatever a session-start hook prints, Claude reads.

mkdir -p docs scripts .claude
cp ../claude-code-playbook/starter/docs/lessons.md docs/ && cp ../claude-code-playbook/starter/scripts/show-lessons.mjs scripts/
cp ../claude-code-playbook/starter/.claude/settings.json .claude/

If you already have a .claude/settings.json, do not overwrite it. Open the starter's copy and paste its "hooks" block into yours. The hook is only this:

// .claude/settings.json
{ "hooks": { "SessionStart": [ { "hooks": [
  { "type": "command", "command": "node scripts/show-lessons.mjs" }
] } ] } }

The lessons file comes with one example entry, so you can see the shape. Replace it with your own when the first real mistake happens.

Check it workedRun node scripts/show-lessons.mjs and you should see the table. Then start a new Claude session and ask: Which lessons were you given at startup?
3

Turn your first mistake into a guard

20 minutes

A lesson someone has to remember is a reminder. A script that fails when the mistake comes back is a guard. Guards are the heart of this playbook, because they work even when nobody remembers. The starter's example guard catches debug console.log lines left in src/.

cp ../claude-code-playbook/starter/scripts/check-no-debug-logs.mjs scripts/

Add it to the scripts section of your package.json, so one command runs every check:

"check": "node scripts/check-no-debug-logs.mjs"

Now prove it can fail. This is the step people skip, and a guard that has never been red has never been tested.

  • Add console.log("test") to any file in src/.
  • Run npm run check. It should print FAIL with the file and line, and exit with an error.
  • Remove the line and run it again. It should print OK.

Not using JavaScript? Keep the idea and change the details: the folder, the file extensions, and the pattern are three settings at the top of the script.

The rule from here on: every lesson in your log names the guard that now enforces it, or says judgment and explains why no check is possible. When a judgment lesson happens a second time, build its guard.
4

Plan before you build

A habit, not a setup

For anything bigger than a small fix, ask Claude for a plan before any file changes. In the terminal, press Shift+Tab to switch to plan mode, describe what you want, and read the plan before you approve it. It is far cheaper to fix a wrong plan than wrong code.

Ask for one thing in every plan: a Verification section written as checkboxes, not a numbered list.

## Verification
- [ ] Tests pass, with the count shown
- [ ] The new page works in the browser
- [ ] Error message shown when the form is empty

A checkbox has a state you can see. A numbered list does not, and that is exactly how a planned feature quietly never gets built. Tick each box only with the evidence written next to it.

Try itAsk: Plan this change. End the plan with a Verification section of checkboxes.
5

Get a second opinion before you commit

5 minutes each time

The session that wrote the code is the worst reviewer of it, because it already believes the code is right. Before committing anything that matters, open a new session and ask it to review the change:

Paste into a fresh sessionReview my uncommitted changes for bugs. Try unusual inputs: empty values, very large numbers, dates at month end. Do not edit any files.

When you want this on demand, copy the playbook's reviewer into your project as a subagent. Claude then runs it in its own fresh context whenever you ask for a review.

mkdir -p .claude/agents && cp ../claude-code-playbook/agents/tier2-reviewer.md .claude/agents/

Edit the line in its first paragraph that describes your project, and it is ready.

6

Level up when something hurts

Whenever you need it

Do not install the rest of the playbook on day one. Each piece exists because of a specific failure. Add it when you hit that failure yourself:

When this happensReach for
You keep correcting Claude on the same project rulesThe full CLAUDE.md template. Copy only the sections that match your pain.
Bugs around dates, money, or two things happening at onceThe plan template and its table of hostile inputs
A feature was planned but part of it never got builtThe plan-drift guard
You make the same architectural argument twiceA decisions log, shown at session start like the lessons
Claude commits or pushes before your checks runThe git-write block hook and one release script
You want work to continue while you are awayThe overnight skill and its table of decisions it must not make
You are about to install a new tool, skill or MCP serverThe six-point vetting check in the CLAUDE.md template

Your checklist

You are set up when all of these are true.

0 of 6 done. Ticks are saved in this browser only.

Then read the full playbook to see where this leads after six months and 956 commits, and the twelve incident stories behind its rules.