create-branch
Create a new git branch from main/master with a maximum of 17 characters. Prompts for branch name or infers from context.
When & Why to Use This Skill
This Claude skill streamlines Git workflow management by automating the creation of new branches from the main repository. It enhances repository organization by enforcing strict naming conventions, such as a 17-character limit and kebab-case formatting, while intelligently inferring branch names from the user's task context to minimize manual input and ensure consistency.
Use Cases
- Feature Development: Quickly initialize a new feature branch (e.g., `feat-ui-update`) that is automatically synced with the latest upstream main branch, ensuring a clean starting point.
- Workflow Standardization: Enforce team-wide naming constraints and character limits across a project to maintain a readable and professional Git history.
- Contextual Branching: Generate descriptive yet concise branch names automatically by allowing Claude to analyze the current coding task or bug report, reducing 'naming fatigue' for developers.
- Environment Synchronization: Automate the repetitive process of fetching, checking out main, and pulling updates before starting new work to prevent merge conflicts.
| name | create-branch |
|---|---|
| description | Create a new git branch from main/master with a maximum of 17 characters. Prompts for branch name or infers from context. |
Create Git Branch
Instructions
- Determine the main branch name by running
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' - Ensure we're on the latest main branch:
- Run
git fetch origin - Run
git checkout <main-branch> - Run
git pull origin <main-branch>
- Run
- Ask the user for a branch name OR infer from context if they've described what they're working on
- Validate the branch name:
- Must be 17 characters or less
- Should use kebab-case (lowercase with hyphens)
- Should be descriptive but concise
- If the suggested/provided name is too long, offer a shortened version
- Create the branch:
git checkout -b <branch-name> - Confirm the branch was created successfully
Branch Naming Guidelines
- Use kebab-case (e.g.,
fix-auth-bug,add-user-api) - Keep it under 17 characters
- Be descriptive but concise
- Common prefixes:
feat-,fix-,docs-,refactor-
Examples
feat-oauth(10 chars)fix-login-error(15 chars)docs-readme(11 chars)refactor-auth(13 chars)