Skip to main content
🎓 Claude Code Masterclass Learn AI-assisted development on Udemy — plus the companion book on Leanpub & Amazon. Start Learning

Claude Code Guardrails Pack

Guardrails for Claude Code, ready to install

The hooks and settings I use so Claude Code doesn't delete files, install a package published yesterday, commit untested code or write outside the repo. Plus the fixes for the errors people search for most.

Buy the pack · $19 Instant download · VAT handled at checkout
Claude Code Guardrails Pack cover

What's inside

Four tested hooks

No rm (use trash), no packages first published less than 30 days ago, no git commit before pytest passes, no writes outside the repository. Each denial tells Claude what to do instead.

One-command install

install.sh copies the hooks into your repo and merges the wiring into .claude/settings.json. It backs up your file and never duplicates entries.

Settings presets

Deny reads of .env, secrets/, ~/.ssh and ~/.aws; ask before git push, terraform apply and kubectl delete. Plus a managed-settings file to roll the rules out to a whole team.

CLAUDE.md template

A short instructions file: ask before guessing, minimum code, surgical changes, verified goals, and the hook rules written so the agent follows them.

Doctor script

A read-only check of duplicate installs, Node version, credential variables that override your subscription, proxies, TLS, broken settings files and missing hooks.

Troubleshooting playbook (PDF)

ECONNRESET, stalled streams, crash loops, disabled subscription access, Homebrew conflicts, hooks that don't fire and usage limits, with the fixes in the order to try them.

The reasoning behind each rule is free in Claude Code PreToolUse hooks: policy guardrails. To learn the day-to-day workflow, see my Claude Code Masterclass on Udemy.

Questions

Isn't the hook code on your blog already?

Yes, the four rules are explained in my post on PreToolUse hooks, and that stays free. The pack adds what you'd otherwise build yourself: the installer, 18 tests, the settings and team presets, the CLAUDE.md template, the doctor script and the playbook.

Does it work in a real Claude Code session?

Yes. Besides the tests, it was installed in a fresh repository and Claude Code 2.1.296 was asked to run rm -rf build. The hook denied the call, Claude read the reason and offered to use trash instead, and the files were untouched.

What do I need?

Claude Code, Python 3 and jq. macOS, Linux or WSL. The test gate expects pytest; for other test runners you change one function.

Is it a security boundary?

No, and the README says so. Hooks steer a cooperative agent; they don't catch every way to delete a file. For hard limits, combine them with the permission deny rules (included), managed settings and Claude Code's sandbox.

Can my team use one copy?

The individual licence covers one developer. The team licence covers up to 20 developers in one organisation, including rolling the hooks and settings out with managed settings. For a guided rollout, see Claude Code for Teams.

Is this an official Anthropic product?

No. It's an independent pack by Luca Berton, not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.

Buy the pack · $19

Free 30-min Production AI consultation

Book Now