name: atomic-commit description: Validate, scope, and prepare one small, evidence-backed Git commit without silently staging unrelated work. Use when a user asks to create, automate, review, or improve commit quality, especially in a dirty repository with multiple workstreams or explicit approval gates.#
Atomic commit
Use this skill to turn an approved, coherent change into one auditable local
commit. Prefer the bundled scripts/commit_gate.py for deterministic checks.
The skill never pushes, creates remotes, runs GitHub mutations, rewrites
history, or commits without explicit approval for the exact subject and file
scope.
Workflow#
- Inspect before staging:
- repository root, branch, HEAD, remotes, upstream, and status;
- staged and unstaged paths separately;
- user-owned untracked files and generated artifacts;
- the requested scope and acceptance evidence.
- Stop if the requested scope is ambiguous, includes unrelated user changes, requires deletion/rewrite, or crosses a remote boundary.
- Run
scripts/commit_gate.py --message "<subject>"to produce a read-only report. Review its proposed file set, diff hygiene, secret scan, and conventional subject checks. - Run the narrowest relevant tests and static checks. Record actual commands and results; never convert unavailable checks into passes.
- Obtain explicit approval immediately before staging and committing. The approval must identify the exact subject and paths.
- Stage only the reviewed paths with
git add -- <paths>. Re-run the gate against the staged diff and inspectgit diff --cached. - Create exactly one normal commit with the approved subject. Do not amend, rebase, reset, sign by changing configuration, bypass hooks, or force any operation.
- Verify the commit parent, subject, changed paths, tree, clean worktree, branch, remotes, and upstream. Do not push unless separately approved.
$flow-atom mode#
Use $flow-atom when the user requests a full end-to-end atomic commit
decision. The agent should inspect the repository, select one coherent scope,
derive or validate the commit subject, run the available project checks, and
produce a decision: READY_TO_COMMIT, BLOCKED, READY_TO_PUSH, or PUSHED.
The mode must:
- refuse ambiguous scopes; an explicit allow-list may coexist with unrelated dirty work, which must be reported and preserved rather than staged;
- preserve unrelated user changes and untracked files;
- run the narrowest relevant checks before staging;
- stage only an explicit reviewed path allow-list;
- revalidate the staged diff;
- create one normal commit only with
--approve-commit; - read back the commit and working tree;
- push only with a separate
--approve-pushand only after verifying the expected branch, remote, and commit identity; - read back the remote SHA after push and report
PUSHEDonly on an exact match; - stop immediately on any mismatch, hook failure, secret finding, or scope expansion.
--approve-push never implies approval to create a remote, alter metadata,
force-push, or modify GitHub resources. The mode never uses --force,
--no-verify, amend, reset, rebase, or destructive recovery.
Commit quality rules#
- Keep one logical purpose per commit; split unrelated hierarchy, application, formatting, and generated changes.
- Use a short imperative Conventional Commit subject:
type: description. - Do not stage
.env, credentials, private keys, model weights, datasets, generated reports, caches, or execution-state files. - Preserve user-owned untracked files; never use
git add .as a shortcut. - Treat
docs/specification/and other authoritative sources as protected unless the request explicitly authorizes them. - For requirement-driven work, report affected T/FR/NFR/AC identifiers and executed evidence in the commit handoff or pull request.
- A clean validation report does not itself authorize a commit or push.
Safe command patterns#
Read-only preparation:
uv run --locked python .agents/skills/atomic-commit/scripts/commit_gate.py \
--message "docs: update approved hierarchy contract"
Full decision flow, still stopping before mutation:
uv run --locked python .agents/skills/atomic-commit/scripts/commit_gate.py \
--flow-atom \
--message "docs: update approved hierarchy contract" \
--path docs/backlog/github-manifest.json
Only after the user approves that exact path, subject, commit, and push may
the executor add --approve-commit --approve-push.
After explicit approval, use an explicit path list, then revalidate:
git add -- docs/backlog/github-manifest.json docs/backlog/GITHUB_EXECUTION_PLAN.md
uv run --locked python .agents/skills/atomic-commit/scripts/commit_gate.py \
--message "docs: update approved hierarchy contract" --staged-only
git diff --cached --check
git commit -m "docs: update approved hierarchy contract"
The skill stops before git commit unless the user has approved that exact
operation. It never invokes git push.
Failure handling#
- Unexpected paths: stop and list them; do not unstage or delete automatically.
- Secret or credential match: stop and ask for review.
- Validation failure: report the command and failure; do not commit.
- Hook or signing failure: preserve the staged state and report it; do not use
--no-verifyor alter signing configuration. - Remote or upstream mismatch: stop; remote publication is a separate gate.
Resource#
Use scripts/commit_gate.py for deterministic, read-only scope and hygiene checks before and after staging.