Back to all errors

GIT020

GIT

Branch naming violation

Error

The branch name violates naming conventions: contains spaces, uppercase letters, invalid type prefix, or doesn't follow type/description format.

Why this matters

Consistent branch names make it easier to identify work at a glance, sort and filter branches, and integrate with CI/CD systems that rely on branch patterns.

How to fix

Use lowercase kebab-case with a valid type prefix:

# Instead of:
git checkout -b "My Feature Branch"
git checkout -b FeatureBranch

# Use:
git checkout -b feat/my-feature
git switch -c fix/login-bug

Valid type prefixes (default): feat, fix, docs, style, refactor, test, chore, ci, build, perf

Configuration

[validators.git.branch]
protected_branches = ["main", "master"]
valid_types = ["feat", "fix", "docs", "chore", "refactor", "test"]
require_type = true
allow_uppercase = false

Examples

Valid branch names

git checkout -b feat/user-auth
git switch -c fix/null-pointer
git branch chore/update-deps

Invalid branch names

git checkout -b "my feature"     # spaces not allowed
git checkout -b MyFeature        # uppercase not allowed (default)
git checkout -b random-name      # missing type/ prefix
git checkout -b foo/bar          # "foo" not a valid type

Hook output

When this error is triggered, klaudiush writes JSON to stdout:

permissionDecisionReason (shown to Claude): [GIT020] Branch naming violation. Use lowercase kebab-case for branch names (e.g., feat/my-feature)

systemMessage (shown to user): Formatted error with fix hint and reference URL.

additionalContext (behavioral guidance): Automated klaudiush validation check. Fix the reported errors and retry the same command.

  • GIT007 - missing remote for push
  • GIT008 - missing branch for push

© 2026 Smykla Skalski Labs