commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecommit
commit
Turn whatever is uncommitted in the working tree into logical, atomic
Conventional Commits — but only the files that belong to this branch. The
non-obvious value is the out-of-scope guard: multi-worktree and multi-agent
setups can leave stray files in the working tree that belong to another branch,
and this skill never sweeps them into a commit.
This skill is the single source of truth for the commit-grouping contract. It is
invoked two ways:
- Standalone () — "commit my WIP nicely." It creates the commits on the current branch and stops. It never pushes, opens a PR, writes a changelog, or touches Linear.
/commit - Inside a ship flow (e.g. ) — the commit step that runs before the lint gate, so the branch is clean before the changelog/PR work begins. The ship flow owns everything after the commits (lint, changelog, push, PR, Linear); this skill owns only the staging decision and the commits.
/send-it
将工作区中所有未提交内容转换为符合逻辑的原子化Conventional Commits——但仅包含属于当前分支的文件。其独特价值在于范围外防护:多工作区和多Agent环境可能会在工作区中留下属于其他分支的零散文件,而本技能绝不会将这些文件纳入提交。
本技能是提交分组规则的唯一权威来源。有两种调用方式:
- 独立调用()——“帮我规范提交WIP内容”。它会在当前分支创建提交后停止,绝不执行推送、创建PR、生成变更日志或操作Linear。
/commit - 在发布流程中调用(例如)——作为代码检查环节之前的提交步骤,确保在开始生成变更日志/创建PR前分支处于干净状态。发布流程负责提交后的所有操作(代码检查、变更日志、推送、PR、Linear);本技能仅负责暂存决策和提交操作。
/send-it
Configuration
配置
One knob lives in beside this skill (a neutral
ships as a template):
config.jsonconfig.example.json| Key | Meaning | Default |
|---|---|---|
| The trunk the branch diff is taken against ( | |
Throughout this document is the value.
<base>baseBranchWhen a ship flow delegates to this skill (e.g. ), it may direct the
classification against a different base for that run — for instance send-it's
for a stacked PR. Honour the base the caller resolves; fall back to
only for a standalone run.
/send-it--baseconfig.jsonbaseBranch/commit本技能旁的中有一个配置项(附带一个中立的作为模板):
config.jsonconfig.example.json| 键名 | 含义 | 默认值 |
|---|---|---|
| 分支差异对比的主干分支( | |
本文档中所有均指代的值。
<base>baseBranch当发布流程委托本技能执行时(例如),可能会指定本次运行使用不同的基准——例如send-it的参数用于堆叠PR场景。优先遵循调用方指定的基准;仅在独立调用时回退使用中的。
/send-it--base/commitconfig.jsonbaseBranchProcess
流程
- . If clean, there is nothing to commit — say so and stop.
git status --porcelain - Inspect the uncommitted files: for the list,
git status --porcelainandgit difffor the hunks.git diff --cached - Filter for branch relevance. Decide which uncommitted files are in scope:
- Compute the merge base: .
git merge-base HEAD origin/<base> - Files the branch has already touched directly: .
git diff --name-only <merge-base>...HEAD - In scope by default: an uncommitted file whose path is in that branch-touched list.
- Out of scope (uncertain): everything else once the branch has its own commits. This deliberately includes a file that merely sits in a directory the branch has touched but is not itself a path the branch changed — a shared directory is not enough to claim a file. A stray file from another branch or worktree can easily land in a directory this branch happens to have edited, and silently sweeping it in is exactly the out-of-scope leak this guard exists to prevent. Treat directory-only matches as out of scope unless the user explicitly confirms them.
- Fresh branch (no commits of its own yet): there is no branch-touched list to diff against, so nothing distinguishes your own work from a stray file left by another branch or worktree. Do not auto-promote every uncommitted file to in scope — that is exactly the leak this guard exists to catch. Treat all uncommitted files as uncertain and have the user confirm which belong before staging any of them.
- Compute the merge base:
- Show the user the staging plan: in-scope files grouped by proposed commit, plus an explicit list of out-of-scope / uncertain files flagged as "uncertain — possibly from another branch/worktree." Ask: "Stage in-scope files and create the commits below? (yes / no / customise)". Uncertain files are never staged automatically. On a fresh branch the uncertain list is every uncommitted file (step 3): ask the user to confirm which belong, and treat only the confirmed files as in scope.
- Group in-scope files into logical atomic commits:
- One commit per coherent unit (a feature, a bug fix, a refactor, a docs change, a tooling tweak). Don't bundle unrelated edits.
- Use Conventional Commits subjects (,
feat:,fix:,chore:,docs:,refactor:,perf:), with a scope when one is obvious (test:).feat(commit): … - For a breaking change, mark it honestly: a after the type/scope (
!) and/or afeat(api)!: …footer in the body. A ship flow reads the bump signal back out of these commit messages, so the markers must be accurate.BREAKING CHANGE:
- On confirmation, create the commits with (never
git add <specific files>) andgit add -A. Stage only the files named in the plan; out-of-scope files stay in the working tree, untouched. Pass onegit commitper block to add a body or footer beyond the subject —-m, and for a breaking changegit commit -m "<subject>" -m "<body>"(orgit commit -m "feat(api)!: <subject>" -m "BREAKING CHANGE: <what changed and the migration>"for a longer body). A baregit commit -F <message-file>is fine when no body is needed.git commit -m "<subject>"
If a pre-commit hook reformats files, the commit still succeeds with the formatted
content.
- 执行。如果工作区干净,则无内容可提交——告知用户并停止操作。
git status --porcelain - 检查未提交文件:通过获取文件列表,通过
git status --porcelain和git diff查看代码块。git diff --cached - 筛选分支相关文件。判断哪些未提交文件属于范围内:
- 计算合并基准:。
git merge-base HEAD origin/<base> - 分支已直接修改的文件:。
git diff --name-only <merge-base>...HEAD - 默认范围内:路径在上述分支修改列表中的未提交文件。
- 范围外(不确定):分支已有自身提交后的所有其他文件。这故意包含那些仅位于分支修改过的目录中但自身未被分支修改的文件——共享目录不足以将文件归为当前分支。其他分支或工作区的零散文件很容易出现在当前分支恰好编辑过的目录中,而静默暂存这些文件正是本防护机制要阻止的范围外泄漏。除非用户明确确认,否则仅匹配目录的文件视为范围外。
- 新分支(尚未有自身提交):没有分支修改列表可对比,因此无法区分你的工作内容与其他分支/工作区留下的零散文件。不要自动将所有未提交文件归为范围内——这正是本防护机制要避免的泄漏。将所有未提交文件视为不确定,让用户确认哪些属于当前分支后再暂存。
- 计算合并基准:
- 向用户展示暂存计划:按提议的提交分组展示范围内文件,同时明确列出范围外/不确定文件并标记为“不确定——可能来自其他分支/工作区”。询问:“是否暂存范围内文件并创建以下提交?(是/否/自定义)”。不确定文件绝不会被自动暂存。在新分支场景下,不确定列表包含所有未提交文件(步骤3):请用户确认哪些属于当前分支,仅将确认后的文件视为范围内。
- 将范围内文件分组为符合逻辑的原子提交:
- 每个连贯单元对应一个提交(功能新增、Bug修复、重构、文档变更、工具调整)。不要捆绑无关编辑内容。
- 使用Conventional Commits主题(、
feat:、fix:、chore:、docs:、refactor:、perf:),如有明确范围则添加范围(test:)。feat(commit): … - 对于破坏性变更,如实标记:在类型/范围后添加(
!)和/或在正文中添加feat(api)!: …页脚。发布流程会从这些提交信息中读取版本升级信号,因此标记必须准确。BREAKING CHANGE:
- 确认后,使用(绝不使用
git add <specific files>)和git add -A创建提交。仅暂存计划中指定的文件;范围外文件保留在工作区,不做修改。如果需要主题之外的正文或页脚,传递多个git commit参数——-m,对于破坏性变更使用git commit -m "<subject>" -m "<body>"(或对于较长正文使用git commit -m "feat(api)!: <subject>" -m "BREAKING CHANGE: <变更内容与迁移说明>")。如果无需正文,仅使用git commit -F <message-file>即可。git commit -m "<subject>"
如果预提交钩子重新格式化文件,提交仍会以格式化后的内容成功完成。
Commit-message prose
提交信息文案
Author commit subjects and bodies in the consuming repo's documented prose
language. Across this estate that is British English (, ,
/). This governs prose only — never identifiers, dependency names, or
upstream API field names.
colourbehaviour-ise-yse提交主题和正文使用目标仓库文档指定的语言。本环境统一使用英式英文(、、/)。此规则仅适用于文案——绝不影响标识符、依赖名称或上游API字段名。
colourbehaviour-ise-yseGrouping granularity — per-component splitting is parked
分组粒度——按组件拆分暂不处理
/commit/commitArguments
参数
$ARGUMENTS
$ARGUMENTS