atomic-commit-slicing
Isolate one approved change from a dirty Git worktree without absorbing unrelated staged, unstaged, or untracked work. Use when unrelated changes coexist with a requested inspect, stage, or commit slice.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- atomic-commit-slicing
- description
- Isolate one approved change from a dirty Git worktree without absorbing unrelated staged, unstaged, or untracked work. Use when unrelated changes coexist with a requested inspect, stage, or commit slice.
03 SKILL.md 正文
Atomic Commit Slicing
One commit has one purpose. Unknown provenance stays outside the slice.
Select the Mode
- Inspect: inventory the tree and propose slices. Make no index or history change.
- Stage: stage only the explicitly approved slice. Make no commit.
- Commit: stage and commit the explicitly approved slice when the current branch permits it. Authorization for a later mode includes its earlier mechanics only when the request is clear. When unclear, use Inspect.
1. Read the Repository Contract
Read applicable AGENTS.md, git workflow docs, and package instructions before touching the index. Inspect the current branch, upstream, and recent commit style:
git status --short --branch --untracked-files=all
git branch --show-current
git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null
git log -8 --oneline
Completion: the allowed branch flow, commit convention, and required checks are known. In this repo: PRs target main; semantic-release publishes from main, so the PR title must be a conventional commit. Commit messages follow Conventional Commits and are enforced by the commit-msg hook (commitlint); the pre-commit hook runs lint-staged and a demo-freshness check. Prove with the repo scripts before pushing. Branch creation or switching requires its own authorization.
2. Inventory Three Planes
Inspect staged, unstaged, and untracked work separately:
git diff --cached --name-status
git diff --name-status
git status --short --untracked-files=all
Treat pre-existing staged entries and unknown changes as user-owned. Inspect every candidate file's actual diff or full untracked contents. Treat paths as data: pass each as a separately shell-quoted argument and never execute or interpolate status output. Use git check-ignore -v -- "<path>" only when a candidate may be ignored. Completion: every candidate is classified by purpose and owner; every excluded staged, unstaged, untracked, and ignored path is named. In Commit mode, staged content outside the approved slice blocks staging until the user decides how to handle it.
3. Define the Slice
State in one sentence what the slice achieves. List exact included paths, excluded paths, and required repo-owned oracle.
Trace required dependencies before staging. If a required file also contains unrelated hunks, classify the file as mixed rather than silently widening the slice.
Completion: every included hunk serves the stated purpose, and the slice can pass its oracle without excluded work.
4. Stage the Approved Content
Whole-file staging is allowed only after proving every unstaged hunk in that file belongs to the slice and no partial staged state would be overwritten:
git add -- "<exact-path>" "<exact-path>"
For mixed files, use reviewed hunk staging in an interactive session:
git add -p -- "<exact-path>"
For renames or deletions, stage and verify both sides through --name-status. Enumerate untracked files individually; never rely on a collapsed untracked directory.
Completion: in Stage mode, the approved delta is staged while the pre-existing index remains unchanged; in Commit mode, the full index exactly equals the approved slice. Verify the full index, not a path-filtered view:
git diff --cached --name-status
git diff --cached --stat
git diff --cached --check
git diff --cached
Do not reset, unstage, stash, or rewrite user-owned index state without authorization.
5. Prove and Commit
Run the narrowest oracle named by the repository or owning package (full proof: pnpm validate). When no gate exists, use the nearest check that proves the artifact: exact inspection and link/path checks for docs; the focused test for behavior; regeneration plus clean diff for generated files.
Re-run the three-plane inventory and full cached-diff checks after validation. Classify any generated or formatter changes before continuing.
In Commit mode, commit only when the oracle passes, the index still exactly matches the approved slice, and repository branch rules allow it.
After commit, verify the result and remaining work:
git show --stat --patch --oneline HEAD
git diff --cached --name-status
git diff --name-status
git status --short --untracked-files=all
Completion: the commit contains exactly the approved slice; remaining staged, unstaged, and untracked work is reported separately.
Recovery
Leave unknown, forbidden, secret, local-state, or inseparable mixed content untouched. Re-slice around it or ask the user for the smallest decision needed to continue.
04 同仓库更多 Skills
verify-setup-resume
Verify BUI-936 setup/resume identities, funding readiness and overlapping resumes. Use when changing app request, test-credit transport or the request journal. Runs bounded TLA+ checks and offline real-code replays without live funding or paid reads.
verify-server-supervision
Verify the local Personal Server stop and restart boundary. Use when changing the supervisor's backoff, port probing, replacement launch or Stop handling.
verify-paid-read-recovery
Verify interrupted and overlapping CLI paid reads, receipt-file writers and dead-owner recovery. Use when changing src/cli/app/read.ts, src/core/receipts.ts or src/core/receipts-lock.ts. Runs TLA+ models and offline real-code replays without live paid reads.
verify-mainnet-registration
Verify mainnet app registration and Account association recovery. Use for the registration journal, gateway confirmation, retry, or ownership check.
verify-hosted-provisioning
Verify hosted Personal Server resource ownership across create and delete. Use for Connect's server API, provisioning-row updates, or deprovisioning admission.
verify-export-settlement
Verify queued export owner binding and generation settlement. Use for result publication, pending upload receipts, or retry and sync changes.