Validate, fix, or generate conventional commit messages with strict formatting rules
From git-lovelynpx claudepluginhub aaronbassett/agent-foundry --plugin git-lovely[check|fix|suggest] [message]/commit-messageGenerates commit message from staged git changes using project conventions and git history, auto-detects language, and copies ready-to-paste 'git commit -m' command to clipboard. Supports --format, --lang, --breaking options.
/commit-messageGenerates commit messages from staged git changes using project conventions (CommitLint, history analysis), auto-detects language (en/zh-tw), and copies full 'git commit -m' command to clipboard. Supports --format, --lang, --breaking options.
/commit-messageGenerates commit messages from staged git changes using project commitlint configs or standard formats, copies primary message to clipboard as git commit -m command.
/commit-messageGenerates commit messages from staged git changes using project conventions and git history analysis, auto-detects language/format, copies primary 'git commit -m' command to clipboard. Supports --format, --lang, --breaking.
/commit-messageGenerates commit messages from staged git changes, auto-detecting project conventions and formats. Copies top suggestion to clipboard as ready-to-run 'git commit -m "message"' command. Supports --format, --lang, --breaking options.
/commit-messageGenerates commit messages from staged git changes (git diff --staged), detects project commitlint conventions, and copies primary suggestion as 'git commit -m "msg"' to clipboard. Supports --format (conventional/gitmoji/angular), --lang, --breaking.
Validate, auto-fix, or generate commit messages following Conventional Commits specification with Angular convention. Enforce all formatting rules from the useful-commits skill.
Validate a commit message against all rules and report violations.
Usage:
/commit-message check "feat: Added new feature."
/commit-message check < commit.txt
echo "fix: bug" | /commit-message check
Output:
Automatically fix violations and return the corrected message.
Usage:
/commit-message fix "feat: Added new feature."
/commit-message fix < commit.txt
echo "fix: bug" | /commit-message fix
Output:
Generate a commit message from staged git changes.
Usage:
/commit-message suggest
Requirements:
Output:
The command accepts messages via:
/commit-message check "message here"echo "message" | /commit-message check/commit-message check < file.txtFor suggest subcommand, no message argument is needed (reads from git diff).
Determine which subcommand was invoked:
check - validation onlyfix - validation + auto-correctionsuggest - generate from git diffFor check and fix, read the commit message from:
For suggest, ignore any message argument and read from git diff.
Check the message against all rules from the useful-commits skill:
Subject Line Checks:
feat:, fix:, etc.)(scope) with lowercase lettersBody Checks (if present):
Prohibited Content:
./specs/**/*.md or local spec IDsSPEC-123 or [#DOC-456] style referencesBreaking Change Checks:
! present, BREAKING CHANGE: footer should existBREAKING CHANGE: footer present, ! should be in subjectFor each violation, provide specific guidance:
Capitalization violations:
❌ Subject is capitalized: "feat: Add feature"
✅ Should be: "feat: add feature"
Period violations:
❌ Subject ends with period: "fix: correct bug."
✅ Should be: "fix: correct bug"
Character limit violations:
❌ Subject is 75 characters (max 70)
✅ Consider shortening or using scope: "feat(auth): add JWT token refresh"
Imperative mood violations:
❌ Past tense used: "feat: added feature"
✅ Should be: "feat: add feature"
❌ Present tense used: "fix: fixes bug"
✅ Should be: "fix: fix bug"
Type violations:
❌ Invalid type: "update: change code"
✅ Use one of: feat, fix, docs, style, refactor, perf, test, build, ci, chore
Apply automatic corrections:
Fixable automatically:
Not fixable automatically (require manual intervention):
For unfixable issues, list them clearly with guidance.
When generating a commit message:
Check git repository and staged changes:
git rev-parse --is-inside-work-tree
git diff --cached --stat
Analyze staged changes:
git diff --cached --name-status
git diff --cached
Determine appropriate type:
feat:test:docs:build:ci:fix:feat:refactor:perf:style:Identify scope (optional):
Draft subject line:
Draft body (if needed):
Check for breaking changes:
! and BREAKING CHANGE: footerFor check subcommand:
Validating commit message...
❌ Subject is capitalized (should be lowercase after colon)
❌ Subject ends with period (should not)
✅ Type is valid (feat)
✅ Subject length is 45 characters (within 70 limit)
❌ Body exceeds 700 characters (currently 832)
Original message:
---
feat: Added new authentication feature.
This commit adds JWT authentication with refresh tokens and implements
the OAuth2 flow for third-party authentication. The system now supports
multiple authentication providers including Google, GitHub, and Microsoft.
The token refresh mechanism automatically renews tokens before expiry to
prevent user session interruptions. Additionally, the authentication
service has been refactored to use a more modular architecture that
allows for easy addition of new authentication providers in the future.
The implementation includes comprehensive unit tests and integration
tests covering all authentication flows and edge cases. Documentation
has been updated to reflect the new authentication patterns and usage
examples for developers integrating with the authentication system.
---
Corrected message:
---
feat: add JWT authentication with OAuth2 support
Implement JWT authentication with automatic token refresh and OAuth2
flow for third-party providers (Google, GitHub, Microsoft).
Key changes:
- JWT token generation and validation
- Automatic token refresh before expiry
- OAuth2 provider integration
- Modular architecture for adding new providers
This prevents session interruptions and enables enterprise SSO
integration.
---
Suggestions:
- Body is still 312 characters. Consider condensing further if possible.
- Consider splitting into multiple commits if adding too many features.
For fix subcommand:
Fixed commit message:
feat: add JWT authentication with OAuth2 support
Implement JWT authentication with automatic token refresh and OAuth2
flow for third-party providers (Google, GitHub, Microsoft). Modular
architecture enables easy addition of new authentication providers.
Changes made:
✅ Lowercased subject ("Added" → "add")
✅ Removed trailing period
✅ Changed to imperative mood
✅ Condensed body from 832 to 287 characters
✅ Wrapped lines at 90 characters
Ready to use!
For suggest subcommand:
Analyzing staged changes...
Files changed:
M src/auth/jwt-service.ts
M src/auth/oauth-provider.ts
A src/auth/token-refresh.ts
M tests/auth/jwt.test.ts
Suggested commit message:
---
feat(auth): add JWT token refresh mechanism
Implement automatic token refresh when tokens expire within 5 minutes
of API calls. This prevents users from being logged out during active
sessions. Refresh happens transparently in the background.
---
Rationale:
- Type: feat (new functionality added)
- Scope: auth (authentication system)
- Focus: JWT token refresh (main feature added)
- Description follows imperative mood, lowercase, no period
- Body explains what, why, and how (under 700 chars)
- Subject is 51 characters (within 70 limit)
You can edit this message or use it as-is.
Handle common errors gracefully:
Not a git repository (for suggest):
❌ Error: Not in a git repository
Run this command from within a git repository.
No staged changes (for suggest):
❌ Error: No staged changes found
Use 'git add' to stage changes before generating a commit message.
Empty message (for check/fix):
❌ Error: No commit message provided
Provide a message as argument or via stdin.
Invalid subcommand:
❌ Error: Unknown subcommand "validate"
Valid subcommands: check, fix, suggest
Usage: /commit-message [check|fix|suggest] [message]
For users:
check during code review to validate existing commitsfix to quickly correct common formatting mistakessuggest to generate well-formatted messages from changes/commit-message suggest | pbcopyFor implementation:
This command complements the built-in /commit command:
/commit creates actual commits using useful-commits skill guidance/commit-message validates and fixes messages without committing/commit-message check then /commitExample 1: Check a message
User: /commit-message check "Fix bug in authentication"
Output:
❌ Missing type prefix
✅ Should be: "fix: prevent null pointer in authentication"
Example 2: Fix a message
User: /commit-message fix "feat: Added new API endpoint."
Output:
Fixed: feat: add new API endpoint
Changes: lowercased "Added" → "add", removed period
Example 3: Generate from git diff
User: /commit-message suggest
Output:
Suggested: feat(api): add user pagination endpoint
[Complete message with body and rationale]
Example 4: Pipe from file
User: /commit-message check < .git/COMMIT_EDITMSG
Output:
[Validation results for commit message from file]
Consult the useful-commits skill for:
Load the skill if needed for comprehensive rule reference:
skills/useful-commits/SKILL.md - Core rulesskills/useful-commits/references/ - Detailed guidelinesskills/useful-commits/examples/ - Good vs bad examples