What this manual checks, and what it does not (Preface)
This is a free field manual for running Claude Code without losing work.
It is the companion to cc-safe-setup, an MIT-licensed tool that installs safety hooks into Claude Code. Everything in this book is also in the repository. You are not paying for secrets. You are getting the parts that matter, in the order you need them, with the output of every command shown so you can tell whether yours matches.
Three things this book is not.
It is not a collection of horror stories. Every command output printed in Chapters 1 to 6 came from a clean sandbox, and the output you see is the output that came back. From Chapter 7 onward some numbers come from the author’s own machine and from counting the repository — where that is the case, the text says so. Where a command fails, the failure is printed too, because a check that cannot fail is not a check.
It is not a replacement for reading the tool’s own documentation. It is the path through it.
It is not neutral about one thing: the version you installed may not be the version you think you installed. For five months the npm package was not the one you wanted. That is fixed as of 2026-09-24, and the way to find out what is actually on your machine is Chapter 5. If you read nothing else, read that.
How it is arranged
Chapters 1 to 6 are the path: measure what you have, install, prove the guards fire, read the log afterwards. That is enough to get an unprotected project to a defended one, and if it is all you read, the book has done its job.
Chapters 7 to 9 are about the ways a defended project stops being one without telling you. Which event a hook is on decides whether it can refuse at all (Chapter 7). Two out of every three scripts in this collection have no way to refuse anything, and more than a third of the ones named like a door cannot close (Chapter 8). And a hook that breaks does not fail in one direction: depending on how it broke and which interpreter your settings named, the same accident either blocks everything or silently waves it all through (Chapter 9). Chapters 8 and 9 each end with commands you can run against your own machine in under a minute.
Chapter 11 answers a question this book had no line about: whether --dangerously-skip-permissions turns off the hooks and rules you configured. Thirty-seven of the search phrasings I collected ask it in one wording or another. It sits after the reference sections because it stands on its own — if it is the reason you opened this book, read it first.
Chapter 10 and Appendix A are reference. All 916 hook scripts in the repository, grouped by what they are for where the repository itself says so — 261 of them it does not categorise, and they are listed together at the end — each one marked with the event it runs on and whether the file contains a refusal at all, which Chapter 8 explains is necessary and not sufficient. Then an index that goes the other way, from a GitHub issue number to the hooks that cite it. Nothing in those two sections was written to describe a script that did not already describe itself.
Who this is for
You run Claude Code on a real repository. Perhaps you leave it running while you do something else. You have had, or can imagine having, the moment where you look at the terminal and something is gone.
You do not need to be a hooks expert. Hooks are shell commands Claude Code runs at fixed moments — before a tool call, after one, when a session starts, when you submit a prompt. A synchronous PreToolUse command hook that exits with code 2 blocks that call — synchronous because a hook set to run in the background has already let the call through by the time it answers. That is the mechanism this book leans on, and Chapter 7 is about the part the sentence hides: on some of those moments exit 2 means nothing at all, and some of the things you want to stop never reach a hook in the first place.