Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问许可证需确认审计异常

create-branch创建分支

Agent Skill

create-branch 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

28,512

周安装

1,234

GitHub Stars

公开资料未说明

下载量

9,984
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:create-branch(创建分支)
来源仓库:https://github.com/ruchernchong/claude-kit
仓库路径:skills/create-branch
安装命令:
npx skills add https://github.com/ruchernchong/claude-kit --skill create-branch
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ruchernchong/claude-kit --skill create-branch

简介

通过智能验证和 GitHub 问题集成创建和签出 git 分支。

  • 当提供问题编号时,使用 gh issuedevelop 自动将分支链接到 GitHub 问题
  • 用于无缝项目跟踪
  • 根据分支名称中的关键字智能应用语义前缀(feature/、bugfix/、hotfix/、chore/、docs/)
  • 验证分支名称的短横线格式、禁止字符、长度限制以及本地和远程分支之间的重复检测
  • 检测现有分支的项目语言约定并提交消息以保持一致性
  • 建议选择基本分支(主分支或主分支),并提供带有跟踪设置的远程推送以进行协作

SKILL.md

Language Conventions

Infer language style from the project:

  • Analyze existing branches, commit messages, and documentation to detect the project's language variant (US English, UK English, etc.)
  • Match the spelling conventions found in the project (e.g., "synchronize" vs "synchronise", "center" vs "centre")
  • Maintain consistency with the project's established language style throughout branch names and command outputs

Create Branch Command

This command creates and checks out a new git branch with intelligent validation and GitHub issue integration.

Priority: GitHub Issue Integration

IMPORTANT: If the user provides an issue number (e.g., "#123", "123", or "issue 123"), ALWAYS prioritise using GitHub CLI's issue development workflow:

  1. Check for GitHub CLI availability: gh --version If not available, inform the user and fall back to manual branch creation.
  2. Verify the issue exists: gh issue view <issue-number> Display issue title and status to confirm.
  3. Create branch linked to issue: gh issue develop <issue-number> -c

- The -c flag automatically checks out the newly created branch - GitHub automatically generates an appropriate branch name from the issue title - The branch is linked to the issue for better project tracking

  1. Skip to remote push step (step 8 below)

Manual Branch Creation Workflow

If no issue number is provided, follow this workflow:

1. Check Repository Status

git status

Verify:

  • Clean working directory or acceptable uncommitted changes
  • Current branch information
  • Whether we're in a git repository

2. Get Branch Name Input

Ask the user for the desired branch name. Accept input in any format - the command will handle formatting and validation.

3. Auto-Detect and Apply Prefix

Analyse the branch name input for keywords and automatically add appropriate prefixes:

  • feature/ - Keywords: "add", "implement", "create", "new", "feature"
  • bugfix/ - Keywords: "fix", "bug", "resolve", "patch", "repair"
  • hotfix/ - Keywords: "hotfix", "urgent", "critical", "emergency"
  • chore/ - Keywords: "chore", "refactor", "update", "upgrade", "maintain"
  • docs/ - Keywords: "docs", "documentation", "readme", "guide"

If the user's input already starts with a recognised prefix (feature/, bugfix/, etc.), keep it as-is.

4. Validate Branch Name

Apply comprehensive validation:

Kebab-Case Enforcement

  • Convert to lowercase
  • Replace spaces and underscores with hyphens
  • Ensure format is: prefix/kebab-case-name

Character Validation

Reject branch names containing:

  • Spaces (convert to hyphens)
  • Special characters: ~, ^, :, ?, *, [, ], \, @{, ..
  • Control characters or non-ASCII (except hyphens and slashes)
  • Leading or trailing slashes or hyphens

Length Validation

  • Minimum: 3 characters (excluding prefix)
  • Maximum: 100 characters (total)

5. Check for Duplicates

Check both local and remote branches:

# Check local branches
git branch --list "<branch-name>"

# Check remote branches
git ls-remote --heads origin "<branch-name>"

If branch exists:

  • Locally: Offer to checkout existing branch instead
  • Remotely: Warn user and suggest alternative name
  • Both: Inform user and ask if they want to checkout or choose different name

6. Determine Base Branch

Use smart defaulting:

  1. Check if main exists: git rev-parse --verify main
  2. If not, check if master exists: git rev-parse --verify master
  3. If neither exists, use current HEAD
  4. Allow user to specify different base branch if needed (ask before creating)

7. Create and Checkout Branch

git checkout -b <validated-branch-name> <base-branch>

Confirm successful creation with a message showing:

  • Branch name
  • Base branch used
  • Current status

8. Remote Push Recommendation

Ask the user: "Would you like to push this branch to remote and set up tracking?"

If yes:

git push -u origin <branch-name>

This enables:

  • Remote backup of the branch
  • Collaboration with team members
  • GitHub PR creation workflow
  • Branch visibility in GitHub UI

Error Handling

Provide clear, actionable error messages:

  • Not a git repository: "This directory is not a git repository. Initialise one with git init or navigate to a repository."
  • GitHub CLI not available: "GitHub CLI (gh) is not installed. Install it from https://cli.github.com or use manual branch creation."
  • Issue not found: "Issue #123 not found. Check the issue number or create a branch manually."
  • Invalid branch name: "Branch name contains invalid characters. Suggested: feature/valid-branch-name"
  • Branch exists: "Branch feature/existing already exists. Switch to it with git checkout feature/existing or choose a different name."
  • Network issues: "Unable to check remote branches. Proceeding with local creation only."

Examples

Example 1: GitHub Issue Integration

User: "Create a branch for issue #456"
Command: gh issue view 456
Output: #456 - Add user authentication (open)
Command: gh issue develop 456 -c
Output: Created and checked out branch: feature/456-add-user-authentication

Example 2: Manual with Auto-Prefix

User: "Create branch: fix login bug"
Analysis: Contains "fix" → apply "bugfix/" prefix
Validated: "bugfix/login-bug"
Command: git checkout -b bugfix/login-bug main

Example 3: Custom Prefix

User: "Create branch: docs/update readme"
Analysis: Already has "docs/" prefix → keep as-is
Validated: "docs/update-readme"
Command: git checkout -b docs/update-readme main

Best Practises

  1. Always prioritise GitHub issue workflow when issue numbers are mentioned
  2. Validate thoroughly before creating branches to avoid git errors
  3. Use descriptive names that clearly indicate the purpose
  4. Follow team conventions - check existing branch names for patterns
  5. Push to remote early for backup and collaboration
  6. Link branches to issues whenever possible for better project tracking

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.73%
按下载量换算3,467

Claude

30.59%
按下载量换算3,054

Cursor

18.17%
按下载量换算1,814

Gemini CLI

8.15%
按下载量换算814

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills