What problem does it solve?
This Skill provides expert guidance to create, configure, and debug Claude Code hooks, enabling programmatic control over Claude's behavior without modifying core code. It eliminates manual intervention for repetitive tasks, validates commands, and injects context, saving you time and reducing errors in your development workflows.
Core Features & Use Cases
- Event-Driven Automation: Execute shell commands or LLM prompts in response to events like tool use (PreToolUse, PostToolUse), session start/end, or user prompts.
- Workflow Customization: Automate tasks such as code formatting after edits, logging all bash commands, or sending desktop notifications when Claude needs input.
- Context Injection & Validation: Inject project-specific context at session start or validate user prompts and tool inputs using LLM reasoning to prevent destructive actions.
- Use Case: Automatically format code with
prettier after every Write or Edit tool use, ensuring consistent code style across your project without any manual effort.
Quick Start
Create a .claude/hooks.json file in your project.
Add a PreToolUse hook with a Bash matcher.
Configure it to log every bash command to ~/.claude/bash-log.txt.
Test your new hook with claude --debug.