Claude Code setup guide

Why is my Claude Code hook not firing?

Open /hooks in the affected Claude Code session. If a shared hook is missing, check .claude/settings.json for invalid JSON. If your formatter is listed under PostToolUse, use Edit|Write to match both tools. Ask Claude to edit a scratch file and inspect the formatting. A successful hook can run silently.

By CWYN · Last updated · Not affiliated with Anthropic · Hook events and matchers (as of Nov 18, 2026) · Published

1. Find the hook under its event

Need a working example first? Copy a notification, formatting or protected-file hook and try its test in a scratch project.

Run /hooks in the affected session. For a shared project hook, check .claude/settings.json if the entry is missing. Check the JSON for comments or a trailing comma. If a saved correction still does not appear, restart the session and reopen the menu. A managed-only notice means your organization restricts which hooks can run.

2. Match the event to the actual edit

A formatter that should run after a successful edit belongs under PostToolUse. Match the tool Claude used. A matcher of Edit is case-sensitive and misses a file created with Write. If the formatter should handle both tools, use the documented matcher Edit|Write.

3. Give the formatter an observable change

Choose a scratch file your formatter handles. Ask Claude to edit an existing line so the formatter has something to correct. Confirm the matching tool ran, then inspect the file. If it now follows the formatter’s rules, the hook can be working even when the conversation shows no success message. To repeat the test from the original line, see how to undo Claude’s edit with /rewind.

4. Inspect a failed command

If the expected change is absent, press Ctrl+O in the terminal session to inspect the transcript for a hook error. A command-not-found message points to the handler path. Use an absolute path to the script or anchor it to ${CLAUDE_PROJECT_DIR}. Retry the same scratch edit and compare the file and transcript.

Record the formatter command and the paths it handles in your project CLAUDE.md so teammates can run the same check.

If your project also uses OpenClaw and its Gateway reports ENOTEMPTY during startup, follow the NFS snapshot cleanup guide for that error.

Sources · Hook events, matchers and troubleshooting · Nov 18, 2026 · Checked against docs, not run.

Next steps

Set up your Claude Code project

Compare your hook settings with the SessionStart examples for new and resumed sessions in the Claude Code Complete Setup Pack ($12.95).
Kit details as of Nov 22, 2026