Get Started
Build with Claude Code

Mission 5 of 7

Let Claude Code run hands-off, without wrecking anything.

Permissions are a list the model consults. Hooks are code that runs every time, whatever the prompt says. Build hooks that block dangerous commands, clean up after it and check the tests.

55 minIntermediateFree (uses your existing Claude Code setup)Step 1 free

What you'll do

Understand the three hook points

Learn the difference between a rule the model reads and a rule the harness enforces.

Build the blocker and two checks

Block the dangerous commands, auto-format every file it touches, and refuse a 'done' while tests fail.

Run hands-off in a safe place

Use a throwaway worktree or a container so the worst case is a deleted folder.

  • Force pushes, rm -rf and .env access refused whatever the prompt says
  • An end to the fake 'tests pass' problem
Before you start
  • Claude Code set up with a CLAUDE.md and the permissions file from mission 1
  • Node installed (the hooks here are small Node scripts; any language works, Node is just everywhere)
  • A project with a test command and a linter. If you don't have a linter, skip the format hook, keep the other two
Your progress0/6
01/06Why 'please don't' isn't enough0 done
STEP 01 of 06~5 min

Why 'please don't' isn't enough

Understand the difference between a rule the model reads and a rule the harness enforces.

Before you build anything, it's worth seeing why a hook is different from a rule you write down.

Advice versus enforcement

Everything in CLAUDE.md is advice. Good advice, followed most of the time, but advice. If you write 'never force push', it will follow that 98 times out of 100.

The hundredth time, after a confusing merge, it might decide a force push is the fix. And a confused model with a force push is how you lose a day.

A hook is different. It's a script that Claude Code runs itself at a fixed moment: just before a tool call, just after, or when it's about to stop.

The script sees what's about to happen and can block it, change the outcome, or feed information back. The model can't skip it, argue with it or forget it. It's enforcement, not persuasion.

The three moments you care about

  • PreToolUse: before a tool runs. Block things here. The tool call never happens if the hook says no.
  • PostToolUse: after a tool runs. Clean up here. Format the file it just wrote, lint it, and send any errors back so it fixes them.
  • Stop: when it thinks it's finished. Verify here. If tests fail, tell it it's not finished.
Tip
Hooks are plain scripts. They get JSON on stdin describing the tool call, and they talk back with their exit code: 0 means carry on, 2 means block and show my message to the model. That's the whole interface. You can write them in bash, Python, Node, anything.
Checkpoint
You can say which of the three hook points you'd use to stop a DROP TABLE, and which to run prettier.
Stuck? Ask the community
Next mission · Build with Claude CodeSubagents and parallel work: run three builders at once and a reviewer who didn't write the code
→