By Vero SecurityBuilt and funded by Vero Security, the AI Security Engineering platform.Read the charter

Scoping hooks with the if field, and its limits

The if field uses permission rule syntax, such as Bash(git *), so a hook process only starts for matching calls. Matching is best effort when a command uses substitution or variables. Learn when to rely on a hook filter and when to use a permission deny rule for a hard guarantee.

Read in this order

  1. OfficialFilter by tool name and arguments with the if field (Claude Code hooks guide)A table of which Bash command shapes trigger a hook and which do not.

Save your progress

We email you a sign-in link. No password.

By signing in you agree to the terms. The privacy policy explains how we use your details.

Join the AI security engineering community

Free. Roadmap updates, chapters near you, and first word when credentials open.

We’ll email you community updates. Unsubscribe anytime. By sending this you agree to the terms. The privacy policy explains how we use your details.