a guardrail / hook pack for Claude Code
rm -rf/-fr in any flag order, mkfs, writes to a block device, fork bombs.
Example: sudo rm -rf / is denied outright.
main/master.
Example: git push --force origin main is denied; git push origin main asks first.
.env or writing an AWS access key literal is denied.
terraform destroy is denied; NODE_ENV=production migrations ask first.
npm publish asks; npm publish --access public is denied unless explicitly allowed.
curl https://example.com/i.sh | bash is denied.
docker exec, a remote shell, or a subprocess the agent spawns opaquely — only the top-level tool call the CLI hands it is inspected.As a Claude Code plugin (nothing is written into your repository; disable it from /plugin at any time):
/plugin marketplace add trimkeep/claude-plugins
/plugin install handrail@trimkeep
Or as plain files you can read and edit in-repo:
No curl | bash — Handrail blocks exactly that pattern, so it ships the same way it expects everyone else to install things:
git clone https://github.com/trimkeep/handrail-kit
cd handrail-kit
./install.sh /path/to/your/project
This copies the six hook scripts into <your-project>/.claude/hooks/handrail/ and merges the hooks block into <your-project>/.claude/settings.json, backing up an existing file first. Running it again is a no-op if nothing changed.
To remove it:
./uninstall.sh /path/to/your/project
Every hook treats what it doesn't understand as dangerous, not safe: missing jq, empty stdin, stdin that isn't valid JSON, or a tool call with no tool_input all make the hook deny rather than pass the call through.
And every hook only ever removes permission — it denies outright, or asks the human to confirm; none of the six scripts ever emits a decision that grants permission on its own. See test/hooks.test.js on GitHub for the assertions this makes, per hook, against the shipped fixtures.
Handrail v0.9 is the paid pack. Six of its hooks are the free handrail-kit on this page. Five are only in the pack and cover secret-looking content (an expanded pattern set), protected paths, per-project write scope, a 26-rule command matrix and network egress. It never grants a permission on its own.
Checkout runs on Polar, the merchant of record; see Polar's terms and privacy policy.
No, everything is local. Secret detection, command checks and every decision happen on your machine; no scan result, prompt content, command, file path or file content is transmitted to us or anyone else.
Each hook is a small bash + jq script that inspects one tool call. It runs and exits before the agent's own request would otherwise complete — in practice, no noticeable delay.
Yes. Hooks are plain shell scripts under .claude/hooks/handrail/. Add your own alongside them and wire them into .claude/settings.json the same way — settings.example.json shows the shape.
It fails closed: missing jq, empty stdin, invalid JSON, or a tool call with no tool_input all deny the call rather than pass it through.
No. Handrail is not affiliated with, endorsed by, or a product of Anthropic.