Skip to content

Use Hooks for Non-negotiable Checks

Instructions are advisory. Hooks are deterministic.

Use hooks when something should happen every time without relying on Claude remembering it from CLAUDE.md or the prompt.

  • Run a formatter after edits.
  • Run lint or typecheck before stopping.
  • Block writes to sensitive folders.
  • Prevent edits to generated files.
  • Deny reads from secret paths.
  • Require a verification command before a task ends.

Use a hook when forgetting the action would create a real problem.

Keep guidance in CLAUDE.md when it is contextual, judgment-based, or occasionally useful. Promote it to a hook when it is mandatory and mechanical.

Run:

Terminal window
/hooks

Use the hook browser to inspect configured hooks, or edit .claude/settings.json directly when you know the exact rule you want.