branch-name
Branch Name
Generate clean, team-friendly Git branch names based on current code changes.
Context Reuse (Step 0)
See _shared/context-reuse.md for the context reuse protocol.
If DIFF_CONTEXT or RAW_DIFF is already provided, use it directly to save time and tokens.
Gather Change Context (Step 1)
See _shared/branch-diff-gathering.md for branch diff collection details.
Use branch-level diff as primary source (compare current branch against base branch). This gives you the full picture of what's changing.
Optionally read commit history to improve intent inference across multiple commits.
Infer Intent and Type (Step 2)
Determine primary intent from changes:
feature(new capability)bugfix(defect fix)refactor(internal restructuring)docs(documentation)chore(maintenance/tooling)test(tests only)
Extract 2-5 keywords from modified modules, entities, or behavior. These keywords will form the branch name slug.
Build Naming Candidates (Step 3)
Use slash style prefix by default: <prefix>/<slug>
Prefix mapping:
feature→featbugfix→fixrefactor→refactordocs→docschore→choretest→test
Slug guidelines:
- lowercase only (easier to type, avoids case-sensitivity issues)
- words separated by
-(standard Git convention) - keep 2-6 words when possible (balance between clarity and brevity)
- avoid vague words like
update,misc,changes(not descriptive) - avoid issue IDs unless user requests them (IDs are better in commits/PRs)
Why these guidelines:
- Lowercase avoids confusion on case-sensitive filesystems
- Hyphens are the Git community standard (not underscores or camelCase)
- Descriptive slugs help teammates understand branches at a glance
- Short names are easier to type and fit better in Git UIs
Validate and Rank (Step 4)
Output 3 candidates by default, ordered from best to acceptable.
Validation:
- ≤ 48 characters preferred (hard max 63 due to filesystem limits)
- no spaces, no underscores, no trailing slash
- reflects actual diff intent
If intent is ambiguous, include one neutral fallback like chore/<area>-cleanup.
Output Format (Step 5)
Branch names are always English tokens — output English only (no bilingual output needed).
Output structure:
Recommended:one best branch nameAlternatives:two additional candidates- optional one-line rationale per candidate
Example Output
Recommended: fix/auth-token-refresh-race
Alternatives:
- fix/auth-refresh-lock
- refactor/auth-token-renewal-flow
Conventions
- Do not fabricate intent beyond actual changes
- Prefer domain terms already present in file paths/symbol names (maintains consistency with codebase)
- Keep names readable for both humans and CI tooling
More from quentinhsu/skills
pr-content
Generate GitHub Pull Request title and description from branch changes. Use this skill whenever the user asks to create PR content, draft a pull request, write PR description, or says things like '生成 PR 内容', '写 PR 描述', '帮我整理 PR 标题和正文', 'generate PR content', 'write PR title and description', 'draft pull request description', 'what should my PR say', or 'help me write this PR'. Also trigger when you see requests for PR templates, PR summaries, or when the user is preparing to open a pull request.
16commit-message
Generate conventional commit messages from staged git diff. Use this skill whenever the user asks to generate a commit message, write commit text, create a conventional commit, or says things like '生成 commit', '写 commit message', '根据暂存区生成提交说明', 'generate commit message from staged diff', 'write a conventional commit', 'what should my commit say', 'help me commit this'. Also trigger when you see requests to follow Conventional Commits format or when the user has staged changes and asks about committing.
15change-pack
Generate branch name, commit message, and PR content from one shared diff context. Use this skill whenever the user asks to generate multiple git writing artifacts at once, wants to save time by analyzing changes once, or says things like '一口气生成分支名、commit、PR 内容', '链式生成 git 文案', '一次分析改动生成全部', 'generate branch + commit + PR from same diff', 'generate everything', 'all git content from this diff', 'chain generate', or 'one-shot git writing'. This is more efficient than calling individual skills separately because it reads the diff only once and reuses the context.
13refactor-migrate
Migrate dependencies, frameworks, or runtime versions with minimal breakage. Use this skill when upgrading libraries, switching frameworks, replacing deprecated APIs, bumping language/runtime versions, or says things like '升级依赖', '迁移到新版本', '替换废弃 API', 'upgrade to v4', 'migrate from X to Y', 'replace deprecated calls', 'bump Node/Python/Go version', 'framework migration', or 'dependency upgrade'. Also trigger when handling breaking changes from a version bump.
3refactor-clean
Perform clean refactoring on any codebase — remove dead code, simplify logic, improve naming, extract abstractions, and reduce complexity without changing behavior. Use this skill when the user asks to clean up code, refactor for readability, reduce complexity, remove unused code, simplify conditionals, flatten nesting, rename for clarity, or says things like '重构一下这段代码', '清理无用代码', '简化逻辑', 'clean up this code', 'refactor for readability', 'reduce complexity', 'remove dead code', 'simplify this function', 'flatten nesting', or 'make this easier to read'. Also trigger when reviewing code quality or performing tech debt cleanup.
3refactor-modernize
Modernize code by replacing legacy patterns with current language features and idiomatic conventions. Use this skill when rewriting old-style code to use modern syntax, adopting new language features, replacing callbacks with async/await, using pattern matching instead of switch, applying modern iteration, or says things like '用现代写法重写', '替换旧语法', '用 async/await 重写回调', 'modernize this code', 'use modern syntax', 'replace legacy patterns', 'convert to async/await', 'use destructuring', 'apply modern idioms', or 'rewrite with current best practices'. Also trigger when adopting new edition features (Rust editions, Python 3.10+ features, ES2024, etc.).
3