Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By Sagargupta16v1.3.0MITIn 1 marketplace
Blocks git commits that fail lint and pushes that fail tests, formats every file Claude edits, and sends a desktop notification when Claude is waiting. Hooks run automatically and need jq installed.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
2 cautions to review before installing
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
git-hooks, pre-commit, auto-format, linting, pre-push-tests, desktop-notifications, hooks, lint ·
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Event-triggered scripts that run automatically during Claude Code sessions.
Hooks let you automate repetitive tasks -- linting before commits, formatting after edits, running tests before pushes, and sending notifications when work is done. They run as shell scripts triggered by specific events in your Claude Code workflow.
Claude Code hooks are configured in .claude/settings.json (project-level) or ~/.claude/settings.json (global). The config has three levels of nesting:
PreToolUse, PostToolUse, Notification, Stop, etc.)Bash, Edit|Write, mcp__.*. A value made only of letters, digits, _, -, spaces, , and | is compared as an exact string (or a list of exact strings), so bash matches nothing and Bash matches the Bash tool. Anything with another character is treated as an unanchored regular expression. Omit the matcher, or use *, to match every occurrence of the event.hooks key. Every handler needs a type; "command" runs a shell command. Add if with permission-rule syntax (Bash(git commit *), Edit(*.ts)) to narrow a handler further.When the event fires and the matcher matches, Claude Code runs your handler. Blocking is by exit code 2, not by any non-zero code: see Exit Codes below.
| Hook | Event | Matcher | What It Does | File |
|---|---|---|---|---|
| Pre-commit Lint | PreToolUse | Bash + if: Bash(git commit *) | Runs linter, blocks commit on errors | pre-commit-lint.sh |
| Post-edit Format | PostToolUse | Edit|Write | Auto-formats files after Claude edits | post-edit-format.sh |
| Pre-push Test | PreToolUse | Bash + if: Bash(git push *) | Runs test suite, blocks push on failures | pre-push-test.sh |
| Notification | Notification | (none) | Desktop notification when tasks complete | notification.sh |
| Dangerous Command Guard | PreToolUse | Bash | Blocks rm -rf / and ~, mkfs, dd onto a disk, git push --force without a lease, curl | sh, and DROP / TRUNCATE sent to a SQL client | block-dangerous-commands.sh |
| Secret Scan | PreToolUse | Edit|Write|NotebookEdit | Blocks an edit that would write an AWS, GitHub, Slack, Stripe, Google, Anthropic or OpenAI key, or a private key, to disk | secret-scan.sh |
| Settings Example | -- | -- | Complete settings.json with all hooks | settings-hook-examples.json |
All of them except the settings example also install as two plugins, recipe-hooks (lint, format, test, notify) and recipe-guards (the two security hooks). See Install as plugins.
block-dangerous-commands.sh splits a command on ;, &&, || and | before judging it, so rm -rf build && ls / is two harmless commands, not one rm aimed at /. It only treats DROP TABLE as dangerous when a SQL client (psql, mysql, sqlite3, ...) is on the line, so a commit message that mentions it is not blocked. It is a seatbelt against a model mistake, not a sandbox: pair it with permissions.deny rules for anything that must never run.
secret-scan.sh reads the text the tool is about to write (content on Write, new_string on Edit, new_source on NotebookEdit) and runs before the file changes, so a key never reaches the disk or a later commit. Its block message names the rule and the file but never the matched value, because stderr goes back into the conversation. The AWS documentation key [REDACTED:AWS Access Key] is allowed.
# Copy all hook scripts to your project
mkdir -p .claude/hooks
cp claude-code-recipes/hooks/*.sh .claude/hooks/
chmod +x .claude/hooks/*.sh
Add hook definitions to .claude/settings.json. See settings-hook-examples.json for the full configuration, or copy the relevant section:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"if": "Bash(git commit *)",
"command": "bash .claude/hooks/pre-commit-lint.sh"
}
]
}
]
}
}
Trigger the event (e.g., ask Claude to commit) and confirm the hook runs. If nothing happens, run claude --debug and check the debug log: a hook whose matcher never matches fails silently. See TROUBLESHOOTING.md.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub sagargupta16/claude-code-recipes --plugin recipe-hooksPlugins from other owners that cover similar ground