When to Use
Invoke this skill when:
- •There are many unstaged/staged changes across multiple files
- •You want to split changes into logical, related commits
- •You need help organizing messy working trees into clean git history
Process
Phase 1: Analyze Changes
- •Run
git statusto see all modified, added, and deleted files - •Run
git diffto inspect the actual content changes in each file - •Run
git diff --stagedto inspect any already-staged changes - •Run
git log --oneline -5to understand the recent commit style
Phase 2: Group Related Changes
Analyze all changes and group them by logical concern. Grouping criteria (in priority order):
- •Same feature/functionality -- files that work together for one feature
- •Same type of change -- e.g., all dependency updates, all config changes
- •Same domain/module -- changes within the same feature directory
Guidelines for grouping:
- •Each commit should be independently meaningful
- •A commit should not break the build if checked out alone
- •Prefer smaller commits over larger ones
- •Keep unrelated changes in separate commits
- •Config/dependency changes go in their own commit
- •Test changes can go with their corresponding implementation OR in a separate commit
Phase 3: Plan Commits
Present a numbered plan to the user before executing. For each proposed commit:
- •List the files to include
- •Show the proposed commit message (conventional format)
- •Brief rationale for the grouping
Format:
code
Commit Plan =========== 1. <type>: <description> Files: file1.ts, file2.ts Reason: <why these belong together> 2. <type>: <description> Files: file3.ts Reason: <why this is separate> ...
Wait for user approval before proceeding.
Phase 4: Execute Commits
For each approved commit:
- •Stage only the specific files for that commit using
git add <file1> <file2> ... - •For partially staged files (where only some changes in a file belong to this commit), use
git add -palternatives or stage the whole file in the most logical commit - •Create the commit with a conventional commit message
- •Verify with
git statusthat remaining changes are correct
Commit Message Format
Follow conventional commits strictly:
code
<type>[optional scope]: <description> [optional body]
Types:
- •
feat-- new feature - •
fix-- bug fix - •
refactor-- code restructuring without behavior change - •
style-- formatting, whitespace, semicolons - •
docs-- documentation only - •
test-- adding or updating tests - •
build-- dependencies, build config, CI - •
perf-- performance improvements - •
chore-- maintenance tasks
Rules:
- •Description in lowercase, imperative mood ("add" not "added" or "adds")
- •No period at the end
- •Under 72 characters for the first line
- •Add scope when it clarifies the change (e.g.,
feat(auth): add password reset redirect) - •Add exclamtion point before
:for breaking changes
Phase 5: Summary
After all commits are created, show:
code
Commits Created =============== <hash> <type>: <description> (N files) <hash> <type>: <description> (N files) ... Total: N commits, M files changed Remaining unstaged: <count or "none">