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
- 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.