Free Claude Code hooks & settings.json generator
Claude Code reads a settings.json file that can do two jobs a CLAUDE.md can't. Permission rules decide which tools Claude may use without asking, must ask about, or may never use. Hooks are shell commands Claude Code runs at fixed points, such as right before a tool call, every time, whether or not Claude remembers your instructions. A rule in CLAUDE.md is a request; a hook or a deny rule is enforced.
Tick the guardrails you want and copy the JSON. Save it as ~/.claude/settings.json (applies to every project on your machine) or .claude/settings.json inside one project folder (shared with anyone who has that folder). If the file already exists, merge the permissions and hooks sections into it rather than replacing it.
Everything runs in your browser. Nothing you type is sent anywhere.
Your settings.json
What each piece does
- Block rm -rf / force push / secrets edits are
PreToolUsehooks. Before the Bash, Edit or Write tool runs, Claude Code pipes the call as JSON to the command; the command reads the shell command or file path withjq, and if it matches, prints a reason and exits with code 2. Exit code 2 blocks the call and shows Claude the reason. Anything else exits 0 and the normal permission flow continues. - Outbound messages is a
PreToolUsehook on MCP tools (names look likemcp__server__tool). It returns apermissionDecisionofaskordeny, so a Gmail, Slack or social tool that sends or posts can't fire without you. Draft tools don't match, so Claude can still draft. - Command log is a
PostToolUsehook that appends the time, folder and command to a log file after each shell command. Handy when a client asks what was run on their files. - Notification runs on the
Notificationevent, which fires when Claude Code is waiting on a permission prompt or your input. - Permission rules:
denybeatsask, which beatsallow.Bash(git push *)matches any command that starts withgit push;Read(./.env)is a path relative to the project folder. Rules in different settings files are combined, not replaced.
Tips
- Install jq first. The guard hooks use
jqto read the JSON Claude Code sends (brew install jqon macOS,sudo apt install jqon Debian/Ubuntu). On Windows, hooks run through Git Bash if it's installed. If a hook can't run, Claude Code shows a hook error and the action goes ahead, so test it. - Test each guard once. After saving, run
/hooksin Claude Code to see what loaded, then ask Claude to run something harmless that matches, such asrm -rf ./tmp-teston an empty folder, and confirm it's blocked. - Use both layers for the important ones. Pattern matching in a hook can miss unusual spellings (
rm -r -f), so keep the matching deny rule too. - Keep personal tweaks out of shared folders. If a project's
.claude/settings.jsonis shared with a client or teammate, put your own extras in.claude/settings.local.jsoninstead. - Settings files are strict JSON. No comments and no trailing commas, or Claude Code reports a settings error at startup.
Pairs well with the CLAUDE.md generator (what's always true about your business) and the SKILL.md builder (repeatable jobs). Hooks are the part that holds even when Claude forgets.
New to hooks? Read Claude Code hooks for non-developers: 5 guardrails before it touches client files. Not sure if it belongs in CLAUDE.md, a skill, or a hook? See which goes where.
Need to connect Notion, GitHub, Playwright or another MCP server first? Use the .mcp.json / MCP config builder, then come back here to guard outbound MCP tools.
Only need allow, ask and deny rules, not hooks? The permissions builder writes the permissions block and tests a command against your rules.
Hooks in several settings files merge rather than replace each other. To see every hook that applies, and catch a lowercase or array matcher, paste your files into the settings precedence checker.
Want to see model, context use and session cost at a glance? The status line builder adds a statusLine block to the same settings.json.
Made by Solo Stack Kits. If you want ready-made skills that already follow these guardrails (draft-only email, no invented numbers), start with the free 3-skill sample, or get the full Solo Consultant Kit.