Check and fix commit messages against Conventional Commits 1.0.0 with ten rules (C001-C010) and safe auto-fix suggestions. Use when the user asks to write, review or validate a commit message, or to set up commit message rules.
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Validate a commit message against Conventional Commits 1.0.0 and get a corrected version when a safe fix exists. Works on a file or on text, with Python 3.10+ and nothing to install.
git commit, to check the message you are about to write.commit-msg hook (see references/hook.md).Draft the message as type(scope)!: description, then optional body and footers.
Lint it:
python3 scripts/commit_lint.py --message "feat(api): add v2 endpoint"
python3 scripts/commit_lint.py .git/COMMIT_EDITMSGRead the findings (C00x name: message (line N)). If a suggestion: is printed, it already
lints clean; use it. Otherwise fix the cause named by the rule (references/rules.md).
For a message in a file, --fix rewrites it only when the suggestion lints clean.
Re-lint and only then commit.
Project conventions can be passed as options:
python3 scripts/commit_lint.py msg.txt --types feat,fix,docs --scopes api,cli --require-scope --max-header 72| Code | Meaning |
|---|---|
| 0 | Clean (or fixed with --fix) |
| 1 | Findings were printed |
| 2 | Usage error, unreadable file, invalid UTF-8, or input over 65,536 bytes |
| Id | Meaning |
|---|---|
| C001 | Header is not type(scope)!: description |
| C002 | Type not in the allowed list |
| C003 | Type is not lowercase |
| C004 | Header longer than the maximum (default 72 characters) |
| C005 | Description ends with a period |
| C006 | Empty scope () |
| C007 | No blank line after the header |
| C008 | Breaking-change footer misspelt (must be BREAKING CHANGE or BREAKING-CHANGE) |
| C009 | Scope not in the allowed scopes (only when scopes are configured) |
| C010 | Scope required but missing (only with --require-scope) |
Default types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.
Details and examples: references/rules.md.
#) and everything after the scissors line are ignored, like git does.Revert "...", fixup! and squash! headers are skipped unless --no-ignore-merges is given.feature to feat, bugfix/fixes to fix, doc to docs,
tests to test) and lowercase, a missing space after the colon, one trailing period removed, and a
blank line after the header. Anything else (for example an unknown type, a long header, a wrong scope) is left
for the author, because choosing it needs judgement.repository in the plugin manifest, or publish from a GitHub Action to verify it.