.agents/skills/git-commit/SKILL.md
Create accurate Angular-style Git commits from staged changes only.
git statusGIT_PAGER=cat git --no-pager diff --staged --no-ext-diff --no-textconv --unified=5git branch --show-currentgit log --oneline -10/git commit delivery mode, if the initial staged diff is empty,
run git add . once, then re-run git status and the staged raw patch command
before continuing.git add; keep the commit
limited to the current staged scope.git add ..
Ask the user to stage files first.-- <path>.{USR_PREFERRED_LANGUAGE} is not English.commit_message.txtgit commit -F commit_message.txtcommit_message.txt after a successful commitThis mode is invoked only after the repository rules classify the task as
implementation and the automatic local-commit conditions are satisfied. It
is a finalization step, not a per-edit action. Planning, discussion, analysis,
and changes limited to plans or histories do not enter this mode. Agent
documentation implementation tasks may enter when repository rules allow it.
Before the first write, capture:
initial_staged_pathsinitial_unstaged_pathsinitial_untracked_pathstask_allowed_pathsSkip automatic delivery when initial_staged_paths is non-empty, when the
current index is no longer empty before Agent staging, when an Agent path
overlaps an existing user change, when the index has a conflict, or when
required validation fails. Keep the user's staged boundary unchanged in all
of these cases.
When automatic delivery is eligible:
git add -- <paths>; never use
git add . in this mode.git commit.If path ownership cannot be separated safely, leave the changes available for manual delivery and report the protected condition. A failed commit keeps the staged changes and follows the existing commit-failure rules.
Resolve {USR_PREFERRED_LANGUAGE} from the first available source:
AppleLanguages, POSIX LC_ALL,
LC_MESSAGES, LANG, locale, or Windows PowerShell culture output.Treat English variants as English. English users get one English message block. Non-English users get the local-language block first, this exact 70-character separator, then the English block:
----------------------------------------------------------------------
Place one blank line before and after the separator. Do not add labels such as
Chinese: or English:. The displayed message text must match
commit_message.txt exactly, except for Markdown code fences.
Use this structure for every language block:
type(scope): subject
First body paragraph explaining the current context or motivation.
Second body paragraph explaining the main change.
Third body paragraph explaining the result or impact.
Optional footer for breaking changes or special notes when applicable.
type(scope): subject.Problem:, Change:, or Summary:.! and/or a BREAKING CHANGE: footer only for incompatible changes.
The footer never replaces the required three body paragraphs.After a successful commit, run:
python3 .agents/skills/git-commit/scripts/commit-change-stats.py <full-commit-hash>
The script reports only text files and partitions them into two mutually exclusive categories:
docs: files under a docs or Documentation directory; files named
AGENTS.md or SKILL.md; names beginning with README or CHANGELOG; and
.md, .mdx, .rst, or .adoc files.code: every other text file, including product and test source, build and
runtime configuration, resources, localization catalogs, and skill scripts.Binary numstat entries are intentionally skipped. Do not count them and do not mention binary files in the user-facing report.
Before reporting, require each total to equal the sum of code and docs for
file count, insertions, deletions, and net change. Treat a script failure or an
inconsistent result as a reporting failure and do not invent statistics.
For a multi-commit integration range, a calling workflow may instead run:
python3 .agents/skills/git-commit/scripts/commit-change-stats.py \
--range <target-commit>...<source-commit>
After every successful commit, collect the authoritative result with:
git rev-parse HEAD for the full hash;git show -s --format=%B HEAD for the complete actual message;git branch --show-current for the branch;git status --short for the final worktree state; andFor a Chinese-language task, use this structure. Translate the labels for an English-language task, but preserve the same fields and ordering.
提交结果
- 动作:已创建提交
- Commit:`<full-hash>`
- 分支:`<branch>`
- 工作树:`干净` or `保留未提交变更`
- Push:未执行
变动统计
- 总变动:<files> 个文件,新增 <insertions> 行,删除 <deletions> 行,净增加/减少 <net> 行
- 代码变动:<files> 个文件,新增 <insertions> 行,删除 <deletions> 行,净增加/减少 <net> 行
- 文档变动:<files> 个文件,新增 <insertions> 行,删除 <deletions> 行,净增加/减少 <net> 行
实际提交信息
```text
<exact output of git show -s --format=%B HEAD>
```
Use 无变化 when a net value is zero. Never replace the complete report with
a short hash and subject. The message in the fenced block must match Git
exactly, except for the code fence.
A calling workflow that reuses an existing commit may change only the action
line to state that it did not create a commit in the current run. It must keep
the full hash, statistics, actual message, final status, and push state. Use the
reused hash instead of HEAD in the collection commands.
git push.git-commit request as authorization to commit unless confirmation
mode was explicitly requested.commit_message.txt or run git commit
before explicit approval.commit_message.txt, without
Markdown code fences.git commit together with message-file creation or cleanup in a
single shell command.git commit as the only step that needs repository write access.git commit fails with sandbox-style permission errors such as
Operation not permitted while creating .git/index.lock, immediately rerun
git commit -F commit_message.txt with the required escalation..git, request the
needed escalation for git commit directly at the commit step.commit_message.txt unless cleanup is clearly safe and
intentional.Choose the narrowest commit type that matches the staged diff:
feat: introduce user-facing behavior or a new capability.fix: correct a bug, regression, or broken behavior.docs: update documentation only.style: apply formatting or non-functional code style changes.refactor: improve internal structure without changing behavior.perf: improve performance or reduce resource usage.test: add or adjust tests without changing production behavior.build: change dependencies, packaging, or build configuration.ci: update CI workflows or automation pipelines.chore: make routine maintenance changes that do not fit another type.revert: roll back a previous change.Choose scope from the touched module, feature, service, or component whenever
possible. Prefer specific scopes such as openai, screenshot, or settings
over broad labels like app or misc.
Use this guidance only when another workflow needs a task branch name before a commit exists:
type, then summarize
the primary intent in concise English.<type>/<kebab-case-summary>. Omit Angular scope punctuation from the
branch name.This guidance derives a name only. It does not authorize staging, committing, or creating a branch. The calling workflow owns those Git operations, name collision handling, and state validation.
English-only commit message:
fix(screenshot): defer overlay capture until view appears
Overlay capture started before the view hierarchy was stable, creating a startup race in screenshot translation. When layout was still settling, that early capture could trigger conflicts or crashes.
Move screenshot capture out of the overlay initializer. Start it after the view appears and layout is ready so the capture path observes stable UI state.
This restores stable screenshot translation startup. It also reduces layout timing risk without changing the user-facing capture flow.
Non-English bilingual commit message. Write these blocks and the separator to
commit_message.txt in this order, without Markdown code fences:
fix(screenshot): 推迟悬浮层截图直到视图出现后再执行
悬浮层在视图层级尚未稳定时就启动截图,导致截图翻译启动阶段出现竞态。布局仍在变化时,过早截图可能触发布局冲突或崩溃。
将截图操作从悬浮层初始化方法中移出。改为在视图出现且布局就绪后再开始截图,让截图流程读取稳定的 UI 状态。
此修改恢复了截图翻译启动流程的稳定性。同时降低布局时序风险,并且不改变用户可见的截图流程。
----------------------------------------------------------------------
fix(screenshot): defer overlay capture until view appears
Overlay capture started before the view hierarchy was stable, creating a startup race in screenshot translation. When layout was still settling, that early capture could trigger conflicts or crashes.
Move screenshot capture out of the overlay initializer. Start it after the view appears and layout is ready so the capture path observes stable UI state.
This restores stable screenshot translation startup. It also reduces layout timing risk without changing the user-facing capture flow.