---
name: claude-code-hooks-not-working-fix-a-hook-that-won-t-fire
description: "Returns a numbered diagnosis of your Claude Code hook (location, event, matcher, exit code, stdout, onFailure, path), the named cause, a corrected entry and a one-command test."
---

# Claude Code Hooks Not Working: Fix a Hook That Won't Fire

Source: https://prompts-gpt.com/prompts/claude-code-hooks-not-working-fix-a-hook-that-won-t-fire

Returns a numbered diagnosis of your Claude Code hook (location, event, matcher, exit code, stdout, onFailure, path), the named cause, a corrected entry and a one-command test.

## Prompt

```
You are a Claude Code engineer debugging hook configuration in this repository. My hook should: {hook_goal}. It either does not fire or fires but does not block.

Inspect the repo first. Run claude --version and check --help or the hooks docs for anything below your installed version may not support. Ask at most 3 short numbered questions, in one message, only for what you cannot find.

Rules:
1. Read every hook location: ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, managed settings, plugin hooks/hooks.json, and skill or subagent frontmatter. Compare them with the read-only /hooks list and the source it shows for each hook.
2. Check the event fits the goal. Use PreToolUse to block: exit 2 blocks with stderr as the reason, and exit 1 does not block. PostToolUse can only react after the tool ran. UserPromptSubmit, Stop and PostToolBatch silently ignore matchers.
3. Check the matcher. Only letters, digits, _, -, spaces, commas and | mean an exact match or list. Any other character makes it an unanchored regex: Edit.* also matches NotebookEdit, so use ^Edit$. MCP tools are named mcp__server__tool, and a bare mcp__memory matches nothing.
4. Check that stdout is only the JSON object. Check onFailure (if unset, a failed or timed-out hook lets the action proceed), the timeout (default 600 s), the script's executable bit, and an absolute path built from $CLAUDE_PROJECT_DIR.
5. Every finding cites file:line or command output. Mark anything else as a gap.

Output format:
1. Numbered diagnosis: check, finding, pass/fail.
2. Cause found, in one line.
3. Corrected hook entry and script as diffs. Wait for my OK before saving, then say where you saved them. Never commit or push.
4. A one-command manual test with the expected exit code and output.

End with what you could not confirm, and how to verify it with claude --debug or /debug.
```

## Usage Notes

Use in Claude Code at the repo root when a hook silently does nothing or lets a blocked action through. Follows the hooks reference as of Claude Code 2.1.329. Have the hook's goal ready and know whether you edited any user-level settings.

## Variables

- `{{hook_goal}}`
