Guided git commit with atomic commit analysis and conventional commit format
Guides git commits with atomic analysis and conventional commit formatting.
/plugin marketplace add jpoutrin/product-forge/plugin install git-workflow@product-forge-marketplace[--all | --staged | --interactive]Category: Development
commit [--all | --staged | --interactive]
--all: Analyze all uncommitted changes (staged + unstaged)--staged: Only analyze currently staged changes (default)--interactive: Guide through staging changes atomically before committingThis command delegates to the commit-expert agent (Haiku model) for fast, cost-effective execution.
Delegation: Use the Task tool with:
subagent_type: "git-workflow:commit-expert"prompt: Include the mode (--staged, --all, or --interactive) and current working directoryExample:
Task(subagent_type="git-workflow:commit-expert", prompt="Run commit in --staged mode in /path/to/repo")
When this command is run, Claude Code should:
Analyze Changes
git status to understand current stategit diff --staged for staged changes (or git diff for all)Check for Atomic Commit Violations
Generate Commit Message
Present for Approval
š Analyzing your changes...
Staged changes:
M src/auth/login.py (+45, -12)
M src/auth/tokens.py (+23, -5)
A tests/test_login.py (+89)
Unstaged changes:
M src/styles/button.css (+15, -3)
M README.md (+20)
ā
Good: Changes appear to be a single logical unit
All changes relate to authentication/login functionality
OR
ā ļø Warning: Changes may not be atomic
These appear to be separate concerns:
1. Authentication changes (src/auth/*)
2. Style changes (src/styles/button.css)
3. Documentation (README.md)
Recommendations:
- Commit auth changes first: feat(auth): ...
- Commit style changes: fix(ui): ...
- Commit docs separately: docs: ...
Would you like to:
1. Proceed with current staging (not recommended)
2. Unstage some files and commit in parts
3. Show me how to split this commit
š Proposed commit message:
feat(auth): add JWT refresh token rotation
Implement automatic token refresh to improve session security.
Tokens now rotate on each refresh, with old tokens invalidated
after a 5-minute grace period.
- Add refresh token rotation logic
- Update token validation to check rotation status
- Add tests for token refresh flow
Does this look correct?
1. Yes, commit with this message
2. Edit the message
3. Change the commit type
4. Cancel
Select commit type:
1. feat - New feature
2. fix - Bug fix
3. docs - Documentation only
4. style - Code style (formatting, no logic change)
5. refactor - Code restructuring (no feature/fix)
6. perf - Performance improvement
7. test - Adding/fixing tests
8. build - Build system or dependencies
9. ci - CI/CD configuration
10. chore - Maintenance tasks
Current selection: feat
Enter number or type:
Suggested scopes based on changed files:
1. auth (src/auth/*)
2. api (src/api/*)
3. No scope
Enter scope or select number: auth
Write a short description (max 50 chars, imperative mood):
Examples:
ā
"add password reset flow"
ā
"fix token expiration bug"
ā "added password reset" (past tense)
ā "fixes the token bug" (not imperative)
Description: add JWT refresh token rotation
Add a commit body? (Explain what and why)
1. Yes, add details
2. No, subject line is sufficient
[If yes]
Enter commit body (empty line to finish):
> Implement automatic token refresh to improve session security.
> Tokens now rotate on each refresh, with old tokens invalidated
> after a 5-minute grace period.
>
š Final commit message:
feat(auth): add JWT refresh token rotation
Implement automatic token refresh to improve session security.
Tokens now rotate on each refresh, with old tokens invalidated
after a 5-minute grace period.
Confirm commit? (yes/no/edit): yes
ā
Committed: abc1234
feat(auth): add JWT refresh token rotation
3 files changed, 157 insertions(+), 17 deletions(-)
When using --interactive, guide users through staging atomic commits:
šÆ Interactive Atomic Commit Mode
Analyzing all changes to help you create atomic commits...
Found 5 modified files with different concerns:
Group 1: Authentication (recommended first commit)
M src/auth/login.py
M src/auth/tokens.py
A tests/test_login.py
Group 2: UI Fixes
M src/styles/button.css
Group 3: Documentation
M README.md
Stage Group 1 for commit? (yes/no/show diff): yes
[Stages files, then proceeds to commit flow]
The command should enforce:
Message Length
Format
Content Quality
Atomic Check
No AI Tool Attribution
ā No changes to commit
Run `git status` to see the current state.
ā Commit message too vague
"fix bug" is not specific enough.
Please describe what was fixed: "fix(auth): correct token expiration check"
ā Not in a git repository
Initialize with `git init` or navigate to a git repository.
ā ļø Unstaged changes will not be included
Stage with `git add <file>` or use `commit --all`
For experienced users, support quick patterns:
# Quick feature commit
commit feat auth "add password reset"
# Quick fix commit
commit fix api "handle null response"
# Quick docs commit
commit docs "update API documentation"
Suggest installing hooks for enforcement:
š” Tip: Install git hooks to enforce commit standards automatically.
Would you like to set up:
1. commit-msg hook (validate message format)
2. pre-commit hook (run tests/linting)
3. Both
4. Skip for now
$ commit
š Analyzing staged changes...
M src/utils/helpers.py (+12, -3)
ā
Single file change - good atomic commit
š Proposed: fix(utils): handle edge case in date parser
Commit? (yes/edit/cancel): yes
ā
Committed: def4567
$ commit --all
š Analyzing all changes...
ā ļø Multiple concerns detected:
Authentication:
M src/auth/login.py
M src/auth/session.py
Unrelated UI fix:
M src/components/Header.vue
Documentation:
M docs/API.md
Recommendation: Split into 3 commits
1. Stage auth files ā feat(auth): ...
2. Stage Header.vue ā fix(ui): ...
3. Stage API.md ā docs(api): ...
Would you like help staging these separately? (yes/no)