Claude Code hook
cchooks
Python SDK that simplifies parsing hook input and returning decisions for Claude Code hooks.
Install
pip install cchooksgit clone https://github.com/GowayLee/cchooks.gitFrom the README
cchooks Claude Code Hook SDK for Python A lightweight Python Toolkit that makes building Claude Code hooks as simple as writing a few lines of code. Stop worrying about JSON parsing and focus on what your hook should actually do. New to Claude Code hooks? Check the official docs for the big picture. Need the full API? See the API Reference for complete documentation. Features - One-liner setup: create_context() handles all the boilerplate - Zero config: Automatic JSON parsing and validation from stdin - Smart detection: Automatically figures out which hook you're building - 9 hook types: Support for all Claude Code hook events including SessionStart and SessionEnd - Two modes: Simple exit codes OR advanced JSON control - Type-safe: Full type hints and IDE autocompletion - System Message Support: Provide optional warning messages to users for all decision-making hooks Installation Quick Start Build a PreToolUse hook that blocks dangerous file writes: Save as hooks/env-guard.py, make executable: That's it. No JSON parsing, no validation headaches. Brief Tutorial Build each hook type with real examples: PreToolUse (Security Guard) Block dangerous commands before they run: PostToolUse (Auto-formatter) Format Python files after writing: Notification (Desktop Alerts) Send desktop notifications: Stop (Task Manager) Keep Claude working on long tasks: Since hooks are executed in parallel in Claude Code, it is necessary to check stop_hook_active to determine if Claude has already been activated by another parallel Stop Hook. SubagentStop (Workflow Control) Same as Stop, but for subagents: UserPromptSubmit (Prompt Filter) Filter and enrich user prompts before processing: SessionStart (Context Loader) Load development context when Claude Code starts or…
How hooks work
- Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
- They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
- A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Details
- Repository
- GowayLee/cchooks
- Type
- Hooks
- Website
- pypi.org/project/cchooks
- Language
- Python
- License
- MIT
- Last updated
- 8 April 2026
- Topics
- agentic-aiclaude-codehookspypi-package
FAQ
What is cchooks?
Python SDK that simplifies parsing hook input and returning decisions for Claude Code hooks. It is a hook for Claude Code, from GowayLee/cchooks on GitHub.
How do I install cchooks?
Run pip install cchooks, then follow the setup in the README.
Is cchooks popular?
GowayLee/cchooks has 131 GitHub stars and 10 forks, and is included in 2 curated Claude Code lists. It was last updated on 8 April 2026.
More hooks
Grip
439guilyx/grip
A git hook that won't let you push code you can't explain. Quizzes you on your own diff. Works with Claude Code, Codex, Cursor.
TypeScript Quality Hooks
179bartolli/claude-code-typescript-hooks
Hooks that run TypeScript type checks, ESLint and Prettier automatically after Claude edits files.
Taskmaster
533blader/taskmaster
Stop hook for Claude Code that keeps the agent working until all plans and user requests are 100% complete
Claudecode Rule2hook
403zxdxjtu/claudecode-rule2hook
Transform natural language project rules into Claude Code automation hooks - Write rules in plain English and let Claude automatically generate powerful hooks for code formatting, testing, validation and more
LSP Enforcement Kit
328nesaminua/claude-code-lsp-enforcement-kit
Hooks that steer Claude Code toward LSP-based navigation instead of grep to save tokens.
Probity
241nizos/probity
TDD enforcement and guardrail hooks for Claude Code, Codex and Copilot CLI from the TDD Guard author.
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.