Build Verify Notice
The agent kicks off a build inside a Bash command and moves on, missing whether it actually succeeded. A post-command check pins the result to the transcript.
Hooks run automatically at specific points in Claude Code's lifecycle to enforce rules, format code or trigger side-effects.
25 hooks in the library. How to install hooks →
25 items
The agent kicks off a build inside a Bash command and moves on, missing whether it actually succeeded. A post-command check pins the result to the transcript.
The agent writes commit messages that don't follow Conventional Commits, breaking changelog generation and semantic-release. Catch the bad message before the commit runs.
Debug `console.log` / `print` statements slip into committed code because nothing flags them at edit time. A quick scan on each edit keeps stray debug output out of the tree.
Long sessions silently approach the context limit and then compact at the worst moment, dropping state mid-task. A running warning lets the agent checkpoint and compact deliberately.
You have no idea how many tool calls a long session made until it is over. A lightweight counter appended on every tool call gives you a live activity ledger to review.
One `rm -rf`, force-push, or `DROP TABLE` from an over-eager agent is unrecoverable. The harness should refuse destructive commands rather than trust the model to be careful.
When safety hooks deny commands, you lose the signal — there's no record of what the agent tried and got blocked on. An append-only audit log turns denials into a reviewable trail.
Agents love to create README.md, SUMMARY.md, and NOTES.md files nobody asked for, cluttering the repo. Warn (or block) on unsolicited documentation-file creation.
An agent edit can clobber a file in a way that's awkward to recover from mid-session. A cheap pre-edit snapshot gives you an instant local rollback point.
Agent-written files drift from house formatting, producing noisy diffs and pre-commit churn. Formatting should be automatic, not a review comment.
The agent pushes before anyone has looked at the diff. A pre-push reminder forces a beat to confirm the change set is intended and the branch is right.
Lint violations accumulate silently between edits and only surface in CI. Running the linter on each edited file keeps the tree green as the agent works.
You want a session to begin in a specific posture (strict review, intensity level, house ruleset) without pasting instructions every time. A SessionStart hook activates the mode and injects its rules.
When a long-running agent needs attention or finishes, nobody is watching the terminal. Forward its notifications to Slack (or any webhook) so the human gets pinged.
The agent opens a PR via `gh pr create` and stops, leaving reviewers unpinged and the checklist unmentioned. A follow-up hook posts a next-steps note the moment the PR lands.
During a scoped task the agent wanders and edits files far outside the intended directory. A freeze boundary keeps writes inside the area you actually authorized.
Different files need different checks — JSON needs schema/format, Go needs vet, Python needs a linter. One gate that dispatches by file type keeps every edit clean without per-language wiring.
A review sub-agent "finishes" with a vague thumbs-up and no actionable findings. Gate the stop on structured output — require concrete findings with severities before the review counts as done.
Reimplementing command-safety heuristics in shell is error-prone and hard to keep current. Delegate the whole PreToolUse decision to a maintained safety-net tool instead of hand-rolling patterns.
The agent stages a file that contains an API key, an AWS secret, or a private key and commits it. Once pushed, the secret is compromised forever. Scan staged content before the commit runs.
In a knowledge-base or notes repo, the agent needs the shape of the workspace — which files exist, what the methodology is — before it can act usefully. Inject a structure map at session start.
Every new session starts cold — the agent re-derives project context it learned last time. A SessionStart hook injects the essentials (recent branch, open tasks, house rules) up front.
When an agent has shell access on a real machine, a stray write to /etc, a firewall flush, or a `curl | sudo sh` can take the host down. System-level operations need a harder fence than project files.
The agent announces it is done while the test suite is red. Without a gate, "finished" is self-graded and the regression ships.