Claude Code Hooks
A deterministic, event-driven mechanism built into Claude Code that uses a three-layer architecture consisting of Event, Matcher, and Handler components. It enforces the execution of predefined actions at specific points during operation, providing more reliable automation control than what is achievable through CLAUDE.md configuration alone.
Timeline (last 90 days)
Claude Code's Hooks let it automatically execute shell commands on specific events, with the configuration written in settings.json, and each hook consists of three parts: the event, an optional matcher, and the command to execute.
All Facts (4)
Claude Code Hooks支持三种类型:Command(命令型)、Prompt(提示型)和Agent(智能体型)
95%UnverifiedClaude Code Hooks的设计理念借鉴了Git Hooks的事件回调机制
60%UnverifiedClaude Code's Hooks let it automatically execute shell commands on specific events, with the configuration written in settings.json, and each hook consists of three parts: the event, an optional matcher, and the command to execute.
50%UnverifiedClaude Code Hooks consists of two parts: a Matcher (trigger condition) and Hook behavior (containing two fields: type and execution event).
22%