skills/branch-naming/SKILL.md
Generate and validate Git branch names.
npx skillsauth add notque/claude-code-toolkit branch-namingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate and validate Git branch names from conventional commit messages or plain descriptions. This skill only handles naming -- it does not create, delete, or manage branches.
Determine the commit type and subject from whatever the user provides.
If a conventional commit message (e.g., feat: add user auth):
<type>[optional scope]: <description>If a plain description (e.g., add user authentication):
references/type-mapping.md for full mapping)feat when no keywords matchStrip banned characters (emojis, special chars) from the input. If the input is too vague to determine a type (e.g., "stuff", "things"), prompt the user for a more descriptive input starting with an action verb.
Gate: Commit type identified and subject extracted. If not, prompt for clarification before continuing.
Map type to prefix using the standard table (or .branch-naming.json overrides if present in the repo root):
| Type | Prefix | |------|--------| | feat | feature/ | | fix | fix/ | | docs | docs/ | | refactor | refactor/ | | test | test/ | | chore | chore/ | | style | style/ | | perf | perf/ | | build | build/ | | ci | ci/ | | revert | revert/ |
Every branch name must have a prefix from this list -- unprefixed names like add-user-authentication break CI/CD automation and make filtering impossible.
Sanitize the subject to kebab-case using the 7-step pipeline (see references/sanitization-rules.md):
Only a-z, 0-9, and hyphens are allowed in the subject. The forward slash appears only once, separating prefix from subject.
Apply the 50-character length limit (prefix + subject combined). If exceeded:
Long names signal scope creep; move detail to the commit message body rather than cramming it into the branch name.
Combine prefix + sanitized subject:
Example: feat: add user authentication -> feature/add-user-authentication
Gate: Generated name has a valid prefix, uses kebab-case, stays within the length limit, and contains only allowed characters.
Run all checks against the generated (or user-provided) name:
Format validation:
feature/updates or fix/stuff are too vague)Length check: Total length is 50 characters or fewer.
Duplicate detection:
# Check local
git branch --list "<branch-name>"
# Check remote
git ls-remote --heads origin "<branch-name>"
If a duplicate is found, generate alternatives:
-v2, -v3 for versioning-YYYYMMDD for uniquenessRepository convention compliance: Check .branch-naming.json if present for custom prefix restrictions.
Gate: All validation checks pass. If any fail, regenerate with adjustments or present alternatives.
Present the validated name and wait for user approval before proceeding:
Generated Branch Name: feature/add-user-authentication
Type: feat (feature)
Length: 31 characters
Format: Valid
Duplicates: None found
Use this branch name? [Y/n]
Handle the response:
git checkout -b commandSkip confirmation only in automated/scripted workflows where the caller has explicitly opted into auto-accept.
Gate: User approved name. Workflow complete.
From a conventional commit:
Input: feat: add user authentication
feature/add-user-authenticationFrom a plain description with truncation:
Input: add comprehensive user authentication system with OAuth2 and JWT
feature/add-user-auth-oauth2-jwtValidating an existing branch name:
Input: feature/User_Authentication
feature/user-authenticationCause: Description too vague (e.g., "stuff", "things") to determine type Solution:
--type flag to specify explicitlyCause: Description too long even after truncation Solution:
Cause: Branch name already exists locally or remotely Solution:
${CLAUDE_SKILL_DIR}/references/type-mapping.md: Conventional commit type to branch prefix mapping${CLAUDE_SKILL_DIR}/references/naming-conventions.md: Branch format rules, character whitelist, examples${CLAUDE_SKILL_DIR}/references/sanitization-rules.md: 7-step text sanitization pipeline and truncation strategies${CLAUDE_SKILL_DIR}/references/examples.md: Good/bad examples with corrections and integration patternsdata-ai
Extract video transcripts: yt-dlp subtitles to clean paragraphs.
tools
Collect, filter, and freshness-qualify news items.
development
Convert PDF, Office, HTML, data, media, ZIP to Markdown.
testing
Verify factual claims against sources before publish.