原子化提交拆分
atomic-commits
将当前工作树(包括已暂存和未暂存的更改)拆分为一系列原子提交,其提交信息符合仓库现有约定,并通过快照保护整个过程,确保不丢失或引入任何更改。当你希望将待提交的工作整理成干净、逻辑分离的提交时显式调用。传入 `--fix` 可在不等待批准的情况下提交该计划。
- License 许可
- MIT
- 所属仓库
- hareki/dotfiles
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- atomic-commits
- description
- Split the current worktree (staged and unstaged) into a sequence of atomic commits whose messages match the repository's existing conventions, guarding the process with a snapshot so no change is lost or introduced. Invoke explicitly when you want pending work committed as clean, logically separated commits. Pass `--fix` to commit the plan without waiting for approval.
- allowed-tools
- Bash(git status:*), Bash(git diff:*), Bash(git log:*), Bash(git add:*), Bash(git commit:*), Bash(git reset:*), Bash(git write-tree:*), Bash(git rev-parse:*)
- argument-hint
- [--fix]
- disable-model-invocation
- true
03 SKILL.md 正文
Atomic Commits
Split everything currently in the worktree into a sequence of small, self-contained commits, ordered sensibly, with messages that match how this repo already writes commits. Whether a change is staged or unstaged does not matter: it all gets regrouped here.
Two things must hold when you finish: every pending change ends up committed (nothing lost), and nothing new is committed that was not already in the worktree (nothing invented). The snapshot in step 1 is what lets you prove both at the end, so do not skip it.
1. Snapshot the worktree, and capture the full diff in one view
Before grouping anything, record the complete state so you can verify it later and roll back if needed:
git rev-parse HEAD # ORIG_HEAD: rollback anchor and end-of-run base
git add -A # stage everything: edits, new files, deletions, untracked (ignored files stay out, as they should)
git write-tree # SNAPSHOT_TREE: the printed SHA is the ground-truth content
git diff --staged HEAD # the COMPLETE set of pending changes, tracked + untracked, in one place
git reset # unstage; this is a mixed reset, it moves only the index and leaves every file untouched
Keep ORIG_HEAD and SNAPSHOT_TREE for step 5. The git diff --staged HEAD output above is your full inventory of what needs to be committed, so read it carefully before planning.
2. Learn the repo's commit style
git log -30 --format='%s' # subject-line conventions
git log -10 --format='%s%n%n%b%n--------' # whether/how bodies are used
Infer and follow what the repo actually does, not a generic default: Conventional Commits prefixes (feat, fix, chore, refactor, docs, etc.) and scope notation if present, capitalization, imperative vs. past tense, typical subject length, and whether a body is usually included.
3. Plan the commits
Group the changes into the smallest set of commits that each represent one coherent concern (one feature, fix, refactor, or cleanup), and order them so each builds on the last (prerequisites and refactors before the features that depend on them).
Present the plan to the user before committing anything: the ordered list of commits, the proposed message for each, and which files (or hunks) go into each. What happens next depends on the arguments:
- Without
--fix: wait for the user to sign off on the grouping and the order before committing. If they want changes, revise and re-present. - With
--fix: the plan is pre-approved. Present it, then continue straight to step 4 in the same turn.
If some changes are too entangled to separate cleanly, say so in the plan and go with the best grouping rather than forcing artificial splits.
4. Stage and commit each group, in order
For each planned commit:
- Whole files:
git add <file>... - A file that spans multiple logical changes:
git add -p <file>to stage only the relevant hunks. This only ever stages content; it cannot discard it. - Verify what you are about to commit with
git diff --staged, then commit with its planned message.
Write the message exactly as planned. For a body, pass it as additional -m arguments. Add nothing else (see Guardrails on attribution).
5. Verify nothing was lost or added
After the final commit:
git status --short # must be empty: a clean worktree means everything was committed
git diff <SNAPSHOT_TREE> HEAD # must print nothing: the committed tree equals the snapshot
If git status is not clean, a change was missed: stage and commit the remainder (re-running step 1's snapshot view helps you see what is left). If git diff <SNAPSHOT_TREE> HEAD shows anything, the committed content diverges from what you started with, so stop and report it rather than papering over it. Both checks passing is the proof that the new commits reproduce exactly the worktree you began with.
If something goes wrong at any point, recover with git reset --soft <ORIG_HEAD>: it un-commits everything back into the index without touching a single file, so you can regroup and try again.
Guardrails
- No attribution. Never add a
Co-Authored-Bytrailer or any Claude/AI attribution. The message is exactly the planned content, with nothing appended. - Commit only what is already there. Never edit, create, reformat, or delete file contents to make a commit look cleaner. Introduce nothing new into the worktree; the snapshot check in step 5 exists to catch exactly this.
- Never run change-destroying commands.
git reset --hard,git checkout -- <path>,git restore,git clean, andgit stashcan all wipe uncommitted work and are not part of this workflow. The only resets used here are the mixedgit reset(unstage) andgit reset --soft(rollback), both of which preserve file content. - Do not
git push,git rebase, or amend existing commits unless explicitly asked. - If the worktree is already clean when you start, report that and stop.
04 同仓库更多 Skills
writing-guidelines
Review docs/prose for Writing Guidelines compliance. Use when asked to "review my docs", "check writing style", "audit prose", "review docs voice and tone", or "check this page against the writing handbook".
Agent文档编写
writing-for-agents
为 agent 编写文档。在创建或编辑技能(skills),或修改 AGENTS.md 或 CLAUDE.md 时使用。
交互式Bash向导生成
wizard
生成一个交互式 bash 向导,引导人工完成只有人才能执行的步骤。适用于配置基础设施、设置凭证或 CI secrets、指引用户操作不熟悉的第三方仪表板,或执行一次性迁移或切换。请勿将其用于 agent 自身即可执行的步骤。
大型任务路径规划
wayfinder
将一大块工作(超出单个 agent 会话所能承载的范围)规划为问题跟踪器上共享的决策工单地图,并逐个解决这些工单,直到通往目标的路径清晰为止。
消息重述澄清
wait-what
停。上一条消息没有被理解:重新表述一遍。
问题与PR分诊
triage
通过分诊角色的状态机流转 issue 和外部 PR,进行分类、验证,必要时深入质询,并撰写可供 agent 直接使用的简报。