3.9 KiB
3.9 KiB
description, allowed-tools, model
| description | allowed-tools | model |
|---|---|---|
| Analyze current Git changes and suggest appropriate branch names following conventional patterns (feature/fix/chore/docs). Uses branch-generator agent to analyze diff and file patterns. Provides 3-5 naming suggestions with rationale. Use before creating a new branch when you need help with naming conventions. Git差分を分析して適切なブランチ名を自動生成。慣習的なパターン(feature/fix/chore/docs)に従う。 | Task | inherit |
/branch - Git Branch Name Generator
Analyze current Git changes and suggest appropriate branch names following conventional patterns.
Implementation: This command delegates to the specialized branch-generator subagent for optimal performance and context efficiency.
How It Works
When invoked, this command:
- Launches the
branch-generatorsubagent via Task tool - Subagent analyzes git diff and status (no codebase context needed)
- Generates conventional branch names
- Returns multiple naming alternatives
Usage
Basic Usage
/branch
Analyzes current changes and suggests branch names.
With Context
/branch "Adding user authentication with OAuth"
Incorporates description into suggestions.
With Ticket
/branch "PROJ-456"
Includes ticket number in branch name.
Branch Naming Conventions
Type Prefixes
| Prefix | Use Case |
|---|---|
feature/ |
New functionality |
fix/ |
Bug fixes |
hotfix/ |
Emergency fixes |
refactor/ |
Code improvements |
docs/ |
Documentation |
test/ |
Test additions/fixes |
chore/ |
Maintenance tasks |
perf/ |
Performance improvements |
style/ |
Formatting/styling |
Format
<type>/<scope>-<description>
<type>/<ticket>-<description>
<type>/<description>
Good Examples
✅ feature/auth-add-oauth-support
✅ fix/api-resolve-timeout-issue
✅ docs/readme-update-install-steps
✅ feature/PROJ-123-user-search
Bad Examples
❌ new-feature (no type prefix)
❌ feature/ADD_USER (uppercase)
❌ fix/bug (too vague)
❌ update_code (wrong separator)
Output Format
The command provides:
- Current status: Current branch, files changed
- Analysis: Change type, primary scope, key changes
- Recommended name: Most appropriate based on analysis
- Alternatives: With scope, descriptive, concise versions
- Usage instructions: How to create or rename the branch
Integration with Workflow
Works seamlessly with:
/commit- Create branch first, then commit/pr- Generate PR description after branching/think- Planning before branching
Technical Details
Subagent Benefits
- 90% context reduction: Only git operations, no codebase loading
- 2-3x faster execution: Lightweight agent optimized for git analysis
- Specialized logic: Dedicated to branch name generation
- Parallel execution: Can run concurrently with other operations
Git Operations Used
The subagent only executes git commands:
git branch --show-current- Check current branchgit status- Check file statusgit diff- Analyze changes- No file system access or code parsing
Related Commands
/commit- Generate commit messages/pr- Create PR descriptions/research- Investigation before branching
Best Practices
- Create branch early: Before making changes
- Clear naming: Be specific about changes
- Follow conventions: Stick to project patterns
- Include tickets: Link to issues when applicable
- Keep concise: 50 characters or less
Context Efficiency
This command is optimized for minimal context usage:
- ✅ No codebase files loaded
- ✅ Only git metadata analyzed
- ✅ Fast execution (<5 seconds)
- ✅ Can run in parallel with other tasks
Note: For implementation details, see .claude/agents/git/branch-generator.md