This hook fires on the PreToolUse event, before Claude Code runs a branch checkout through Bash. It reads the name of the branch about to be created.
If the name does not match patterns like feature/, release/v.. or hotfix/*, creation is refused, keeping the repository naming consistent.
When to use
- When the team standardizes branch names and wants to avoid exceptions.
- When CI automation depends on the branch prefix.
How to use
After installing, it validates each new branch automatically. Use the expected prefixes and the checkout goes through without friction.