Launch price: $49 one-time for all 38 specialists. Get it →
Free tool

Hooks Builder

Create Claude Code hooks and get valid settings.json, no guesswork.

Read before you paste. Hooks run shell commands automatically, using your own permissions, every time their event fires. Only use commands you understand, and read every line before you save it.

1. Pick a starting point

Each preset adds a hook you can edit below. Add as many as you like.

2. Your hooks

3. Already have a settings file? (optional)

Your new hooks are merged in and everything else is left untouched. Nothing leaves your browser.

Your settings file

.claude/settings.json

    

Checks

    How to use it

    1. Click a preset, or add a blank hook, and choose the event that should trigger it.
    2. For tool events, set a matcher so the hook only fires for the tools you care about.
    3. Edit the command, then check the list of warnings on the right.
    4. Copy the JSON into the settings file shown in the header, or paste your existing file in step 3 to merge.
    5. Restart Claude Code, or open the /hooks menu, to review what is active.

    What a hooks block looks like

    Hooks live under a hooks key in a Claude Code settings file. Each event holds a list of groups. A group has an optional matcher and a list of hooks to run. This example formats a file with Prettier after Claude edits it:

    {
      "hooks": {
        "PostToolUse": [
          {
            "matcher": "Edit|Write|MultiEdit",
            "hooks": [
              {
                "type": "command",
                "command": "f=$(jq -r '.tool_input.file_path // empty'); [ -n \"$f\" ] && npx prettier --write --ignore-unknown \"$f\"",
                "timeout": 60
              }
            ]
          }
        ]
      }
    }

    Events

    • PreToolUse: before a tool runs. Can block the call. Uses a matcher.
    • PostToolUse: right after a tool succeeds. Uses a matcher.
    • UserPromptSubmit: when you send a prompt, before Claude reads it.
    • Notification: when Claude needs your attention or permission.
    • Stop and SubagentStop: when Claude or a subagent finishes replying.
    • PreCompact: before the conversation is compacted. Matcher is manual or auto.
    • SessionStart: when a session begins. Matcher is startup, resume, clear or compact.
    • SessionEnd: when a session ends.

    Matchers, input and exit codes

    A matcher is a tool name such as Bash, a pattern such as Edit|Write or mcp__.*, or empty to match every tool. Matchers are case sensitive. Your command receives a JSON description of the event on standard input, for example tool_input.file_path or tool_input.command, and jq is the usual way to read it. The $CLAUDE_PROJECT_DIR variable points at your project folder. Exit code 0 means success. Exit code 2 is a blocking error: on PreToolUse it stops the tool call and shows your stderr message to Claude. Any other non-zero code is a non-blocking error.

    The three settings files

    .claude/settings.json is for the project and is usually committed. .claude/settings.local.json is for the project but only for you. ~/.claude/settings.json applies to every project on your machine.

    FAQ

    Are hooks safe?

    They are as safe as the commands you put in them. A hook runs without asking, with your user permissions, so never paste a command you do not understand.

    Why is my hook not firing?

    Check the event name spelling, check that the matcher matches the tool name exactly (it is case sensitive), and make sure the file is valid JSON. Restart Claude Code after editing settings and look at the /hooks menu.

    How do I block something instead of just logging it?

    Use a PreToolUse hook, print a short reason to stderr and exit with code 2. Claude sees the message and the tool call does not run.

    Does this tool send my commands anywhere?

    No. It runs entirely in your browser and makes no network requests.

    I use Windows. Will these commands work?

    The presets use shell commands and jq, so install jq and run Claude Code in an environment with a POSIX shell, such as WSL or Git Bash. The notification preset has a Windows option.

    Hooks are one piece of a good setup. Agentsforce ships 38 ready-made specialists so you do not have to write every agent yourself.

    More free tools

    Give Claude Code a whole team. 38 specialists, one payment of $49.

    Get Agentsforce