About Claude Code Hooks
Claude Code Hooks is an open source collection of tested guardrail plugins that intercept the Claude Code agent loop. Each hook is a small program that receives a JSON payload on standard input whenever Claude Code reaches a lifecycle event, checks it against rules, and returns exit code 0 to let the action proceed or exit code 2 to block it and hand an explanation back to Claude. There is no SDK; the contract is a plain wire protocol, and hooks are written in Node or Python.
It is for developers and teams who let Claude Code run commands and edit files and want hard limits on what it can do. The catalogue holds twenty two plugins covering SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Notification, Stop, SessionEnd and further events such as SubagentStop and PreCompact. Examples include blocking destructive shell commands such as recursive deletes of the home directory, fork bombs and piping downloads into a shell, with three tunable safety levels; protecting secrets by refusing to read or exfiltrate environment files, SSH keys, cloud credentials and kubeconfig; branch aware git safety that blocks commits, resets and force pushes on main; staging and formatting edits; and Slack notifications. The project reports a large automated test suite and about 35 milliseconds per call.
The project is free and MIT licensed. Plugins install from inside Claude Code by adding the project's plugin marketplace and installing each guardrail by name, and the source is published on GitHub.