Skip to content
zero2vibecodelearn vibe coding

Hooks

Hooks: Scripts the agent runs automatically on events — before a commit, after a file changes.

Not the same as an instruction in CLAUDE.md

An instruction is something the model reads and weighs. A hook is run by Claude Code itself at a fixed point, such as before a tool call, whether or not the model remembers it, and a PreToolUse hook can block that call outright.

Where it bites

A hook runs in your shell with Claude Code’s environment, so one copied from a snippet or shipped in a plugin is code running as you: read it first. Its `if` filter is best-effort, so for a hard allow or deny the docs point to permission rules rather than a hook.

Covered in these lessons

Related terms