skills/git-github-collaboration/git-commit/SKILL.md
Safely orchestrate Conventional Commits for staged Git changes, or for all working-tree changes when the user explicitly asks to include everything. Use when the user asks to write a commit message, split staged changes, split all changes, commit everything regardless of stage state, include untracked files in the commit set, organize a messy index before committing, or generate structured commit text without pushing by default. Default to English. Switch to Chinese only when the user explicitly says `请使用中文拆分提交所有的改动`. Agent commits automatically inject `Agent-Task` / `Agent-Model` / `Generated-By` trailers and an `[AI]` header tag; Why-line is required for feat/fix/refactor/perf; supports a `chore(wip)` checkpoint mode for long-running agent tasks.
npx skillsauth add bahayonghang/my-claude-code-settings git-commitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this workflow in order: preflight -> split plan -> classify -> compose -> commit/draft -> verify.
Decide the active change authority and output language before doing anything else:
staged-only is the default. Respect the current index and treat unstaged or untracked files as context only.all-changes is allowed only when the user explicitly asks to include everything, such as "all changes", "所有改动", "全部改动", "不管有没有 stage", or "包括未跟踪文件". In this mode, the skill may rebuild the index from the full working tree and should treat any existing partial staging as intentionally overridden by the user.english-output is the default. Use English for commit scope, subject, body, and explanatory output.chinese-output is allowed only when the user explicitly says 请使用中文拆分提交所有的改动. Treat other Chinese-language prompts as english-output unless they include that exact phrase.agent-mode is on by default whenever this skill runs (the caller is an agent). It injects [AI] in the header, attaches Agent-Task / Agent-Model / Generated-By trailers, and applies the Why-line rule for feat / fix / refactor / perf. Turn it off only when the user explicitly says "no AI tag", "不要 AI 标记", "不加 agent trailer", or equivalent.git status --short first. Then inspect the active change set:
staged-only: git diff --staged --stat and git diff --stagedall-changes: git diff --stat, git diff, git diff --staged --stat, and git diff --staged
If rtk is available, prefer rtk git status, rtk git diff --staged, and rtk git diff for model-visible inspection.staged-only or all-changes)staged-only + no staged changes: stop and tell the user to stage files first.all-changes + no staged, unstaged, or untracked changes: stop and say there is nothing to commit.git commit.agent-mode):
agent-model from the model currently running this skill (e.g. claude-opus-4-7, claude-sonnet-4-6, gpt-5-codex). This value is required.agent-task by trying, in order: (a) explicit task ID or issue URL in the user message, (b) closes #N / refs #N mentioned by the user, (c) ticket ID extracted from the current branch name, (d) Agent-Task value from the previous commit on this branch, (e) fallback to unspecified.agent-prompt-ref only when a stable prompt reference exists; otherwise leave empty.checkpoint-mode: triggered by user words such as checkpoint, 打个 checkpoint, 先存一下, WIP, [WIP], work in progress, 先提交一下,待会再整理.all-changes mode, it is acceptable to ignore the current staged subset only because the user explicitly asked to include everything.checkpoint-mode). For every candidate commit, answer:
git revert <sha> undo it without leaving the repo inconsistent?all-changes mode, say whether execution will rebuild the index per commit.checkpoint-mode is detected, skip the atomic check and prepare a single chore(wip): [AI] 🔧 [WIP] <subject> commit covering the active change set. Skip Why enforcement. Still attach agent trailers. In §6 Verify, remind the user to squash [WIP] commits before merging.type, optional scope, emoji policy, output language, [AI] policy, Why policy, and whether ! / BREAKING CHANGE is required.type in English.scope, subject, body, and explanatory output to English.scope, subject, body, and explanatory output to Chinese only when the user explicitly says 请使用中文拆分提交所有的改动.type ∈ {feat, fix, refactor, perf} and checkpoint-mode is off.COMMIT_COMPOSER="$SKILL_DIR/scripts/compose_commit_message"$COMMIT_COMPOSER = "$SKILL_DIR/scripts/compose_commit_message.ps1"bash "$COMMIT_COMPOSER" ...& "$COMMIT_COMPOSER" ...
The wrapper auto-detects python3, python, or py, so do not write python ... directly in the compose step.--body-line for body content--why for the motivation line (rendered as Why: <text> at the top of body)--closes for closing issues--refs for non-closing issue references--footer-line for other structured trailers such as Jira references--breaking-header when the header itself must include !--breaking when a BREAKING CHANGE: trailer is needed--no-emoji only when the user explicitly opts out--ai --agent-model <model> --generated-by-agent.--agent-task <value> (use unspecified only as last-resort fallback).--agent-prompt-ref <ref> only when a stable reference exists.--why "<motivation>" and --require-why so the script fails loudly when Why is missing.checkpoint-mode, use --type chore --scope wip and prepend [WIP] to summary; skip --require-why; skip --closes / --refs.--ai, omit all --agent-* flags, omit --generated-by-agent. Fall back to plain Conventional Commit.Co-Authored-By, attribution lines (e.g. 🤖 Generated with Claude Code), or push commands by default. Generated-By: agent is a structured trailer for audit grep, not an attribution line — it stays.git commit, display the final commit message (header + body + footer) and the list of files to be committed. Explicitly call out whether [AI] is in the header, whether Why is present, and which agent trailers will attach. If the user has been interactive in this session, wait for explicit confirmation. If the user pre-approved (e.g. "直接提交", "commit it"), proceed without pausing.staged-only is active, commit only the safe staged set. Write the message to a file and commit with git commit -F <message-file> so PowerShell and POSIX shells behave consistently.all-changes is active for a single atomic commit, run git add -A first so tracked, deleted, and untracked non-ignored files all enter the commit set.all-changes mode, rebuild the index one commit at a time using file/path boundaries only. Use full-worktree staging plus path-based staging or unstaging as needed, but stop if the split would require hunk-level staging or other hidden reconstruction.rtk is available and the user wants compact feedback, rtk git commit -F <message-file> is acceptable for the final commit step.git push if the user explicitly asked for it.git commit output before claiming success.staged-only or all-changes mode was usedenglish-output or chinese-output was used[AI] tag was applied and which Agent-* trailers attachedchore(wip) checkpointstaged-only, ambiguous split, Why missing for Why-required type, or draft-only request.chore(wip): commits, remind the user to squash them via git rebase -i <base-branch> before merging — but do not run rebase from this skill.development
Use only when the user explicitly asks for swarm, subagents, parallel agents, dynamic workflow, multi-agent orchestration, 多智能体编排, or when the task truly needs coordinated research plus implementation plus review plus verification packets. Do not use for ordinary code review, planning-only work, single-line bugfixes, routine audits, or migrations unless orchestration is requested or at least two independent workflow dimensions are present.
development
Run a code quality review focused on maintainability, structure, abstraction quality, file growth, branching complexity, boundary cleanliness, and refactoring opportunities. Use when the user asks for code quality review, code review, maintainability review, architecture quality review, PR code quality feedback, 代码质量审查, 代码质量 review, 可维护性审查, 架构质量审查, or review comments about code structure. Do not use for pure security review, formatting-only review, performance profiling, or implementation tasks unless the user also asks for a code quality review.
development
Plan-first brainstorming workflow that turns an idea into an approved Markdown implementation plan by default. Use when the user wants to brainstorm, design, scope, or plan a feature/spec before implementation. Spark explores project context, asks only blocking questions, writes the plan under the project root's .plannings/YYYY-MM-DD-feature-slug.md path, self-reviews it, and waits for user approval. Create an HTML or visual plan/spec only when the user explicitly asks for HTML, browser-viewable, or visual output; save the paired .html beside the Markdown plan.
development
Run a code quality review focused on maintainability, structure, abstraction quality, file growth, branching complexity, boundary cleanliness, and refactoring opportunities. Use when the user asks for code quality review, code review, maintainability review, architecture quality review, PR code quality feedback, 代码质量审查, 代码质量 review, 可维护性审查, 架构质量审查, or review comments about code structure. Do not use for pure security review, formatting-only review, performance profiling, or implementation tasks unless the user also asks for a code quality review.