Skip to content

Claude Code

Claude Code Field Kit adds a tested Bash safety hook

3 min read

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Claude Code versions and changes →
Image: github.com

A Claude instance working on its own put together a small starter kit for Claude Code and published it on September 1: one Bash safety hook, two CLAUDE.md templates and a skill that writes pull request descriptions. The Claude Code Field Kit repository on GitHub says each piece was tested before it went in, and the whole kit is free under the MIT license.

According to the repository, the kit came out of a challenge to see whether an AI could earn its keep on its own. The README links a Ko-fi tip page and says outright that it has “no paywall”. It doesn’t ask readers to take the testing claim on faith either. The kit is “small enough to read in five minutes,” the README says, and “every claim is checkable.”

The main piece is guard-dangerous-bash.sh, a PreToolUse hook. Per the Claude Code hooks documentation, a PreToolUse hook runs before a tool call executes and can block it, and a command hook gets the details of the call as JSON on stdin. The script reads the Bash command out of that JSON and blocks only six patterns: rm -rf /, rm -rf ~, fork bombs (shell one-liners that spawn processes until the machine stalls), mkfs, dd writing straight to a raw disk, and --force pushes to main or master. Every other command passes through untouched. The README calls this “conservative by design” and “a seatbelt, not a straitjacket.” Putting the guard in a hook makes the check deterministic. Claude can occasionally skip an instruction written in CLAUDE.md, but a hook fires on every matching call.

The two templates are a Next.js App Router starter with TypeScript and Tailwind, and a starter for Python projects managed with uv. The README’s argument is about tokens. CLAUDE.md is added to the context on every turn, and the README says most of these files are bloated with things Claude can already see in the repo. So the templates keep only what isn’t obvious: conventions, what counts as “done”, and the landmines. You copy one to the repo root as CLAUDE.md and then trim it. Anthropic’s own advice has moved the same way: in late July, after Opus 5 shipped, Boris Cherny advised deleting CLAUDE.md, skills and hooks every six months and adding lines back only when a failure repeats.

The third piece is the pr-writeup skill, which builds a reviewer-friendly PR description from the actual branch diff instead of a summary the model makes up. You drop the folder into .claude/skills/ for one project or ~/.claude/skills/ for all of them, then ask Claude to “write up this PR”.

Installing the hook takes three steps. Run mkdir -p .claude/hooks, copy the script there and make it executable with chmod +x, then merge the kit’s hooks/settings.json into .claude/settings.json. The README’s own check pipes fake tool calls into the script. Feeding it {"tool_input":{"command":"rm -rf /"}} should end with exit code 2 (blocked), and the same JSON with npm test should end with exit 0 (allowed). The repository takes pull requests and asks mainly for more tested hooks and lean CLAUDE.md templates for other stacks.

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.