Claude Code Hooks Mastery
The definitive hands-on repo for Claude Code hooks — working examples for every lifecycle event (PreToolUse, PostToolUse, Notification, Stop, and more) with UV single-file Python scripts.
How to Install Hooks
- Copy the hook configuration using the button below
- Add to your .claude/hooks/ directory in your project
- Save the hook as an executable script with appropriate permissions
- The hook will trigger on the specified events in your Claude Code workflows
Hooks let you run deterministic scripts at fixed points in Claude Code's lifecycle — before tool calls, after edits, on notifications, when the agent stops. This repo demonstrates every hook event with runnable examples: blocking dangerous commands, logging tool use, text-to-speech notifications, and chaining hooks into observability pipelines.
It's structured as a learning resource: each hook is a self-contained UV Python script with commentary, so you can lift exactly the pattern you need into your own `.claude/settings.json`.Categories:
Ad