All tags
hooks
- Tip
if ! head -n1 "$1" | grep -qE '^[A-Z]'; thenA commit-msg hook can refuse commits whose message breaks your rulesRuns a script on every commit message and cancels the commit when the script exits with an error.3 Dec 2026 - Tip
"hooks": {A UserPromptSubmit hook adds fresh context to every Claude Code promptRuns a command each time you send a prompt and gives its output to Claude as context.30 Nov 2026 - Tip
echo '{"decision": "block", "reason": "The tests fail. Run npm test and fix them before you stop."}'A Stop hook keeps Claude Code working until your tests passBlocks Claude from ending its turn while the test suite fails, with a guard against loops.30 Nov 2026 - Tip
"command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'"Add a Notification hook so Claude Code pings you when it waitsSends a desktop notification when Claude Code is waiting for your input or approval.5 Oct 2026 - Tip
exit 2Block edits to .env with a PreToolUse hook that exits 2Blocks Claude Code from editing protected files by running a script that exits with code 2.26 Sep 2026 - Tip
"command": "f=$(jq -r '.tool_input.file_path') && npx prettier --write --ignore-unknown \"$f\""Let a PostToolUse hook run Prettier after every Claude editFormats every file Claude Code edits by running Prettier from a hook.21 Sep 2026 - Tip
git commit --no-verify -m "WIP: half done export"git commit -n skips the pre-commit hook when you really need toBypasses the pre-commit and commit-msg hooks for one commit.30 Nov 2026 - Tip
git config core.hooksPath .githooksCore.hooksPath lets you keep git hooks in the repositoryPoints git at a hooks folder you commit, so the whole team can share the same hooks.30 Nov 2026 - Tip
"command": "git status --short --branch && git log --oneline -5"A SessionStart hook gives Claude Code your git status before you typeFeeds your branch, changed files and last commits to Claude Code when a session starts.27 Nov 2026 - Tip
set-hook -g after-split-window "select-layout even-vertical"Tmux set-hook runs a command after an event such as a splitRuns a tmux command automatically whenever an event such as a pane split happens.28 Nov 2026
Nothing matches.