Use this workflow in order: preflight -> split plan -> classify -> compose -> commit/draft -> verify.
1. Preflight
- Inspect
git status --short,git diff --staged --stat, andgit diff --staged. Ifrtkis available, preferrtk git statusandrtk git diff --stagedfor model-visible inspection. - Explicitly note whether there are:
- staged changes ready to commit
- unstaged changes that might make the index misleading
- untracked files that are intentionally excluded vs accidentally forgotten
- Branch immediately on preflight results:
- No staged changes: stop and tell the user to stage files first.
- Staged changes exist but the staged set is obviously mixed and cannot be safely separated from inspection alone: do not improvise a commit. Output a split plan and stop.
- The user explicitly asked only for commit text, a draft, or suggestions: continue through classification and composition, but do not run
git commit.
2. Split Plan
- Treat split planning as a safety step, not a formatting nicety.
- Group staged changes by one coherent unit at a time, usually one of:
- a single feature or fix
- one module or package
- code vs docs vs tests when staged together by accident
- If the split is clean and obvious, explain the planned commit boundaries before composing messages.
- If the split is ambiguous, stop at the plan. Do not unstage, restage, or commit mixed work just to produce a message.
- Read references/split-strategy.md when deciding whether a staged set is safe to keep together.
3. Classify
- Choose
type, optionalscope, emoji policy, and whether!/BREAKING CHANGEis required. - Use references/commit-types.md for type and emoji mapping.
- Use references/message-rules.md for subject, body, footer, issue, and breaking-change rules.
- Default to emoji because this repository expects it. Only opt out when the user explicitly requests no emoji.
- Keep
typein English. Prefer Chinese forscope,subject,body, and explanatory output unless the user clearly asked for English.
4. Compose
- Generate the final message with
python "$SKILL_DIR/scripts/compose_commit_message.py" .... - Use:
--body-linefor body content--closesfor closing issues--refsfor non-closing issue references--footer-linefor other structured trailers such as Jira references--breaking-headerwhen the header itself must include!--breakingwhen aBREAKING CHANGE:trailer is needed--no-emojionly when the user explicitly opts out
- Never hand-roll a multiline commit message when the script can express it safely.
- PROHIBITED: Never include
Co-Authored-By, attribution lines, or push commands by default.
5. Commit Or Draft
- If the user asked only for a draft, return the proposed commit text and stop.
- If the user asked to commit and the staged set is safe, write the message to a file and commit with
git commit -F <message-file>so PowerShell and POSIX shells behave consistently. - If
rtkis available and the user wants compact feedback,rtk git commit -F <message-file>is acceptable for the final commit step. - Do not push by default. Only discuss or run
git pushif the user explicitly asked for it.
6. Verify
- Read the
git commitoutput before claiming success. - If hooks reject the commit, stop immediately and report the original hook failure. Do not silently rewrite the message unless the output clearly says the message format is invalid and the user asked you to fix it.
- After a successful commit, summarize:
- the final header
- whether emoji was included
- whether issues or breaking changes were attached
- If you stopped before committing, say exactly why: no staged changes, ambiguous split, or draft-only request.
References
- references/commit-types.md for commit type and emoji mapping
- references/message-rules.md for message structure and trailers
- references/split-strategy.md for staged split heuristics and stop conditions