hooks-reference

Identify Claude Code hook lifecycle events, exit codes, and configuration patterns.

2|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/DojoGenesis/gateway --skill hooks-reference-dojogenesis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks-reference
Source: https://github.com/DojoGenesis/gateway/tree/main/plugins/system-health/skills/hooks-reference
Command: npx skills add https://github.com/DojoGenesis/gateway --skill hooks-reference-dojogenesis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hooks are the mechanical enforcement layer of agent safety and observability. Unlike CLAUDE.md instructions, which guide agent behavior through documentation, hooks execute code at lifecycle boundaries where the agent cannot override them. This skill is a reference card, not a tutorial. It assumes you know what hooks are and need to quickly find the right event, the right exit code, or the right configuration pattern. For architectural understanding, read the seed_hooks_lifecycle_mastery and seed_mechanical_safety_enforcement seeds.

Core Features & Use Cases

  • Quick lookup for all 26 lifecycle events across categories and their block/observe behavior.
  • Guidance on exit codes (0/2) and configuration patterns for hooks in CLAUDE.md or plugin hooks.
  • Use scenarios include debugging hook firing, selecting events, and setting up security blocks.

Quick Start

Consult this guide to quickly identify the correct lifecycle event, exit code, and configuration pattern for Claude Code hooks.

Frequently Asked Questions about hooks-reference

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

FAQPage Schema
What exit codes stop tool execution in Claude Code hooks?

Exit code 2 blocks tool execution and surfaces feedback to the agent in Claude Code hooks, while exit code 0 allows the lifecycle event to proceed normally without interruption.

How do Claude Code hooks enforce agent safety differently than CLAUDE.md instructions?

Claude Code hooks execute mechanical code at lifecycle boundaries to enforce safety, whereas CLAUDE.md instructions only guide agent behavior through documentation that the agent can override.

How do I configure PreToolUse and PostToolUse lifecycle events for Claude Code?

Configure PreToolUse and PostToolUse lifecycle events by defining hook patterns in CLAUDE.md or plugin hooks, specifying the correct event category and exit semantics to ensure reliable event handling.

When should I use Claude Code hooks instead of prompt instructions for observability?

Use Claude Code hooks when you need mechanical enforcement of safety and observability at lifecycle boundaries, because hooks execute code directly and cannot be overridden by the agent like prompt instructions.

Why is my Claude Code hook not firing or blocking tool execution correctly?

Debug Claude Code hook firing by verifying the correct lifecycle event selection, ensuring the proper exit code configuration is applied, and checking that configuration patterns match the intended observe or block behavior.

Do I need prior knowledge of lifecycle events to use Claude Code hooks effectively?

Yes, Claude Code hooks configuration requires prior understanding of lifecycle events and exit semantics, as this reference accelerates design and debugging for users who already know hook fundamentals.