Standard workflow for all branch operations ('create branch', 'new branch', 'start branch for'): replaces bash-based git checkout/branch workflows—determines base branch, generates convention-based names, preserves uncommitted changes, enforces mainline protection. Canonical branch creation implementation for git-workflows.
/plugin marketplace add cblecker/claude-skills/plugin install git-workflows@claude-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Use this skill for branch creation: "create a branch", "new branch", "start a branch for X", "create branch called X".
Use other tools for: switching branches (git checkout), listing branches (git branch).
Creates feature branches from current state, preserving uncommitted changes. Generates conventional names, validates uniqueness.
Extract from user request: purpose/description, explicit name (if provided), base branch (if specified, else mainline)
Objective: Check current branch state.
Steps:
Get current branch:
git branch --show-current
Check working tree status:
git status --porcelain
Note state:
Continue to Phase 2.
Objective: Identify which branch to create from.
Step 1: Check user request for base branch
Analyze user's request for base branch specification:
IF base branch specified in user request: Use specified branch as base Continue to Phase 3
IF no base branch mentioned:
Run ../../scripts/get-mainline-branch.sh to detect mainline branch
Parse JSON response and extract mainline_branch field
Use detected mainline as base
Continue to Phase 3
Validation Gate: Base Branch Determined
IF base branch successfully determined: PROCEED to Phase 3
IF cannot determine base branch: STOP immediately EXPLAIN: "Cannot determine which branch to create from" ASK: "Please specify base branch (e.g., 'from develop' or 'based on main')" WAIT for user input
Phase 2 complete. Continue to Phase 3.
Objective: Generate or use branch name following conventions.
Steps:
Check if user provided explicit branch name:
IF no explicit name: Run ../../scripts/detect-conventions.sh to detect commit conventions
Parse JSON response and extract uses_conventional_commits flag
Extract description from user request:
Generate branch name:
Check uniqueness:
git rev-parse --verify <branch-name> 2>/dev/null
Validation Gate: Branch Availability
IF branch does not exist: Continue to Phase 4
IF branch exists: EXPLAIN: "Branch '<branch-name>' already exists locally" PROPOSE: Generate alternative with numeric suffix (e.g., feat/auth-2) Generate alternative: - Append "-2", check again - If exists, increment: "-3", "-4", etc. - Stop at "-9", ask user for custom name Use alternative name Continue to Phase 4
Phase 3 complete. Continue to Phase 4.
Objective: Create and checkout new feature branch.
Plan Mode: Auto-enforced read-only if active
Steps:
Create and checkout branch:
git checkout -b <branch-name>
This creates the branch from current HEAD and checks it out. Uncommitted changes automatically carry forward.
Error Handling: IF failure:
Continue to Phase 5.
Objective: Confirm new branch was created and checked out.
Steps:
Verify current branch:
git branch --show-current
Compare to expected branch name from Phase 3
Report using template:
✓ Branch Created Successfully
**Branch:** <branch_name> \
**Created from:** <base_branch> \
**Uncommitted changes:** <Preserved|None>
Validation Gate: IF current branch does not match expected:
git checkout <expected-branch>"Workflow complete.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.