FREE CLAUDE CODE HOOKS BUILDER

Claude Code hooks builder: describe the rule, get the JSON

Type a plain-English rule like "block force pushes" or "auto-run prettier after edits" and get a ready-to-paste settings.json hook block with the right event, matcher, and command.

This free Claude Code hooks builder turns a plain-English automation rule into a settings.json hook entry. Type what you want enforced, and it picks the matching event (PreToolUse, PostToolUse, Stop, or SessionStart), a matcher, and a command, then gives you a copy-paste JSON block or a full hooks.json export.

Describe the rule
Hook JSON

PreToolUse · matcher: Bash — Blocks a Bash call before it runs if the command looks like a force-push or a direct push to main/master.

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "sh -c 'echo \"$CLAUDE_TOOL_INPUT\" | grep -qE \"push (--force|-f)|push origin (main|master)\" && exit 2 || exit 0'"
          }
        ]
      }
    ]
  }
}

FAQ

How is this different from the Hooks JSON Builder?

The Hooks JSON Builder (hooks-builder) is a click-based form for Cursor hooks: you pick an event from a dropdown and fill in the matcher and command yourself. This tool goes the other direction for Claude Code specifically — you describe the rule in plain English ("block force pushes"), and it infers the event, matcher, and command for you.

How is this different from the Hook Coverage Checker?

The Hook Coverage Checker audits hooks you already have: it reads your existing settings.json and CLAUDE.md and tells you which written rules have no enforcement. This generator works from a blank slate — you haven't written a hook yet, you just know the rule you want enforced.

Which events does it recognize?

PreToolUse (block a command before it runs, e.g. a force-push or a destructive rm -rf), PostToolUse (run something after a file edit, e.g. prettier or eslint), Stop (run something when Claude finishes responding, e.g. tests or a build), and SessionStart (run something once when a session begins).

Does this upload my rule text anywhere?

No. The rule text is matched against patterns and the JSON is generated entirely in your browser.

What if it doesn't recognize my rule?

It falls back to a generic PostToolUse block with a placeholder command you can edit — the event and matcher are still a reasonable starting point for most file-edit automations.

By Rakshit Yadav · Published 2026-11-16 · Last updated 2026-11-16. Next: check whether your CLAUDE.md rules are already enforced or lint your CLAUDE.md for bloat.

[ RUNS IN YOUR BROWSER • DROP A FILE OR TAP GENERATE • NO SIGNUP ]

Go further

Liked the free tool? Get the kits.

Engineering, Marketing, or Both: agents, skills, and slash commands you drop into any Cursor project.