git-branch
GitHub用于创建符合规范的开发分支,通过命名规则、安全检查和基准验证防止错误操作。
Trigger Scenarios
Install
npx skills add Terry-Mao/AICodingFlow --skill git-branch -g -y
SKILL.md
Frontmatter
{
"name": "git-branch",
"description": "Create repository-compliant development branches with minimal safety checks."
}
git-branch
Create a new branch without overwriting work or choosing an unsafe base.
Naming
- Issue-backed work:
<type>/<short-desc>-<issueID>. - Other work:
<type>/<user-provided-name>; never invent an issue ID. - Valid types are
feat,fix,refactor,docs,test,perf, andchore. Preserve a valid user type, otherwise infer one and default tochore. - Keep the description short, lowercase, English, hyphen-separated, and valid for Git. Remove punctuation, filler, and repeated separators.
When an issue ID is provided, use one gh issue view <issueID> --json title,body,number call for naming context. If it fails, continue only when the
request is enough and report that the issue was not verified.
Create
Check the current worktree, branch, and target branch first. Stop if the worktree intent is ambiguous, the target already exists, or the current/base branch is unsafe. Validate the name with:
git check-ref-format --branch <branch-name>
Use the repository's documented base, otherwise main. In the same repository
prefer origin/<base> over upstream/<base>; use upstream only for a fork or
explicit guidance. Fetch or compare freshness only when it can change the
choice of base. If creating from a stale local base, confirm before updating or
use a freshly fetched remote base and report that the local base was unchanged.
git switch -c <branch-name> <base>
git switch --no-track -c <branch-name> origin/<base>
Verify the resulting branch. Do not switch to an existing branch, overwrite, reset, stash, delete, or force anything without explicit user intent. Do not create protected/shared base branches.
Version History
-
d3fef11
Current 2026-09-03 03:51
精简本地开发与 spec 工作流指引
- e53c5ac 2026-07-24 11:35


