npx skills add https://github.com/ruchernchong/claude-kit --skill create-branch根据项目推断语言风格:
此命令通过智能验证和 GitHub Issue 集成来创建并检出新的 git 分支。
重要提示:如果用户提供了 Issue 编号(例如,“#123”、“123”或“issue 123”),请始终优先使用 GitHub CLI 的 Issue 开发工作流:
检查 GitHub CLI 是否可用:
gh --version
如果不可用,请通知用户并回退到手动创建分支。
验证 Issue 是否存在:
gh issue view <issue-number>
显示 Issue 标题和状态以进行确认。
创建与 Issue 关联的分支:
gh issue develop <issue-number> -c
-c 标志会自动检出新创建的分支Infer language style from the project:
This command creates and checks out a new git branch with intelligent validation and 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:
Check for GitHub CLI availability :
gh --version
If not available, inform the user and fall back to manual branch creation.
Verify the issue exists :
gh issue view <issue-number>
Display issue title and status to confirm.
:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
跳转到远程推送步骤(下面的步骤 8)
如果未提供 Issue 编号,请遵循此工作流:
git status
验证:
向用户询问所需的分支名称。接受任何格式的输入——命令将处理格式化和验证。
分析分支名称输入中的关键词,并自动添加适当的前缀:
如果用户的输入已经以可识别的前缀(feature/、bugfix/ 等)开头,则保持原样。
应用全面的验证:
prefix/kebab-case-name拒绝包含以下内容的分支名称:
~、^、:、?、*、[、]、\、@{、..检查本地和远程分支:
# 检查本地分支
git branch --list "<branch-name>"
# 检查远程分支
git ls-remote --heads origin "<branch-name>"
如果分支已存在:
使用智能默认值:
检查 main 是否存在:
git rev-parse --verify main
如果不存在,检查 master 是否存在:
git rev-parse --verify master
如果两者都不存在,则使用当前 HEAD
允许用户在需要时指定不同的基础分支(在创建前询问)
git checkout -b <validated-branch-name> <base-branch>
通过显示以下信息的消息确认创建成功:
询问用户:“您是否希望将此分支推送到远程并设置跟踪?”
如果是:
git push -u origin <branch-name>
这可以实现:
提供清晰、可操作的错误消息:
git init 初始化一个仓库,或导航到一个仓库目录。”gh) 未安装。请从 https://cli.github.com 安装,或使用手动创建分支。”feature/valid-branch-name”feature/existing 已存在。请使用 git checkout feature/existing 切换到该分支,或选择其他名称。”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
User: "Create branch: fix login bug"
Analysis: Contains "fix" → apply "bugfix/" prefix
Validated: "bugfix/login-bug"
Command: git checkout -b bugfix/login-bug main
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
每周安装量
1.2K
仓库
首次出现
2026年2月13日
安全审计
安装于
github-copilot988
opencode988
codex987
gemini-cli986
amp985
kimi-cli985
gh issue develop <issue-number> -c
-c flag automatically checks out the newly created branchSkip to remote push step (step 8 below)
If no issue number is provided, follow this workflow:
git status
Verify:
Ask the user for the desired branch name. Accept input in any format - the command will handle formatting and validation.
Analyse the branch name input for keywords and automatically add appropriate prefixes:
If the user's input already starts with a recognised prefix (feature/, bugfix/, etc.), keep it as-is.
Apply comprehensive validation:
prefix/kebab-case-nameReject branch names containing:
~, ^, :, ?, *, [, ], \, @{, ..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:
Use smart defaulting:
Check if main exists:
git rev-parse --verify main
If not, check if master exists:
git rev-parse --verify master
If neither exists, use current HEAD
Allow user to specify different base branch if needed (ask before creating)
git checkout -b <validated-branch-name> <base-branch>
Confirm successful creation with a message showing:
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:
Provide clear, actionable error messages:
git init or navigate to a repository."gh) is not installed. Install it from https://cli.github.com or use manual branch creation."feature/valid-branch-name"feature/existing already exists. Switch to it with git checkout feature/existing or choose a different name."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
User: "Create branch: fix login bug"
Analysis: Contains "fix" → apply "bugfix/" prefix
Validated: "bugfix/login-bug"
Command: git checkout -b bugfix/login-bug main
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
Weekly Installs
1.2K
Repository
First Seen
Feb 13, 2026
Security Audits
Installed on
github-copilot988
opencode988
codex987
gemini-cli986
amp985
kimi-cli985
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装