commit-lint
Skill6 starsChanged 3 months agoMITView on GitHub
Validate git commit messages against Conventional Commits v1.0.0. Script commit_lint.py reads `git log` (subprocess) of one or more repositories (or stdin with --stdin), parses each commit into type/scope/subject, and reports violations: missing type, invalid type, type case, scope, subject length (default 50), subject capitalization, trailing dot/space, header length (100), body line length (72). Plain-text Markdown-friendly report or JSON (--json). Exit codes: 0 all clean, 1 violations found, 2 error. Pure Python 3 stdlib, offline, read-only. Closes the loop for commit-message-writer and version-bumper.
In this repository59 other files it gives its agents.
- skills/chronos/references/AGENTS.mdAGENTS.md
- api-contract-testingSkill
- api-doc-generatorSkill
- canonSkill
- censorSkill
- changelog-generatorSkill
- chronosSkill
- code-reviewSkill
- commit-message-writerSkill
- coverage-analyzerSkill
- csv-proSkill
- data-analysisSkill
- deweySkill
- diagram-makerSkill
- doc-compareSkill
- docs-productSkill
- docs-projectSkill
- docs-systemSkill
- dsh-runnerSkill
- frontend-a11ySkill
- frontend-design-tasteSkill
- frontend-perfectionSkill
- frontend-performanceSkill
- frontend-testingSkill
- github-repo-hygieneSkill
- long-running-agent-workflowSkill
- mermaid-to-imageSkill
- mobile-frontendSkill
- pdf-report-builderSkill
- plan-skillSkill
- prd-to-appSkill
- presentation-craftSkill
- presentation-engineeringSkill
- presentation-makerSkill
- raster-to-svgSkill
- reddit-karmaSkill
- repo-community-filesSkill
- repo-metadata-healthSkill
- repo-readme-assetsSkill
- repo-social-previewSkill
- secret-scannerSkill
- security-reviewSkill
- seo-auditSkill
- seo-contentSkill
- seo-crawlSkill
- seo-schemaSkill
- seo-toolkitSkill
- skill-feedbackSkill
- skill-forgeSkill
- skill-suggesterSkill
- sql-helperSkill
- systematic-debuggerSkill
- test-generatorSkill
- test-graphicsSkill
- velesSkill
- version-bumperSkill
- video-script-writerSkill
- web-replicationSkill
- web-scraperSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 141
Do NOT use to *rewrite* commit messages or amend history — the tool is read-only by design.
- Very specific: line 143
Do NOT use when the repository does not follow Conventional Commits at all — the report will be mostly missing-type and the signal is noise.
- Distinctive: line 146
Do NOT use for merge-commit validation or signed-commit verification — the tool only reads the message text.
- Very specific: line 148
Do NOT use --stdin when you need body checks — stdin mode carries only the subject line.
- Very specific: line 184
Do not use to write a new commit message.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Commit Lint — Conventional Commits validator
Load this skill when you need to validate git commit messages against
Conventional Commits and
produce a report of what passes and what violates the convention. It is the
quality gate of the commit pipeline: commit-message-writer writes the
commits, commit-lint checks them, version-bumper derives the next version
from the clean history.
The tool is read-only and offline: it never modifies commits, never writes
files, and makes no network calls. It reads git log of a real repository
(via subprocess), parses each commit header as <type>(<scope>)?(!)?:
<subject>, and reports per-commit type/scope/subject plus every violated rule.
For testability the commit list can be fed from stdin (--stdin, one commit
per line) — no git repository required.
The linter script
scripts/commit_lint.py — pure Python 3 stdlib (no dependencies).
| Mode | Command |
| Auto-detect repo from cwd | python3 commit_lint.py |
| Explicit repo path | python3 commit_lint.py /path/to/repo |
| Multiple repos | python3 commit_lint.py repo1 repo2 repo3 |
| Override auto-detection | python3 commit_lint.py --repo /path/to/repo |
| Limit to N latest commits | python3 commit_lint.py --repo . --count 50 |
| No git needed (stdin) | printf 'feat: ok\n' | python3 commit_lint.py --stdin |
| Machine-readable output | python3 commit_lint.py --repo . --json |
Rules enforced (Conventional Commits v1.0.0)
| Violation | Rule | Default |
missing-type | no <type>(<scope>)?(!)?: <subject> prefix found | — |
invalid-type | type not in the allowed set | feat fix docs style refactor test perf ci chore build revert |
type-case | type must be lowercase (Feat: is a violation) | — |
scope-invalid | scope must be non-empty and contain no spaces | — |
empty-subject | no description after <type>: | — |
space-after-colon | exactly one space required after : | — |
subject-too-long | subject longer than max | 50 chars (--max-subject) |
header-too-long | full header longer than max | 100 chars (--max-header) |
subject-case | subject must start with a lowercase letter or digit | on (--no-subject-case disables) |
trailing-dot | subject must not end with . | on (--no-trailing-dot disables) |
trailing-space | subject must not end with whitespace | — |
body-line-too-long | body line longer than max | 72 chars (--max-body-line) |
Output
commit-lint report
==================
repo: /path/to/repo
generated: 2026-08-09T16:54:04
commits_analyzed: 10
clean: 5
with_violations: 5
[OK] 4a8b27c test: verify lint
[FAIL] 64cf5ff foo: unknown type
type: foo | scope: (none) | breaking: no
subject: foo: unknown type
violations:
- invalid-type: type not in allowed set: feat, fix, docs, style, refactor, test, perf, ci, chore, build, revert
...
=== Violations by type ===
invalid-type: 1
missing-type: 1
exit: 1Exit codes
| Code | Meaning |
0 | all analyzed commits are clean |
1 | at least one commit has violations |
2 | error (not a git repo, git not installed, bad arguments, unreadable input) |
Usage example (typical)
# Lint the current repository (auto-detected from cwd)
python3 skills/commit-lint/scripts/commit_lint.py
# Lint a specific repository, last 50 commits
python3 skills/commit-lint/scripts/commit_lint.py --repo /path/to/repo --count 50
# CI gate: fail the pipeline when any commit violates the convention
python3 skills/commit-lint/scripts/commit_lint.py --repo . && echo "all clean" || echo "violations found"
# Machine-readable report for a bot / dashboard
python3 skills/commit-lint/scripts/commit_lint.py --repo . --json
# Test the rules without a git repo (one commit per line)
printf 'feat: add widget\nFeat: bad case\n' | python3 skills/commit-lint/scripts/commit_lint.py --stdinInterpretation guidance
exit: 0— every analyzed commit follows the convention. The history is ready forversion-bumperandchangelog-generator.exit: 1— violations found. Read the[FAIL]blocks: each lists the exact rule that fired. Fix the commit messages (rewrite history only if the commits are not yet shared) or adjust the limits (--max-subject,--max-header,--max-body-line) to match the project's documented style.missing-type— the commit has no conventional prefix at all. This is the most common finding on legacy repos; decide whether to migrate the history or accept a baseline of non-conventional commits.invalid-type— the prefix exists but the type is not in the preset table. The preset follows the friendly set from the task contract (feat, fix, docs, style, refactor, test, perf, ci, chore, build, revert); the Conventional Commits spec itself only mandatesfeatandfixand leaves the rest to the project.subject-too-long/header-too-long— the 50/100 limits follow the git commit man page and the Conventional Commits spec. Long subjects are a readability problem: they get truncated ingit log --oneline.subject-case— the subject must start with a lowercase letter or digit.feat: Add widgetis a violation;feat: add widgetis not.trailing-dot— subjects must not end with.. This is a style rule (the spec examples never use a trailing period); disable with--no-trailing-dotif the project disagrees.
Do NOT use
- Do NOT use to rewrite commit messages or amend history — the tool is read-only by design. It reports; you decide what to fix.
- Do NOT use when the repository does not follow Conventional Commits at all —
the report will be mostly
missing-typeand the signal is noise. Considercommit-message-writerto establish the convention first. - Do NOT use for merge-commit validation or signed-commit verification — the tool only reads the message text.
- Do NOT use
--stdinwhen you need body checks — stdin mode carries only the subject line; body rules (body-line-too-long) requiregit log.
Canonical analogues
Full source depth — in references/canonical-patterns.md. Backbone:
<table>
<tr><th>Analog</th><th>What we borrow</th></tr>
<tr><td>Conventional Commits spec</td><td>Header format, type taxonomy, `!` marker, `BREAKING CHANGE:` footer</td></tr>
<tr><td>commitlint (conventional-changelog)</td><td>Rule set, subject-length/type-enum checks, exit-code gate</td></tr>
<tr><td>gitlint</td><td>Subject capitalization, trailing-period, body-line-length rules</td></tr>
<tr><td>husky + commit-msg hook</td><td>Pre-commit validation workflow (we stay a standalone CLI)</td></tr>
<tr><td>semantic-release / commitizen</td><td>Type taxonomy and the "clean history drives releases" model</td></tr>
</table>Installation
# For opencode
cp -r skills/commit-lint ~/.config/opencode/skills/
# For other agents
# Copy the skill folder to your skills directory; requires Python 3.
# git is optional — --stdin mode works without it.Note: the linter validates; it never rewrites. Wire it into the commit pipeline as the quality gate before
version-bumperderives the next version — a clean Conventional Commits history is what makes the release tooling trustworthy.
Boundaries
- Do not use to write a new commit message; use
commit-message-writer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

