Type: url

Original: https://docs.claude.com/en/docs/claude-code/hooks-guide

Status: generated

Summary

Anthropic’s Claude Code guide to hooks: user-defined shell commands (and HTTP, MCP tool, prompt and agent handlers) that Claude Code runs at fixed lifecycle events to give deterministic control over its behavior. It walks through setting up a first hook in a settings file, gives ready-made examples such as notifications, auto-formatting, blocking edits to protected files and re-injecting context after compaction, and explains events, matchers, the if field, input and output conventions, hook locations, limitations and troubleshooting.

Generated pages