一键导入
commit-unstaged-changes
Stage unstaged changes into one or more atomic git commits with project-compliant commit messages
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Stage unstaged changes into one or more atomic git commits with project-compliant commit messages
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Stage unstaged working tree changes into one or more atomic commits with git-stage-batch. Use when the user wants Codex to split unstaged edits into a clean commit series with project-compliant commit messages. Do not use for already-staged changes or for generic git help.
Decompose unstaged working-tree changes into narrow concerns, peel them into git-stage-batch batches, rebuild as a fine-grained atomic commit series, or polish an already-built series
Decompose unstaged working-tree changes into a clean commit series by identifying narrow product, workflow, or architectural concerns, peeling them into git-stage-batch batches, rebuilding atomic commits, or polishing an already-built series.
Draft an algorithm-optimized tweet thread announcing the latest release.
Commit the current staged index as one project-compliant git commit. Use when the user has already staged the exact changes they want to commit and wants help inspecting that staged set, drafting a compliant message, and creating the commit. Do not use for splitting or staging unstaged changes.
Commit the current staged index as one project-compliant git commit. Use when the user has already staged the exact changes they want to commit and wants help inspecting that staged set, drafting a compliant message, and creating the commit. Do not use for splitting or staging unstaged changes.
| name | commit-unstaged-changes |
| description | Stage unstaged changes into one or more atomic git commits with project-compliant commit messages |
Use this skill to turn the current unstaged working tree into one or more atomic commits with messages that match project conventions.
/commit-unstaged-changes
This skill is autonomous and non-interactive. It should inspect the working
tree, use git-stage-batch to stage related changes, create one or more
commits as needed, and then stop without asking the user to review each
message first.
Do not broaden or collapse the commit plan merely because the staging work looks tedious, mixed files require line-level selection, or the analysis is taking longer than expected. "To keep this tractable", "to reduce tool calls", "to avoid backtracking", or similar rollout-efficiency reasoning is explicitly invalid in this skill. If the right split is clear, keep following it. If the right split is not clear enough to execute safely, stop and report the ambiguity or blocker instead of inventing a coarser history.
If the remaining split is clear but the next staging step is intricate, do not
stop merely because it involves repeated show --file inspection, line-level
staging, --as replacements, batch peeling, temporary restaging of the
index, or other careful execution work. Those are normal costs of this skill,
not blockers. Before stopping, identify one concrete blocker:
git-stage-batch bug or incorrect staged resultIf none of those apply, continue staging. If you can name the exact next
git-stage-batch, git diff --cached, or git show :path command you would
run to keep splitting the current commit, you should usually run it rather
than stopping.
This skill is written for Claude Code. Use Claude Code's normal file-reading
and search tools directly, and use Agent(Explore) only for read-only
parallel investigation that materially improves the commit split or message
quality.
To keep long staging sessions from polluting the context used for commit
message writing, use the shared commit-message-drafter agent after the
current commit is fully staged. That reusable agent lives separately from this
skill so future commit-oriented skills can share it without moving files
around. It should only draft the message. The main skill remains responsible
for checking the draft against repository rules, creating the commit, and
deciding whether the series narrative is still correct.
If git-stage-batch is available directly in PATH, use it. If it is not,
fall back to pipx run git-stage-batch.
If a required git or git-stage-batch command hits a Claude Code permission
request, approve and continue the intended workflow instead of treating the
request itself as a blocker or changing the commit structure to avoid it.
Apply the same split logic in every repository. Do not anchor the decision to project-specific nouns such as assistant names, package names, subsystem names, or filenames. First normalize the diff into generic behavior axes, then split on those axes.
Use these generic axes:
Every code change must be assigned to exactly one of those axes before staging begins. If a planned commit still contains code from more than one non-validation axis, split it by default.
Examples are evidence, not scope. If the skill says to split stale-source adopters or filter-vs-surface work in one repository, apply the same abstract rule to analogous diffs in every other repository even when the nouns differ.
Distinguish abstract capability families from concrete implementations. Do not treat one high-level category such as database support, authentication support, assistant support, cloud support, or storage backends as a single concern by default. Adding one concrete implementation under that category is a separate concern from adding a second implementation under the same category.
Examples of concrete implementations include:
These distinctions apply equally to data-only additions such as skill definitions, agent configurations, templates, and bundled manifests. Files organized under platform-specific sibling directories or targeting different tool families are separate asset groups even when they provide the same logical capability or share identical internal structure. Platform boundary is an asset-group boundary by default.
If a diff adds or changes two or more concrete implementations, assume the correct split is:
Shared purpose at the category level is not enough to combine them. "database support", "authentication support", "assistant assets", or similar umbrella wording is too broad when the diff contains separate implementation-specific paths.
When a rule below says a broader commit is allowed only if separating it would leave an "intermediate commit" broken, apply that phrase narrowly. A broken intermediate commit is one where the repository would fail in a concrete, immediate way after the narrower commit lands, such as a missing import, missing symbol reference, broken parser dispatch, necessarily failing test in that commit, invalid persisted shape, or missing packaged or install-time asset.
The following do not count as a broken intermediate commit:
Before keeping any commit that touches more than one plausible axis or more than one independently testable behavior, run this mandatory falsification test in your working notes:
If you cannot answer step 2 concretely, the broader commit is forbidden. The fact that two implementations satisfy the same abstract feature goal does not count as coupling.
git status --short.git-stage-batch check-unstaged to check whether the index is
suitable for this unstaged-only workflow.check-unstaged fails, stop and tell the user this skill only handles
unstaged changes. Do not commit the staged set, and do not use
git-stage-batch to add more changes on top of it. If it succeeds with a
staged-deletion and/or start-time rename notice, continue; start
normalizes those file-level states into workflow content.CONTRIBUTING.md when present, and inspect .git/hooks/commit-msg
when present, so commit prefixes, body format, trailers, and validation
rules come from the repository rather than guesswork. Verify the hook path
with a direct filesystem check such as LS .git/hooks or equivalent; do
not infer its absence from tracked-file searches alone.tests: or docs: commits
that only touch those directories, split the series that way before any
staging begins instead of discovering the rule at commit time.claude-skills/ and
codex-skills/, postgresql/ and mariadb/, aws/ and
gcp/). Platform boundary is an asset-group boundary.and, also,
as well as) and no semicolons. An umbrella phrase that avoids
conjunctions only by being vague still fails.Agent(Explore) to gather read-only
context in parallel before staging anything.git-stage-batch commands to stage only the changes for the current
commit.Agent(commit-message-drafter) and give
it the fully staged diff plus the exact constraints listed below. Use the
agent's draft as input, not as an unquestioned final answer.git-stage-batch session with git-stage-batch stop.and, also, as well as, or a
semicolon to describe the purpose, you have two commits, not one. Split
first, then stage. This self-test is mandatory for every commit in the
series.--files when the commit only covers a coarse subset of changed paths. Use
per-hunk skip only after that narrower pass is in place.include --files as a high-trust action. Only use it when every
changed line in every matched file belongs to the current planned commit, or
when earlier peeling has removed later-concern lines from those files.skip --files differently from include --files. Skipping a path
group is a safe way to postpone unrelated files after the current commit's
path scope is known. Including a path group is a claim that the full diff of
every matched file already belongs to the current commit.include --line and skip --line.discard --to BATCH earlier when the selected concern is easier to
express as "remove this later layer from the working tree for now" than as
"stage the earlier layer directly."--file --as-stdin would require
reconstructing too much earlier text by hand.--file --as-stdin when one file's exact current-commit content is
easy to write directly and there is no need to preserve the removed layer as
a reusable deferred unit.git add -p or git commit -a. Use git-stage-batch for
staging decisions.Bad split:
backend: add database supportauth: add authentication supportassets: add assistant assetsBetter split:
state: or core: add shared backend-selection plumbingpostgres: add PostgreSQL supporttests: cover PostgreSQL supportdocs: document PostgreSQL supportmariadb: add MariaDB supporttests: cover MariaDB supportdocs: document MariaDB supportBetter split:
state: or core: add shared account lookup plumbingpam: add PAM authenticationtests: cover PAM authenticationdocs: document PAM authenticationpasswd: add /etc/passwd authenticationtests: cover /etc/passwd authenticationdocs: document /etc/passwd authenticationBetter split:
cli: add selection semantics for an existing install surfacetests: cover that selection behaviorassets: add one concrete asset groupcommands: install that asset grouptests: cover that install pathdocs: document that asset groupUse Agent(Explore) for read-only parallel investigation when it materially
improves the commit split or message quality.
Agent(Explore) for editing, staging, or committing.Identify which files in this diff belong to the same user-facing change.Check whether these refactors are prerequisites for a later feature in the same series.Summarize commit-prefix patterns for the touched files.Agent(Explore) as optional acceleration, not a required step for
small or obvious changes.Use Agent(commit-message-drafter) when the commit is already staged and the
main skill would benefit from a fresh context for message drafting. Treat that
agent as shared infrastructure for commit-related workflows, not as something
owned only by this skill.
git diff --cached, relevant git log history,
CONTRIBUTING.md, and .git/hooks/commit-msg if presentAlways pass --no-optional-locks to read-only git commands such as
git status, git diff, git log, and git show. Without this flag,
git refreshes cached filesystem metadata in the index, which requires
.git/index.lock. When Claude Code runs multiple read-only git commands
in parallel — which it does by default for concurrency-safe tools — two
stat-refreshing commands race for that lock and one fails.
Claude Code's own internal git commands already use this flag, but commands run through BashTool do not get it injected automatically.
# correct
git --no-optional-locks status --short
git --no-optional-locks diff HEAD
git --no-optional-locks log --oneline -5
git --no-optional-locks diff --cached
# incorrect — will race when parallelized
git status --short
git diff HEAD
This applies to every git invocation in the skill that does not need to
modify the index. Commands that intentionally write to the index — such
as git commit, git add, or git apply --cached — must not use this
flag.
git-stage-batch WorkflowUse the non-interactive subcommands rather than interactive mode.
Before starting a git-stage-batch session, run
git-stage-batch check-unstaged. Do not start the session if that command
fails. A passing staged-deletion and/or start-time rename notice is allowed;
start presents those file-level states as workflow content alongside the
remaining unstaged work.
Treat that allowance narrowly. The staging area is allowed here only as an intent channel for file-level states that the workflow cannot otherwise infer reliably. Do not pre-stage ordinary additions, modifications, or mixed content to steer the split.
git-stage-batch start
git-stage-batch show
git-stage-batch status
Use show to view the current hunk and status to understand progress and
skipped work.
git-stage-batch show --files 'src/**' 'tests/**'
git-stage-batch include --files 'docs/**'
git-stage-batch skip --files 'vendor/**'
Use --files with gitignore-style patterns when the current commit should
cover a coarse subset of changed files. This narrows the pass, but it does not
replace line classification inside mixed hunks.
git-stage-batch include
Use this when the whole hunk belongs in the current commit.
git-stage-batch include --line 1,3,5-7
git-stage-batch include --line 4-9 --as $'replacement\ntext'
git-stage-batch include --file path/to/file.py --as-stdin < replacement.txt
Line numbers refer to the hunk lines shown by show, numbered starting at 1.
Use line-level staging whenever a hunk mixes changes that belong in different
commits.
When replacement text comes from generated output or file-backed content,
prefer --as-stdin over --as so exact bytes, including trailing newlines,
are preserved. Reserve --as for short inline literals typed directly in the
command.
Prefer a named batch instead when the right split is "remove this later layer
for now" rather than "write the exact whole-file text for this commit."
git-stage-batch discard --to codex-layer
git-stage-batch again
# make any small cleanup edits needed so the remaining tree is coherent
git-stage-batch include ...
git commit ...
git-stage-batch include --from codex-layer
Use a named batch when direct line-level staging or --file --as-stdin would
leave an invalid intermediate shape or require reconstructing too much text by
hand. Name the batch after the peeled concern, such as mariadb-layer,
codex-layer, or docs-layer, not a generic scratch label.
Do not stop to annotate a short-lived batch that will be reapplied in the
next one or two steps when the batch name already captures the deferred
concern. Add a note with -m, --note, or annotate when the batch will
persist across multiple commits, when several batches are active, or when the
peeled layer is subtle enough that its purpose may be forgotten.
git-stage-batch skip
git-stage-batch skip --line 2-4
git-stage-batch skip --file
Use skip for changes that do not belong in the current commit.
git-stage-batch again
Use this after creating a commit when skipped hunks should be reconsidered for the next commit in the series.
git-stage-batch stop
Only stop the session after all commits in the series have been created.
Between commits, use git-stage-batch again to revisit skipped work — do
not stop and restart. Run stop once at the very end.
For each commit:
git-stage-batch check-unstaged.git-stage-batch start.show. Read the changed lines and
classify each one by which concern it serves.include. If only some lines belong, use include --line to stage exactly
those lines. If no lines belong, use skip, skip --file, or
skip --file FILENAME.Agent(commit-message-drafter), then review it against the rules below.git-stage-batch again and build the next
commit.git-stage-batch stop.Re-read this template before writing each commit message in a multi-commit series. Fill in each bracketed section. Do not merge or skip paragraphs.
prefix: Summary under 68 chars
[Present-tense description of what the project, file, or interface
currently has or provides. Do not mention the patch or what is
missing yet.]
[Description of what is missing, broken, or insufficient — and why
that matters. Use first-person maintainer perspective for internal
concerns, user perspective for external ones. Never refer to
maintainers in the third person.]
This commit [addresses|mitigates|resolves] that [problem] by [precise
description of what this commit changes and how it solves the problem
stated above].
[Connect to what comes next, or conclude the series when this is the final
commit. For the penultimate commit, refer to the upcoming final commit in the
singular, such as "The final commit will ...", instead of saying "subsequent
commits". For the final commit, use this paragraph to state that the series
goal has been reached.]
The most common errors are:
but or howeverThis commit ...Check for all three before committing.
Write for drive-by reviewers with limited context. You are the maintainer — write to a casual reader who does not know the codebase well. Never refer to maintainers in the third person.
Every commit message should use this shape:
prefix: Concise summary of the change
First paragraph describing the selected project state.
Second paragraph describing the underlying problem.
Third paragraph describing how this commit addresses that problem.
Fourth paragraph for follow-up or final series conclusion when useful.
cli:, docs:, tests:, build:,
skills:, or another prefix established by history.git log --pretty=oneline -- <file> for affected files if the prefix
is not obvious.This commit addresses that by ...This commit begins adding support for ... by ...This commit continues that work by ...This commit completes that series by ...The final commit will ..., instead of saying
subsequent commits.this when referring to the commit itself.Co-Authored-By lines for AI assistance.Do not use these words in commit messages:
comprehensivecrucialrobustpowerfulseamlessintuitiveeasysimplecleanelegantflexiblescalableefficientefficientlyimprovedimprovesbetterbestsimplyjustobviouslyclearlyBefore committing, verify:
and, also, or describes two actions, the
commit combines concerns. Do not commit it.This commit and describes how it addresses
the problem.After creating the final commit, report back with: