Free toolRuns in your browser

Claude Code hooks generator

Pick the Claude Code events to hook, a matcher and a command, and copy the exact hooks block for your settings file. One switch fills in the hooks Euthyne installs, byte for byte what euthyne init writes.

Fills in euthyne hook claude-code on the ten events, exactly as euthyne init writes them.

Runs in a shell with the event as JSON on stdin. Exit code 2 blocks the action on events that can block.

Events
Paste into
This repository, shared with everyone who clones it.
.claude/settings.json
{
  "hooks": {
    "PostToolUse": [
      {
        "hooks": [
          {
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write",
            "type": "command"
          }
        ],
        "matcher": "Edit|Write"
      }
    ]
  }
}

If the file already has a hooks key, merge these event arrays into it rather than adding a second one. Claude Code normally picks up hook changes without a restart, and /hooks lists the hooks it loaded.

How it works

A hook is a command Claude Code runs at a fixed point in a session, with the event as JSON on stdin. In a settings file, hooks are grouped by event. Each group has an optional matcher and a list of handlers: for tool events the matcher is a tool name, for SessionStart it’s how the session began, for subagent events it’s the agent type (hooks reference).

Exit code 2 blocks the action on events that can block, such as PreToolUse. Where you paste the block sets its scope: every project, one repository for the whole team, or one repository just for you (hooks guide).

Why it matters

Hooks run every time, whatever the model decides. That makes them the place for what must always happen: formatting the files Claude edits, refusing a command, or keeping a record of what the agent did.

The record is what Euthyne uses hooks for. euthyne hook claude-code reads each event, checks it against the session’s permissions and signs a receipt. The ten events cover a session from start to end: each prompt, each tool call and its outcome, each subagent and each stop. Recording never blocks. The PreToolUse hook only decides a call when your org has a signed policy, and only denies it once the org switches that policy from dry run to enforce.

Record every tool call, signed

euthyne init installs these hooks for you, enrols the repository and signs a test receipt. From then on each event becomes a signed receipt in an append-only log anchored on-chain. Prompts and outputs stay on your machine, only salted hashes leave.

Install script
curl -fsSL https://euthyne.com/install | sh
Homebrew
brew install euthyne-labs/tap/euthyne

euthyne init signs you in first, or lets you create an account. Request access or read the docs.

Frequently asked questions

Related

Where to go next

Euthyne
EuthyneBordeaux