AgentSkillsCN

creating-branch

创建具有优化短命名、自动递增与提交类型检测(feat/fix/refactor)的功能分支。支持手动描述与从未提交的git变更自动生成。当用户要求创建分支、开启新分支、制作分支、检出新分支、切换分支、新任务、开始工作、开始处理功能、开始功能、创建功能分支、运行/create-branch命令,或提到“分支”、“功能”、“新功能”、“feat”、“fix”或“checkout”时,就使用此技能。

SKILL.md
--- frontmatter
name: creating-branch
description: Creates feature branches with optimized short naming, auto-incrementing, and commit type detection (feat/fix/refactor). Supports manual descriptions and auto-generation from uncommitted git changes. Use when user requests to create branch, start new branch, make branch, checkout new branch, switch branch, new task, start working on, begin work on feature, begin feature, create feature branch, run /create-branch command, or mentions "branch", "feature", "new feature", "feat", "fix", or "checkout".
model: haiku

Git Branch Creation Workflow

Execute feature branch creation with intelligent naming, automatic type detection, and sequential numbering.

Usage

This skill is invoked when:

  • User runs /create-branch or /git:create-branch command
  • User requests to create a new feature branch
  • User asks to start a new branch for a task

Two Operation Modes

Mode 1: With Description (Manual)

The command takes a description and automatically detects the commit type.

Format: /create-branch <description>

Examples:

bash
/create-branch add user authentication
→ Creates: feat/001-user-authentication

/create-branch fix login bug
→ Creates: fix/002-login-bug

/create-branch refactor auth service
→ Creates: refactor/003-auth-service

/create-branch remove deprecated code
→ Creates: chore/004-remove-deprecated

/create-branch document api endpoints
→ Creates: docs/005-document-api

Mode 2: Auto-Generate from Changes (No Arguments)

When no arguments provided and no sdlc-develop specs exist, analyze uncommitted changes to generate branch name automatically.

Format: /create-branch (no arguments)

Process:

  1. Check for sdlc-develop specs (see Mode 3)
  2. If no specs, check for uncommitted changes (both staged and unstaged)
  3. If no changes exist, display error and require description
  4. If changes exist, analyze to generate description
  5. Create branch with auto-generated name

Examples:

bash
# After modifying authentication files
/create-branch
→ Auto-detected from changes: feat/006-authentication-system
→ (based on: login.py, auth_service.ts, user_model.py)

# After fixing payment bug
/create-branch
→ Auto-detected from changes: fix/007-payment-processing
→ (based on: payment.js, checkout.py)

Mode 3: From SDLC-Develop Spec (Arkhe Integration)

When no arguments provided and sdlc-develop specs exist, the skill can create branches linked to existing feature specs.

Detection Flow:

  1. Check if .arkhe.yaml exists → read develop.specs_dir (default: arkhe/specs)
  2. Scan {specs_dir}/ for existing spec directories
  3. If specs found → present selection via AskUserQuestion
  4. Use spec directory name for branch name

Example:

bash
# Specs exist: arkhe/specs/01-user-auth/, arkhe/specs/02-dashboard/
/create-branch

# Prompt: "Select a feature spec for this branch"
# Options: 01-user-auth, 02-dashboard, None (auto-generate from changes)

# User selects 01-user-auth
→ Creates: feat/01-user-auth

Commit Type Detection

The workflow automatically detects commit types from keywords in the description:

TypeKeywords
featadd, create, implement, new, update, improve
fixfix, bug, resolve, correct, repair
refactorrefactor, rename, reorganize
choreremove, delete, clean, cleanup
docsdocs, document, documentation

If no keyword is detected, defaults to feat.

Branch Naming Format

Pattern: {type}/{number}-{keyword1}-{keyword2}

Components:

  • type: Auto-detected commit type (feat, fix, refactor, chore, docs)
  • number: Auto-incremented 3-digit number (001, 002, 003...)
  • keywords: First 2-3 meaningful words from description (lowercase, hyphenated)

Examples:

  • Input: "add user authentication system"

  • Output: feat/001-user-authentication

  • Input: "fix null pointer in login"

  • Output: fix/002-null-pointer

Important Notes

  • Sequential Numbering: Finds next available number by scanning existing branches
  • Keyword Extraction: Filters common words, keeps 2-3 meaningful terms
  • Lowercase Convention: All branch names are lowercase with hyphens
  • Conventional Commits: Aligns with conventional commit types
  • SDLC-Develop Integration: Detects feature specs from .arkhe.yaml

Supporting Documentation