Claude Code Hooks
Shell commands that run automatically on Claude Code lifecycle events — format, lint, gate, and notify without lifting a finger.
Showing 60 of 62 hooks
Simple Notifications
Send desktop notifications when Claude Code finishes working or needs user input. Works on macOS and Linux systems.
Smart Commit
Intelligent git commit creation with automatic message generation and validation. Creates meaningful commits based on file changes.
Update Search Year
Automatically adds current year to WebSearch queries when no year is specified. This hook intercepts WebSearch tool usage and appends the current…
Smart Formatting
Smart code formatting based on file type. Automatically formats code using Prettier, Black, gofmt, rustfmt, and other language-specific formatters.
Lint On Save
Automatically run linting tools after file modifications. Supports ESLint for JavaScript/TypeScript, Pylint for Python, and RuboCop for Ruby.
Context Timeline
Real-time browser visualization of Claude Code's context window and subagent/tool execution as a git-graph timeline. Opens http://localhost:7878 on…
Run Tests After Changes
Automatically run quick tests after code modifications to ensure nothing breaks. This hook executes 'npm run test:quick' silently after any Edit…
File Protection
Protect critical files from accidental modification. Prevents editing of important system files, configuration files, and production code.
Nextjs Code Quality Enforcer
Enforce Next.js best practices, proper file structure, component patterns, and TypeScript usage with automated code reviews and suggestions.…
Dependency Checker
Advanced dependency analysis and security checking. Monitors for outdated packages, security vulnerabilities, and license compatibility.
Security Scanner
Scan code for security vulnerabilities and secrets after modifications. Uses multiple security tools to detect potential issues.
Backup Before Edit
Create automatic backup of files before any Edit operation for safety. This hook creates a timestamped backup copy (filename.backup.timestamp) of any…
Change Tracker
Track file changes in a simple log. Records which files were modified and when for easy tracking of Claude Code activity.
Format Python Files
Automatically format Python files after any Edit operation using black formatter. This hook runs 'black' on any .py file that Claude modifies,…
Build On Change
Automatically trigger build processes when source files change. Detects common build tools and runs appropriate build commands.
Secret Scanner
Automatically detects hardcoded secrets before git commits. Scans for API keys from 30+ providers (Anthropic: sk-ant-..., OpenAI: sk-..., AWS:…
Auto Git Add
Automatically stage modified files with git add after editing. Helps maintain a clean git workflow by staging changes as they're made.
Test Runner
Automatically run relevant tests after code changes. Detects test files and runs appropriate test commands based on file extensions and project…
Agents Md Loader
Automatically loads AGENTS.md configuration file content at session start to ensure Claude Code follows project-specific agent behavior. Only loads…
Dangerous Command Blocker
Advanced protection against dangerous shell commands with multi-level security. Blocks catastrophic operations (rm -rf /, dd, mkfs), protects…
File Backup
Automatically backup files before editing. Creates timestamped backups in a .backups directory when files are modified.
Telegram Notifications
Send Telegram notifications when Claude Code finishes working. Requires TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables. Get bot token…
Command Logger
Log all Claude Code commands to a file for audit and debugging purposes. Simple logging that records tool usage with timestamps.
Performance Monitor
Monitor system performance during Claude Code operations. Tracks CPU, memory usage, and execution time for performance optimization.
Format Javascript Files
Automatically format JavaScript/TypeScript files after any Edit operation using prettier. This hook runs 'npx prettier --write' on any .js, .ts,…
Git Add Changes
Automatically stage changes in git after file modifications for easier commit workflow. This hook runs 'git add' on any file that Claude edits or…
Conventional Commits
Enforce conventional commit message format for all git commits. Validates commit messages follow the pattern: type(scope): description. Supported…
Prevent Direct Push
Prevent direct pushes to protected branches (main, develop). Blocks git push commands targeting main or develop branches to enforce Git Flow…
Deployment Health Monitor
Monitor deployment status, error rates, and performance metrics, sending notifications for failed deployments or performance degradation. Tracks…
Telegram Detailed Notifications
Send detailed Telegram notifications with session information when Claude Code finishes. Includes working directory, session duration, and system…
Performance Budget Guard
Monitor bundle size and Core Web Vitals metrics during development, blocking deployments that exceed performance budgets with detailed reports.…
Vercel Auto Deploy
Automatically trigger Vercel deployments when code changes are committed, with environment-specific deployment strategies and rollback on failure.…
Validate Branch Name
Validate Git Flow branch naming conventions before checkout. Ensures branches follow the pattern: feature/*, release/v*.*.*, hotfix/*. Prevents…
Vercel Environment Sync
Synchronize environment variables between local development and Vercel deployments, ensuring consistency across all environments. Detects changes to…
Telegram Error Notifications
Send Telegram notifications when Claude Code encounters long-running operations or when tools take significant time. Helps monitor productivity and…
Scope Guard
Scope guard that detects files modified outside the declared scope of a specification. When a .spec.md file contains a 'Files to Create/Modify'…
Slack Notifications
Send Slack notifications when Claude Code finishes working. Requires SLACK_WEBHOOK_URL environment variable. Get webhook URL from Slack App settings…
Notify Before Bash
Show notification before any Bash command execution for security awareness. This hook displays a simple echo message '🔔 About to run bash…
Langsmith Tracing
Automatically send Claude Code conversation traces to LangSmith for monitoring and analysis. Prerequisites: jq (brew install jq on macOS or sudo…
Desktop Notification On Stop
Sends a native desktop notification when Claude Code finishes responding. Uses the Stop hook event so you get a single notification per response…
Discord Notifications
Send Discord notifications when Claude Code finishes working. Requires DISCORD_WEBHOOK_URL environment variable. Get webhook URL from Discord Server…
Change Logger
Log every file mutation to CSV for demo prep. Records timestamp, tool, file path, action, and details for Edit, MultiEdit, Write, and Bash…
Discord Detailed Notifications
Send detailed Discord notifications with session information when Claude Code finishes. Includes working directory, session duration, and system info…
Worktree Ghostty
Worktree Ghostty Layout. Opens a 3-panel Ghostty layout when creating worktrees: Claude Code (left) | lazygit (top-right) / yazi (bottom-right).…
Tdd Gate
Test-Driven Development enforcement hook. Blocks editing production code files (.cs, .py, .ts, .go, .rs, .rb, .php, .java, .kt, .swift, .dart) unless…
Env File Protection
Prevent writing to .env files using the if condition for lightweight filtering. Blocks any Write tool call targeting .env* files, protecting secrets…
Slack Detailed Notifications
Send detailed Slack notifications with session information when Claude Code finishes. Includes working directory, session duration, and system info.…
Slack Error Notifications
Send Slack notifications when Claude Code encounters long-running operations or when tools take significant time. Helps monitor productivity and…
Debug Window
Auto Debug Log Viewer. Opens a live-tailing debug log window when Claude Code starts with --debug or -d flag. The window closes automatically on…
Console Log Cleaner
Warns about console.log statements when editing files on production branches (main/master). Helps prevent debug code from reaching production.
Plan Gate
Planning gate that warns when editing production code without an approved specification. Checks for recent .spec.md files in the project directory…
Discord Error Notifications
Send Discord notifications when Claude Code encounters long-running operations or when tools take significant time. Helps monitor productivity and…
Force Push Blocker
Block git force push commands using the if condition for efficient filtering. Prevents accidental force pushes that can overwrite remote history.…
Shell Wrapper Guard
Detects destructive commands hidden inside shell wrappers (sh -c, bash -c, python3 -c, node -e, perl -e, ruby -e). Complements…
Edit Audit Log
Log all file edits to a project-local audit file with timestamps. Records every Edit tool usage to .claude/edit-log.txt for tracking changes across…
Telegram Pr Webhook
Send Telegram notification when a new PR is created via gh pr create. Includes PR URL and Vercel preview URL. Requires TELEGRAM_BOT_TOKEN and…
Ai Bash Guard
AI-powered bash command security guard. Before any Bash command runs, a lightweight Claude subagent evaluates it for destructive or irreversible…
Plan Mode Game
Play games while Claude plans. Launches a browser game (Dino Runner, Snake, or Flappy Bird) automatically when Claude enters Plan Mode via…
Doordash Group Checkout Gate
Live allergen re-check for DoorDash CLI group orders. When a checkout runs for a cart that has a doordash-group-orders round ledger…
Doordash Allergy Checkout Gate
Deterministic allergy tripwire for DoorDash CLI (dd-cli) checkouts. Before any 'dd-cli order checkout-url' (direct or via the dd-guard wrapper) it…
Claude Code hooks are shell commands that Claude Code runs automatically at defined points in its lifecycle. Instead of asking Claude to remember to format a file or run your tests, you register a hook that fires deterministically on an event — for example PreToolUse before Claude edits a file, PostToolUse after a tool completes, UserPromptSubmit when you send a message, or Stop when a session finishes. Each hook receives structured JSON on standard input describing the event and can act on it, so the automation runs the same way every time regardless of how the model is prompted.
Hooks are configured in your settings.json under a hooks key, where you pair an event (optionally filtered by a tool matcher such as Edit or Bash) with a command to execute. Because they are plain shell, a hook can run a formatter, block an unwanted edit by returning a non-zero exit code, append a git commit, or push a desktop notification. This catalog packages battle-tested hooks so you do not have to hand-write the JSON — pick one and install it with a single command:
npx claude-code-templates@latest --hook="category/name" --yes
Reach for a hook whenever you want a guarantee rather than a suggestion. Formatting-on-save, running the linter after every edit, enforcing a protected-branch policy, or logging tool calls for an audit trail are all a better fit for a hook than for a prompt. Browse the growing catalog below, then pair hooks with settings to tune behavior, commands for on-demand workflows, and agents for specialized subagents. See a few popular examples like prettier-on-save, run-tests-post-edit, and protect-main-branch.
Frequently Asked Questions
What are Claude Code hooks?
Which lifecycle events can a hook respond to?
How do I install a hook from this catalog?
Can a hook block or stop what Claude is about to do?
How are hooks different from commands, agents, and settings?
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.