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

HookAutomation

Simple Notifications

Send desktop notifications when Claude Code finishes working or needs user input. Works on macOS and Linux systems.

1k installsView →
HookGit Workflow

Smart Commit

Intelligent git commit creation with automatic message generation and validation. Creates meaningful commits based on file changes.

398 installsView →
HookPre-Tool

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…

361 installsView →
HookDevelopment Tools

Smart Formatting

Smart code formatting based on file type. Automatically formats code using Prettier, Black, gofmt, rustfmt, and other language-specific formatters.

326 installsView →
HookDevelopment Tools

Lint On Save

Automatically run linting tools after file modifications. Supports ESLint for JavaScript/TypeScript, Pylint for Python, and RuboCop for Ruby.

324 installsView →
HookMonitoring

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…

259 installsView →
HookPost-Tool

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…

237 installsView →
HookSecurity

File Protection

Protect critical files from accidental modification. Prevents editing of important system files, configuration files, and production code.

237 installsView →
HookDevelopment Tools

Nextjs Code Quality Enforcer

Enforce Next.js best practices, proper file structure, component patterns, and TypeScript usage with automated code reviews and suggestions.…

233 installsView →
HookAutomation

Dependency Checker

Advanced dependency analysis and security checking. Monitors for outdated packages, security vulnerabilities, and license compatibility.

221 installsView →
HookSecurity

Security Scanner

Scan code for security vulnerabilities and secrets after modifications. Uses multiple security tools to detect potential issues.

220 installsView →
HookPre-Tool

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…

214 installsView →
HookDevelopment Tools

Change Tracker

Track file changes in a simple log. Records which files were modified and when for easy tracking of Claude Code activity.

163 installsView →
HookPost-Tool

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,…

153 installsView →
HookAutomation

Build On Change

Automatically trigger build processes when source files change. Detects common build tools and runs appropriate build commands.

143 installsView →
HookSecurity

Secret Scanner

Automatically detects hardcoded secrets before git commits. Scans for API keys from 30+ providers (Anthropic: sk-ant-..., OpenAI: sk-..., AWS:…

137 installsView →
HookGit Workflow

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.

133 installsView →
HookTesting

Test Runner

Automatically run relevant tests after code changes. Detects test files and runs appropriate test commands based on file extensions and project…

127 installsView →
HookAutomation

Agents Md Loader

Automatically loads AGENTS.md configuration file content at session start to ensure Claude Code follows project-specific agent behavior. Only loads…

121 installsView →
HookSecurity

Dangerous Command Blocker

Advanced protection against dangerous shell commands with multi-level security. Blocks catastrophic operations (rm -rf /, dd, mkfs), protects…

120 installsView →
HookDevelopment Tools

File Backup

Automatically backup files before editing. Creates timestamped backups in a .backups directory when files are modified.

100 installsView →
HookAutomation

Telegram Notifications

Send Telegram notifications when Claude Code finishes working. Requires TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables. Get bot token…

96 installsView →
HookDevelopment Tools

Command Logger

Log all Claude Code commands to a file for audit and debugging purposes. Simple logging that records tool usage with timestamps.

95 installsView →
HookPerformance

Performance Monitor

Monitor system performance during Claude Code operations. Tracks CPU, memory usage, and execution time for performance optimization.

92 installsView →
HookPost-Tool

Format Javascript Files

Automatically format JavaScript/TypeScript files after any Edit operation using prettier. This hook runs 'npx prettier --write' on any .js, .ts,…

90 installsView →
HookPost-Tool

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…

80 installsView →
HookGit

Conventional Commits

Enforce conventional commit message format for all git commits. Validates commit messages follow the pattern: type(scope): description. Supported…

72 installsView →
HookGit

Prevent Direct Push

Prevent direct pushes to protected branches (main, develop). Blocks git push commands targeting main or develop branches to enforce Git Flow…

54 installsView →
HookAutomation

Deployment Health Monitor

Monitor deployment status, error rates, and performance metrics, sending notifications for failed deployments or performance degradation. Tracks…

47 installsView →
HookAutomation

Telegram Detailed Notifications

Send detailed Telegram notifications with session information when Claude Code finishes. Includes working directory, session duration, and system…

45 installsView →
HookPerformance

Performance Budget Guard

Monitor bundle size and Core Web Vitals metrics during development, blocking deployments that exceed performance budgets with detailed reports.…

44 installsView →
HookAutomation

Vercel Auto Deploy

Automatically trigger Vercel deployments when code changes are committed, with environment-specific deployment strategies and rollback on failure.…

43 installsView →
HookGit

Validate Branch Name

Validate Git Flow branch naming conventions before checkout. Ensures branches follow the pattern: feature/*, release/v*.*.*, hotfix/*. Prevents…

38 installsView →
HookAutomation

Vercel Environment Sync

Synchronize environment variables between local development and Vercel deployments, ensuring consistency across all environments. Detects changes to…

36 installsView →
HookAutomation

Telegram Error Notifications

Send Telegram notifications when Claude Code encounters long-running operations or when tools take significant time. Helps monitor productivity and…

32 installsView →
HookQuality Gates

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'…

30 installsView →
HookAutomation

Slack Notifications

Send Slack notifications when Claude Code finishes working. Requires SLACK_WEBHOOK_URL environment variable. Get webhook URL from Slack App settings…

28 installsView →
HookPre-Tool

Notify Before Bash

Show notification before any Bash command execution for security awareness. This hook displays a simple echo message '🔔 About to run bash…

27 installsView →
HookMonitoring

Langsmith Tracing

Automatically send Claude Code conversation traces to LangSmith for monitoring and analysis. Prerequisites: jq (brew install jq on macOS or sudo…

24 installsView →
HookMonitoring

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…

23 installsView →
HookAutomation

Discord Notifications

Send Discord notifications when Claude Code finishes working. Requires DISCORD_WEBHOOK_URL environment variable. Get webhook URL from Discord Server…

20 installsView →
HookAutomation

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…

19 installsView →
HookAutomation

Discord Detailed Notifications

Send detailed Discord notifications with session information when Claude Code finishes. Includes working directory, session duration, and system info…

19 installsView →
HookDevelopment Tools

Worktree Ghostty

Worktree Ghostty Layout. Opens a 3-panel Ghostty layout when creating worktrees: Claude Code (left) | lazygit (top-right) / yazi (bottom-right).…

19 installsView →
HookQuality Gates

Tdd Gate

Test-Driven Development enforcement hook. Blocks editing production code files (.cs, .py, .ts, .go, .rs, .rb, .php, .java, .kt, .swift, .dart) unless…

19 installsView →
HookSecurity

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…

19 installsView →
HookAutomation

Slack Detailed Notifications

Send detailed Slack notifications with session information when Claude Code finishes. Includes working directory, session duration, and system info.…

18 installsView →
HookAutomation

Slack Error Notifications

Send Slack notifications when Claude Code encounters long-running operations or when tools take significant time. Helps monitor productivity and…

18 installsView →
HookDevelopment Tools

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…

18 installsView →
HookPre-Tool

Console Log Cleaner

Warns about console.log statements when editing files on production branches (main/master). Helps prevent debug code from reaching production.

15 installsView →
HookQuality Gates

Plan Gate

Planning gate that warns when editing production code without an approved specification. Checks for recent .spec.md files in the project directory…

15 installsView →
HookAutomation

Discord Error Notifications

Send Discord notifications when Claude Code encounters long-running operations or when tools take significant time. Helps monitor productivity and…

14 installsView →
HookSecurity

Force Push Blocker

Block git force push commands using the if condition for efficient filtering. Prevents accidental force pushes that can overwrite remote history.…

14 installsView →
HookSecurity

Shell Wrapper Guard

Detects destructive commands hidden inside shell wrappers (sh -c, bash -c, python3 -c, node -e, perl -e, ruby -e). Complements…

12 installsView →
HookDevelopment Tools

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…

8 installsView →
HookAutomation

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…

6 installsView →
HookSecurity

Ai Bash Guard

AI-powered bash command security guard. Before any Bash command runs, a lightweight Claude subagent evaluates it for destructive or irreversible…

5 installsView →
HookAutomation

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…

3 installsView →
HookDoordash

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…

1 installsView →
HookDoordash

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…

View →

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?
Hooks are shell commands that Claude Code executes automatically on lifecycle events — such as before or after a tool runs, when you submit a prompt, or when a session ends. They give you deterministic automation: the command fires every time the event occurs, independent of how Claude is prompted, so tasks like formatting, linting, or policy enforcement always happen.
Which lifecycle events can a hook respond to?
Common events include PreToolUse and PostToolUse (before and after Claude uses a tool like Edit or Bash), UserPromptSubmit (when you send a message), Notification, SessionStart, Stop (when the main agent finishes), and SubagentStop. You can also attach a matcher to a tool-based event so the hook only runs for specific tools, for example only before Bash commands.
How do I install a hook from this catalog?
Copy the install command from any hook's page and run it in your project. The general form is: npx claude-code-templates@latest --hook="category/name" --yes. This adds the hook's configuration to your Claude Code settings so it starts firing on the matching event immediately — no manual JSON editing required.
Can a hook block or stop what Claude is about to do?
Yes. A PreToolUse hook can prevent an action by returning a non-zero exit code, which stops the tool call before it runs — useful for guarding protected branches, blocking edits to sensitive files, or requiring a check to pass first. Hooks can also return structured JSON to give Claude feedback about why an action was blocked.
How are hooks different from commands, agents, and settings?
Hooks run automatically on events and are deterministic shell commands you configure in settings.json. Slash commands are prompts you invoke manually, subagents are specialized assistants Claude delegates to, and settings tune general behavior. Use a hook when you need a guaranteed action tied to an event rather than something the model chooses to do. Explore each type from the /claude-code catalog.

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.