Analysis updated 2026-07-03
Block dangerous shell commands like rm -rf before Claude executes them using a PreToolUse hook.
Log every tool Claude uses during a session to a JSON file for auditing and replay.
Play an AI-generated audio summary through text-to-speech when Claude finishes a response using the Stop hook.
Set up a two-agent flow where one Claude instance builds code and a separate validator agent checks quality.
| disler/claude-code-hooks-mastery | textualize/rich-cli | galaxy-dawn/claude-scholar | |
|---|---|---|---|
| Stars | 3,664 | 3,665 | 3,661 |
| Language | Python | Python | Python |
| Setup difficulty | moderate | easy | moderate |
| Complexity | 3/5 | 1/5 | 2/5 |
| Audience | developer | developer | researcher |
Figures from each repo's GitHub metadata at analysis time.
Requires Claude Code installed and the UV Python tool, audio summary features need an ElevenLabs or OpenAI API key.
This repository teaches you how to use Claude Code hooks, which are custom scripts that run automatically at specific moments during a Claude Code AI coding session. Claude Code is Anthropic's command-line tool for AI-assisted development, and hooks let you attach your own behavior to events like when a session starts, when Claude is about to use a tool, when it finishes responding, or when something goes wrong. The project demonstrates all 13 hook events that Claude Code exposes. A few examples: the UserPromptSubmit hook fires as soon as you submit a message, before Claude even sees it, so you can use it for logging or security filtering. The PreToolUse hook fires before Claude runs any tool, and this repo uses it to block dangerous commands like rm -rf or access to sensitive files like .env. The Stop hook fires when Claude finishes a response, and the example here uses it to play an AI-generated audio summary through text-to-speech. Beyond the hooks themselves, the repository shows how to set up Claude Code sub-agents, which are separate Claude instances that the main Claude can spawn to work on tasks in parallel. There is also a team-based validation pattern where one agent builds code and a separate validator agent checks the quality, with hooks coordinating the flow between them. All the hooks are written as standalone Python scripts using the UV single-file script format, which means each hook can declare its own dependencies without interfering with the rest of the project. The hooks log every event to a JSON file in a logs directory, so you can inspect what Claude did during a session. Audio feedback through ElevenLabs, OpenAI, or a local text-to-speech library is optional. The prerequisites are Claude Code itself and the UV Python tool. The repository is aimed at developers who are already using Claude Code and want more control and observability over what it does. The full README is longer than what was shown.
A hands-on guide to all 13 Claude Code hook events, with Python scripts that add safety filters, session logging, audio alerts, and multi-agent coordination to an AI coding session.
Mainly Python. The stack also includes Python, Claude Code, UV.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.