meta-claude-hooks

Documents and validates Claude Code hook events, matchers, handlers, and I/O contracts.

1|Updated Jun 23, 2026
One-click install
npx skills add https://github.com/bitranox/bitranox-skills --skill meta-claude-hooks-bitranox
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: meta-claude-hooks
Source: https://github.com/bitranox/bitranox-skills/tree/main/plugins/bitranox/skills/meta-claude-hooks
Command: npx skills add https://github.com/bitranox/bitranox-skills --skill meta-claude-hooks-bitranox

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Claude Code hooks fail silently in confusing ways: a hook that never fires looks identical to one that fires and finds nothing, exit code 1 does not block, and matchers switch between exact strings and regexes based on their characters. This Skill provides a verified reference covering all 31 hook events and five handler types, plus a drift detector that checks the documentation against upstream docs before you rely on it. ## Core Features & Use Cases - Complete hook reference: All 31 events, matcher semantics, the five handler types (command, http, mcp_tool, prompt, agent), exit-code behavior per event, and JSON output contracts, organized into four reference files. - Freshness verification: A bundled script compares the shipped reference against upstream Claude Code docs and reports CURRENT, COSMETIC, STRUCTURAL, or BROKEN verdicts, including whether your local CLI is newer than the documented behavior. - Authoring guidance: Traps that bite hardest (fail-open crashes, exit-0 stderr invisibility, PreToolUse reading unapproved files), testing hooks from stdin without a live session, and measuring a guard's precision before escalating a nudge to a block. - Use Case: You want a hook that blocks dangerous Bash commands. The Skill tells you PreToolUse is the right event, that exit 2 blocks while exit 1 does not, that your matcher may be an unanchored regex, and how to test the whole thing by piping JSON on stdin. ## Quick Start Ask the AI to help you write a PreToolUse hook that blocks a specific Bash command pattern, and have it run the freshness check first.

Frequently Asked Questions about meta-claude-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Claude Code hook that blocks a Bash command?▼

Register a PreToolUse hook with a Bash matcher and a command handler that exits with code 2 to block. Exit code 1 is a non-blocking error and the action proceeds, so policy hooks must use exit 2 on events that support blocking.

Why does my Claude Code hook never fire?▼

A hook that never fires looks identical to one that fires and finds nothing, since both are silent. Check /hooks to confirm registration, run claude --debug to inspect the log, and look for 'No such file or directory' errors from a mistyped script path.

How do Claude Code hook matchers work?▼

Matchers containing only letters, digits, underscores, hyphens, spaces, commas, or pipes are exact strings or lists. Any other character makes the value an unanchored JavaScript regex, so Edit.* also matches NotebookEdit; use ^Edit$ for an exact match.

Can I test a Claude Code hook without a live session?▼

Yes. A hook is a program that reads JSON on stdin and writes JSON on stdout, so pipe a sample event payload into it and assert on both the exit code and parsed stdout. Use /hooks and claude --debug for the parts a stdin test cannot reach.

What is the difference between command, prompt, and agent hook handlers?▼

Command handlers run a deterministic subprocess, prompt handlers make one fast LLM call for judgment, and agent handlers spawn a subagent that can inspect files. Prompt and agent types work on only 13 of the 31 events and add LLM latency to the critical path.

Why does my hook crash but the action still proceeds?▼

Hooks fail open by design: an internal error exits 0 and the action proceeds, with stderr visible only in the debug log. Test error paths deliberately with malformed JSON, empty stdin, and unmodeled input shapes, and degrade missing dependencies to a skip rather than a pass.