smart-commit
Automatically cluster and commit git changes into logical groups with conventional commit messages. Use when: committing multiple unrelated changes, cleaning up work before PR, organizing messy commit
Files1
View on GitHubSKILL.mdskills/smart-commit/SKILL.md
GitHubSmart Commit
Cluster uncommitted changes into logical groups and commit each with a clear conventional commit message.
Sub-agents. Committing is sequential by design — every commit shares one git index, so parallel sub-agents staging into it would corrupt each other. Do the clustering and commits in one agent. (For a very large diff you may use a sub-agent to propose the clustering, but the
git add/git commitsteps stay in the main agent.)
Flags
| Flag | Effect |
|---|---|
--no-coauthor |
Omit any Co-Authored-By trailer from every commit message this run |
Follow the repo's own convention by default: if recent commits carry a Co-Authored-By
trailer, match them; if none do, don't add one. --no-coauthor forces it off regardless.
Workflow
- Run
git statusandgit diffto inspect all uncommitted changes - Check for pre-staged changes with
git diff --cached. If anything is already staged, don't fold it into clusters silently — commit it as its own commit (it was likely staged deliberately) or ask the user what to do with it - Analyze changes and cluster into logical groups by:
- Feature or functionality
- Bug fix
- Related files (e.g., component + its test + its styles)
- Type (docs, config, refactor, etc.)
- If a single file contains changes belonging to different clusters, assign
it to the most related cluster and mention the extra change in the commit
body (interactive
git add -pis not available)
- For each logical group:
- Stage relevant files:
git add <files> - Generate conventional commit message (see format below)
- Commit:
git commit -m "<message>"
- Stage relevant files:
- Repeat until all changes are committed
- Docs drift check (see below)
- Update
CHANGELOG.mdunreleased section (see below), then commit:docs: update changelog
Commit Message Format
Use conventional commits: <type>(<scope>): <description>
Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build
Examples:
feat(auth): add password reset flowfix(api): handle null response from users endpointrefactor(utils): extract date formatting helpersdocs: update README installation steps
Docs Drift Check (Step 6)
After all code commits are made, check whether the change made existing docs stale:
- From the commits just created, identify user-facing surface changes: CLI flags/commands, config options, install/setup steps, public API, renamed files or skills, changed defaults. If there are none (pure refactor/test/internal), skip this step silently.
- Grep the now-stale terms (old flag names, old commands, old paths) across
README.mdanddocs/(and any other tracked doc the repo's instruction file points at). - Update only what the diff invalidated — surgical edits, no rewrites or reorganizing.
- Stage and commit:
git commit -m "docs: sync docs with <change>"(or fold into the changelog commit if both are one-liners).
This step fixes docs the change broke; it does NOT write new guides or lessons — that is
reflect's job. If the project's instruction file forbids doc edits, skip.
Changelog Update (Step 7)
After all commits are made, update the ## [Unreleased] section of CHANGELOG.md:
- Review all commits just created (use
git logto see them) - Write concise changelog entries grouped under Keep a Changelog sections:
### Added— new features or capabilities### Changed— changes to existing functionality### Fixed— bug fixes### Improved— enhancements to existing features### Removed— removed features
- Classify each entry as public or internal:
- Public: User-facing features, behavior changes, critical bug fixes
- Internal: Refactors, test changes, lint fixes, DX improvements, infra plumbing
- Format internal entries under an
#### Internalheading with<!-- internal -->:### Added - **Feature name**: User-facing description #### Internal <!-- internal --> - Implementation detail that users don't need to see - Stage and commit:
git add CHANGELOG.md && git commit -m "docs: update changelog"
If CHANGELOG.md doesn't exist or has no ## [Unreleased] section, skip this step.
After Committing
If this session involved tricky bugs, new integrations, or non-obvious patterns, suggest
running the reflect skill to capture lessons learned.
Rules
- Keep commit messages under 72 characters
- Use imperative mood ("add" not "added")
- One logical change per commit