Hook Components
Hooks are automation triggers that execute before or after specific events. They enable automated workflows, validation, and enforcement of best practices.Browse All Hooks
Explore 45+ hooks at aitmpl.com
Installation
Hook Categories
- Git
- Security
- Testing
- Git Workflow
- Automation
- Pre/Post Tool
- Performance
- Monitoring
Git Hooks
Automate git workflows and enforce commit standards:Conventional Commits
Enforce conventional commit message formatValidates:
- Commit message format (feat:, fix:, docs:, etc.)
- Scope and description
- Breaking change notation
Prevent Direct Push
Block direct pushes to protected branchesProtects:
- main/master branches
- production branches
- Enforces PR workflow
Validate Branch Name
Enforce branch naming conventionsEnforces:
- feature/, bugfix/, hotfix/ prefixes
- Lowercase with hyphens
- Ticket/issue references
Hook Types
Pre-Commit Hooks
Run before a commit is created:- Validate commit messages
- Run linters and formatters
- Check for secrets
- Run tests
Pre-Push Hooks
Run before pushing to remote:- Run full test suite
- Check branch protection
- Validate no uncommitted changes
Pre-Tool Hooks
Run before Claude Code tool execution:- Validate environment
- Check permissions
- Load context
Post-Tool Hooks
Run after Claude Code tool execution:- Clean up temporary files
- Update metrics
- Send notifications
Hook Configuration
Hooks are stored in.claude/hooks/:
Python Script Hooks
Many hooks use Python scripts for complex logic:Example Usage
Disabling Hooks
Temporarily bypass hooks when needed:Creating Custom Hooks
Create your own hooks:- Create JSON config in
.claude/hooks/ - Create Python script in
.claude/scripts/(if needed) - Test the hook
- Share with your team