Commit skill
Create small, reviewable conventional commits from the requested worktree(s).
Scope, and how this differs from the commits skill
This skill is the salvage path: someone hands you an existing dirty
worktree and asks for it to be committed. You did not author those changes in
this session, so the only available grouping evidence is the diff itself, and
the steps below derive the plan from changed hunks.
The separately selected commits skill is the authoring path. When this
session is writing the code, that skill owns the work: it derives a numbered
Feature ledger from the user's request sentences and commits each Feature as it
is finished, so a commit boundary is decided before the diff exists.
The two must not run against the same work:
- Session is authoring the change → follow
commits. Do not re-plan its
Features from the accumulated diff, and do not defer its commits so this
skill can batch them at the end.
- Change already exists and was not authored here → follow this skill.
- Both selected and both apparently applicable →
commits wins for anything it
has a ledger entry for; this skill covers only the leftover pre-existing
changes.
Isolation, branch policy, merging, and reapplication belong to the worktree
skill in every case. The temporary detached worktree in step 6 is a throwaway
validation checkout, not a task worktree; create it outside the repository and
remove it in the same step.
Workflow
Inspect every requested repository before staging:
git rev-parse HEAD
git status --short
git diff --stat
git diff --staged --stat
git diff
git diff --staged
git ls-files --others --exclude-standard
Read relevant untracked files. If anything is already staged, rebuild the
index with git restore --staged -- :/ and inspect again.
Print a numbered plan covering every changed hunk. Group by purpose, not by
filename. Keep implementation, its focused tests, and required docs or
installer changes together. Mark mixed files as partial.
Start plan item 1 immediately. The plan is not an approval checkpoint.
Never ask whether to proceed or wait for confirmation.
Stage only the current group. Use exact paths or interactive patch mode:
git add -- path/to/file
git add -p -- path/to/mixed_file
Never use git add ., git add -A, git add -u, or stage a whole mixed
file. Check the staged and unstaged sides after partial staging.
Before committing, verify:
git diff --staged --name-status
git diff --staged --stat
git diff --staged --check
git status --short
Confirm that every staged hunk belongs to this plan item, every staged test
has its implementation, and later groups remain unstaged.
Validate the staged snapshot, not the dirty worktree. Apply only the staged
patch to a temporary detached worktree based on the starting commit and run
the narrowest relevant tests, lint, type, or build checks. Remove the
temporary worktree afterward.
Create one conventional commit for the group, then repeat steps 4–6:
git commit -m "type(scope): short description" \
-m "Explain what this group changes and why."
Allowed types: feat, fix, refactor, chore, docs, style, test,
perf. Use the repository's configured identity. Never amend, rebase,
reset, stash, force-push, skip hooks, or use --no-verify.
Finish by verifying git show --stat --oneline HEAD and git status --short.
Report every hash and subject, the files or hunks in each commit, and any
intentionally uncommitted changes with the concrete reason.
Safety rules
- Cover every repository the user named; do not silently stop after one.
- Do not commit secrets, credentials,
.env files, logs, caches, generated
output, editor state, or unrelated user changes.
- Do not modify source files while composing commits; stage existing changes
only.
- A commit must work without later commits or unstaged worktree changes.
- If no safe coherent grouping exists, stop and explain the blocker.
1---2name: commit3description: Use when the user asks to commit work that already exists in a dirty worktree: inspect the changes, split that diff into logical commits, stage hunks, and create the commits. Plan every requested repository and execute the complete commit run in the same response. Not for work this session is still authoring — the `commits` skill owns that.4---56# Commit skill78Create small, reviewable conventional commits from the requested worktree(s).910## Scope, and how this differs from the `commits` skill1112This skill is the **salvage** path: someone hands you an existing dirty13worktree and asks for it to be committed. You did not author those changes in14this session, so the only available grouping evidence is the diff itself, and15the steps below derive the plan from changed hunks.1617The separately selected `commits` skill is the **authoring** path. When this18session is writing the code, that skill owns the work: it derives a numbered19Feature ledger from the user's request sentences and commits each Feature as it20is finished, so a commit boundary is decided before the diff exists.2122The two must not run against the same work:2324- Session is authoring the change → follow `commits`. Do not re-plan its25 Features from the accumulated diff, and do not defer its commits so this26 skill can batch them at the end.27- Change already exists and was not authored here → follow this skill.28- Both selected and both apparently applicable → `commits` wins for anything it29 has a ledger entry for; this skill covers only the leftover pre-existing30 changes.3132Isolation, branch policy, merging, and reapplication belong to the `worktree`33skill in every case. The temporary detached worktree in step 6 is a throwaway34validation checkout, not a task worktree; create it outside the repository and35remove it in the same step.3637## Workflow38391. Inspect every requested repository before staging:4041 ```bash42 git rev-parse HEAD43 git status --short44 git diff --stat45 git diff --staged --stat46 git diff47 git diff --staged48 git ls-files --others --exclude-standard49 ```5051 Read relevant untracked files. If anything is already staged, rebuild the52 index with `git restore --staged -- :/` and inspect again.53542. Print a numbered plan covering every changed hunk. Group by purpose, not by55 filename. Keep implementation, its focused tests, and required docs or56 installer changes together. Mark mixed files as `partial`.57583. Start plan item 1 immediately. The plan is not an approval checkpoint.59 Never ask whether to proceed or wait for confirmation.60614. Stage only the current group. Use exact paths or interactive patch mode:6263 ```bash64 git add -- path/to/file65 git add -p -- path/to/mixed_file66 ```6768 Never use `git add .`, `git add -A`, `git add -u`, or stage a whole mixed69 file. Check the staged and unstaged sides after partial staging.70715. Before committing, verify:7273 ```bash74 git diff --staged --name-status75 git diff --staged --stat76 git diff --staged --check77 git status --short78 ```7980 Confirm that every staged hunk belongs to this plan item, every staged test81 has its implementation, and later groups remain unstaged.82836. Validate the staged snapshot, not the dirty worktree. Apply only the staged84 patch to a temporary detached worktree based on the starting commit and run85 the narrowest relevant tests, lint, type, or build checks. Remove the86 temporary worktree afterward.87887. Create one conventional commit for the group, then repeat steps 4–6:8990 ```bash91 git commit -m "type(scope): short description" \92 -m "Explain what this group changes and why."93 ```9495 Allowed types: `feat`, `fix`, `refactor`, `chore`, `docs`, `style`, `test`,96 `perf`. Use the repository's configured identity. Never amend, rebase,97 reset, stash, force-push, skip hooks, or use `--no-verify`.98998. Finish by verifying `git show --stat --oneline HEAD` and `git status --short`.100 Report every hash and subject, the files or hunks in each commit, and any101 intentionally uncommitted changes with the concrete reason.102103## Safety rules104105- Cover every repository the user named; do not silently stop after one.106- Do not commit secrets, credentials, `.env` files, logs, caches, generated107 output, editor state, or unrelated user changes.108- Do not modify source files while composing commits; stage existing changes109 only.110- A commit must work without later commits or unstaged worktree changes.111- If no safe coherent grouping exists, stop and explain the blocker.