AgentSkillsCN

git-branch-create

按照 {类型}/{工单 ID}-简要描述的命名规范,从 Linear 工单 ID 创建一个命名规范的 Git 分支。

SKILL.md
--- frontmatter
name: git-branch-create
description: Create a properly named git branch from a Linear ticket ID following the convention {type}/{ticket-id}-short-description

Git Branch Create

Create a new git branch following the project's naming convention.

Branch Format

code
{type}/{ticket-id}-short-description

Type Prefixes

TypeUse Case
featNew features or functionality
fixBug fixes
refactorCode refactoring without functional changes
docsDocumentation changes
testAdding or updating tests
choreMaintenance tasks, dependencies, tooling
perfPerformance improvements

Steps

  1. Determine the type from the ticket:

    • Look at the ticket type/label in Linear
    • If unclear, ask the user
  2. Extract ticket ID:

    • Format: STU-XX (or similar project prefix)
    • Keep the full ID including prefix
  3. Create short description:

    • Use 2-4 words from the ticket title
    • Lowercase, hyphen-separated
    • No special characters
    • Max 30 characters
  4. Create the branch:

    bash
    git checkout -b {type}/{ticket-id}-{short-description}
    

Examples

TicketTitleBranch Name
STU-15Add user authenticationfeat/STU-15-user-authentication
STU-23Fix login timeout issuefix/STU-23-login-timeout
STU-42Refactor API error handlingrefactor/STU-42-api-error-handling

Validation

Before creating the branch:

  1. Ensure you're on the main/master branch
  2. Pull latest changes: git pull origin main
  3. Check the branch doesn't already exist: git branch -a | grep {ticket-id}

If a branch for this ticket already exists, inform the user and ask whether to:

  • Check out the existing branch
  • Create a new branch with a different suffix