Leanpub Header

Skip to main content

The Claude Code Safety Field Manual

A free, verified guide to Claude Code hooks: the pre-flight checklist, what each Claude Code security guard actually blocks, and how to prove it fires.

The Claude Code Safety Field Manual
This book is 100% completeLast updated on 2026-08-27

Installing safety hooks for Claude Code takes about thirty seconds. Proving they actually block anything is the step almost everyone skips — and an unverified guard looks exactly like a working one. Free: the pre-flight checklist, what each guard really refuses, how to make one fire on purpose, and the install command that quietly hands you a frozen version.

Minimum price

Free!

$1.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
About

About

About the Book

You leave Claude Code running while you do something else. You come back and something is gone. That is the moment this manual is written against.

Hooks can stop the common ways it happens: a recursive delete, a hard reset, a secret going into a commit. Installing them takes about thirty seconds. But an installed guard and a working guard look identical from the outside, and almost nobody checks which one they have.

This is the short version of that check.

Chapter 1 — the pre-flight checklist. Four stages you can copy into your project: before the first session, before letting it run unattended, during, and after.

Chapter 2 — measure before installing. The audit is read-only. Nine findings on an empty project is a baseline, not a crisis; what matters is which of them are still there a week later.

Chapter 3 — what the guards actually refuse. The block messages, taken from the shipped hook definitions rather than from the documentation, followed by a section on what a hook cannot see at all.

Chapter 4 — prove they fire. Feed a guard the input it is supposed to refuse, and watch what comes back.

Chapter 5 — the npm package is the wrong one. It is frozen at 29.8.0 and lets three destructive commands through that the current code blocks. The obvious install command is the one that gets you that version.

Chapter 6 — after the session. An empty log of blocked commands means either that nothing dangerous was attempted or that nothing is matching, and from the outside those look the same.

Every command output printed in this book was run against a clean sandbox before publication, failures included, because a check that cannot fail is not a check.

It is the companion to cc-safe-setup, an MIT-licensed tool, and everything in it is also in that repository. You are not paying for secrets — and at a minimum price of zero, you are not paying at all. What you get is the parts that matter, in the order you need them.

What it is not: a guarantee. A hook sees one tool call at a time; it does not see intent. Chapter 3 says where the floor ends. If you want a book that tells you your agent is now safe, this is not that book.

This manual is the short version, and it stays free. The longer one is Claude Code Safety Mastery: the 50-point audit itself, plus the git, credential and subagent hooks behind it.

Author

About the Author

yurukusa

Everything I publish starts from something that actually broke.

I run Claude Code on real projects, often unattended, and I have lost work to it — twice, files simply gone the next morning. Most of what the books catalogue did not happen to me, though. It happened to other people, in public: every incident is tied to a numbered issue you can open and read, including the ones that were closed without a fix. The hooks in cc-safe-setup (MIT, open source) exist because I wanted a floor under an agent nobody was watching, and I would rather show you a stranger's incident with a link than a story of my own without one.

Two things I hold myself to. If a number in one of my books is not something I measured, it says so. And if a command is printed, the output beside it came back from an actual run — failures included, because a check that cannot fail is not a check.

I am not selling certainty. Most of what I know here, I learned by breaking my own setup.

Contents

Table of Contents

Preface: What this book is, and what it is not

  1. Who this is for

Chapter 1: The pre-flight checklist

  1. Before your first session
  2. Before letting it run unattended
  3. During the session
  4. After the session
  5. For a team

Chapter 2: Measure before you install anything

Chapter 3: What the guards actually block

  1. What this list does not cover

Chapter 4: Prove the guards fire

Chapter 5: The npm package is the wrong one

Chapter 6: After the session

Afterword

Colophon: how this book was checked

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub