git-branch

GitHub

安全高效地创建符合规范的 Git 分支。支持基于 Issue 或自定义命名,自动推断类型并规范化名称。执行最小化检查以防错名、错基或覆盖,默认使用 main 为基准,仅在必要时进行远程同步与冲突检测。

.agents/skills/git-branch/SKILL.md Terry-Mao/AICodingFlow

触发场景

用户请求创建新的开发分支 用户希望基于特定 Issue 生成分支名 用户需要规范化 Git 分支命名格式

安装

npx skills add Terry-Mao/AICodingFlow --skill git-branch -g -y
更多选项

非标准路径

npx skills add https://github.com/Terry-Mao/AICodingFlow/tree/main/.agents/skills/git-branch -g -y

不安装直接使用

npx skills use Terry-Mao/AICodingFlow@git-branch

指定 Agent (Claude Code)

npx skills add Terry-Mao/AICodingFlow --skill git-branch -a claude-code -g -y

安装 repo 全部 skill

npx skills add Terry-Mao/AICodingFlow --all -g -y

预览 repo 内 skill

npx skills add Terry-Mao/AICodingFlow --list

SKILL.md

Frontmatter
{
    "name": "git-branch",
    "description": "Create repository-compliant branches with efficient issue naming, base selection, and safety checks."
}

git-branch

Create a development branch with the fewest checks needed to avoid wrong names, wrong bases, or overwrites.

Naming

  • Issue-backed: <type>/<short-desc>-<issueID>.
  • Non-issue: <type>/<user-provided-name>; never invent an issue ID.
  • Types: feat, fix, refactor, docs, test, perf, chore.
  • Preserve a valid user type; otherwise infer from the task, defaulting to chore.
  • Normalize to short lowercase English words separated by -; remove punctuation, filler words, repeated separators, and non-branch characters.

If the user gives an issue reference, run one gh call:

gh issue view <issueID> --json title,body,number

Use the title for short-desc; fall back to body or user context only when needed. If no issue is mentioned, do not call gh. If gh fails but context is enough, continue and report that issue metadata was not verified.

Validate:

git check-ref-format --branch <branch-name>

Efficient Checks

Prefer one shell call for local checks:

git status --short
git branch --show-current
git branch --list <branch-name>

Add remote/freshness checks only when they affect the result:

git branch --remotes --list '*/<branch-name>'
git fetch origin <base>
git rev-list --left-right --count <base>...origin/<base>

Base policy:

  • Default <base> to main unless repo guidance or the user names another base.
  • Same-repo work prefers origin/<base> over upstream/<base>.
  • Use upstream only for fork workflows or explicit guidance.
  • Do not make the new branch track the base; git-push sets upstream later.

Stop only when the target branch exists, dirty worktree intent is ambiguous, the current/base branch is clearly unsafe, or freshness checks show the selected base is stale.

Create

Use one of:

git switch -c <branch-name> <base>
git switch --no-track -c <branch-name> origin/<base>

Then verify with:

git branch --show-current

Guardrails

  • No overwrite, reset, stash, delete, or force operations unless explicitly asked.
  • Do not switch to an existing branch without user intent.
  • Do not create protected/shared base branches (main, master, develop, release branches) unless explicitly asked.
  • Report skipped freshness checks only when they could matter.

版本历史

  • e53c5ac 当前 2026-07-24 11:35

同 Skill 集合

.agents/skills/bootstrap-issue-config/SKILL.md
.agents/skills/create-issue/SKILL.md
.agents/skills/create-pr/SKILL.md
.agents/skills/diagnose-ci-failures/SKILL.md
.agents/skills/git-commit/SKILL.md
.agents/skills/git-push/SKILL.md
.agents/skills/git-worktree/SKILL.md
.agents/skills/pr-walkthrough/SKILL.md
.agents/skills/resolve-merge-conflicts/SKILL.md
.agents/skills/review-pr-local/SKILL.md
.agents/skills/review-spec-local/SKILL.md
.agents/skills/spec-driven-implementation/SKILL.md
.agents/skills/write-product-spec/SKILL.md
.agents/skills/write-tech-spec/SKILL.md
.github/skills/check-impl-against-spec/SKILL.md
.github/skills/create-product-spec/SKILL.md
.github/skills/create-tech-spec/SKILL.md
.github/skills/dedupe-issue-repo/SKILL.md
.github/skills/dedupe-issue/SKILL.md
.github/skills/implement-issue/SKILL.md
.github/skills/implement-specs/SKILL.md
.github/skills/product-change-report/SKILL.md
.github/skills/product-docs-sync/SKILL.md
.github/skills/product-wiki/SKILL.md
.github/skills/review-pr-repo/SKILL.md
.github/skills/review-pr/SKILL.md
.github/skills/review-spec-repo/SKILL.md
.github/skills/review-spec/SKILL.md
.github/skills/security-review-pr/SKILL.md
.github/skills/security-review-spec/SKILL.md
.github/skills/triage-issue-repo/SKILL.md
.github/skills/triage-issue/SKILL.md
.github/skills/update-dedupe/SKILL.md
.github/skills/update-pr-review/SKILL.md
.github/skills/update-triage/SKILL.md

元信息

文件数
0
版本
e53c5ac
Hash
8f63ab79
收录时间
2026-07-24 11:35

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-07 22:56
浙ICP备14020137号-1 $访客地图$