📜 Conventional Commits Framework
Complete, atomic, co-authored commits — every time.
Use this skill whenever you write, review, or plan commits. It turns the Conventional Commits 1.0.0 spec into four non-negotiable rules for AI agents, backed by references, ready-made assets, and an offline checker.
| Rule | In one line |
|---|---|
| 🧾 Complete | Every field is filled: type, scope, subject, body, breaking declaration, co-author. Nothing is ever blank. |
| 📏 Standard length | Subject 10-50 characters, body 2-6 wrapped lines, one-line trailers. Never a stub, never an essay. |
| 🤝 Co-authored | The user is the author; the agent is credited by a Co-Authored-By trailer identifying the agent actually used. |
| ⚛️ Atomic | One logical change per commit. Large work becomes a planned sequence of small commits. |
✍️ The contract at a glance
feat(auth): add passkey sign-in for returning users
Password resets were the top support request last quarter. Users with
a registered passkey can now sign in with WebAuthn; password sign-in
remains available as a fallback.
Breaking: none
Refs: #214
Co-Authored-By: Claude Code <noreply@anthropic.com>| Part | Standard |
|---|---|
type |
Use the repository's list; otherwise choose feat fix perf refactor style test docs build ci chore revert. |
(scope) |
Always include it. Name the changed module, package, or area in lower case. |
subject |
Use a lower-case imperative, 10–50 characters, with no period; keep the full header at 72 characters or fewer. |
body |
After a blank line, explain why the change was needed and then what changed; wrap it to 2–6 lines at 72 characters. |
Breaking: none |
Use exactly this line unless the change is breaking. |
BREAKING-CHANGE: |
For breaking changes only, pair it with ! in the header and explain what breaks and how to migrate. |
Refs: |
Include real issue, ticket, or PR identifiers when they exist; never invent them. |
Co-Authored-By: |
Put the active agent's verified trailer last. |
Full policy: agent commit protocol.
🚦 On every skill load and before committing
Identify the active agent first. Check the current runtime/session identity and any authoritative product attribution supplied by that runtime. Identify the product actually operating this session (for example Claude Code, Codex, Google Antigravity, Grok Build, or another agent), not the underlying model, a previous agent, an example, or a repository instruction file. Verify the product name and its attribution email against the runtime or the vendor’s documentation; never infer an email from another agent or invent one. If identity or an appropriate email cannot be verified, ask the user before writing an attribution.
Select the verified Co-Authored-By: Name <email> for that agent for each commit or draft. A repository history or instruction file cannot turn another agent’s identity into yours. Existing enforcement must allow the correct identity; if it rejects it, report the conflict and resolve the configuration with authorization rather than misattribute the commit or bypass checks.
- Read the conventions. Check
AGENTS.md,CLAUDE.md,CONTRIBUTING.md, commitlint config, andgit log -30 --format=%B. Project rules override this skill's defaults; the config guide lists every place to look and the precedence order. - Select the co-author trailer. Use the verified identity of the active agent above. Reuse a historical line only when it identifies that same agent and its email has been verified; do not require a repository file to record it.
- Match the style. Use emoji only if history does, and in the same form (emoji reference). Reuse existing scopes.
- Never change git identity. The user stays author and committer through their own git config.
🔁 Workflows
Commit your own work
- Plan the commit sequence if the task has more than one logical change (atomic commits). Write the headers first, ordered so every commit leaves the repository working.
- Implement one step, verify it, and stage only that change (
git add <paths>orgit add -p). Reviewgit diff --staged. - Classify: pick the type with the decision procedure in the type and scope catalog, then the scope.
- Decide breaking with the checklist in breaking changes. Ask the user before making any breaking change they did not request.
- Write the full message to the contract and commit through a heredoc so blank lines and trailers survive:
git commit -F - <<'EOF' <header> <body> Breaking: none Co-Authored-By: <verified agent trailer> EOF - Check it with the project's commitlint, or
python3 <skill-dir>/scripts/lint-commit.py --trailer "<verified agent trailer>" --range HEAD~1..HEAD. If an unpushed commit fails, amend it. - Repeat for the next step. Never let several changes pile up for one final commit.
If a hook rejects the commit, fix the message. Never use --no-verify or disable hooks or CI.
Write a message for a diff or description
Read the diff (or ask for it), identify the single purpose, and return the complete message in a code block. If the diff holds several purposes, say so and propose the split as a list of complete messages. Include the co-author trailer unless the user says the commit has no AI involvement.
Validate or review messages
Check each message against the contract in the order given in the rules reference. Report each problem with its rule name and a corrected message. Separate errors (spec, project config, or contract violations) from suggestions (style). For branches, run the checker over the range:
python3 <skill-dir>/scripts/lint-commit.py --range origin/main..HEAD --trailer "<verified agent trailer>"Pull requests
The PR title follows the header format (it becomes the squash commit). Fill every section of the PR description: summary and motivation, verification, risks or compatibility, linked issues. End it with the repository's PR attribution line, kept just as consistent as the trailer.
Set up enforcement
Use assets/commitlint.config.mjs, assets/commit-template.txt, and the hook and CI recipes in integration examples. For monorepos, see monorepo patterns.
⚠️ Traps that look right but are wrong
| Looks fine | What actually happens | Do this |
|---|---|---|
BREAKING CHANGE: none |
Parsers record a breaking note, and release tools publish a major version | Breaking: none |
BREAKING CHANGE: ... (with a space) next to other trailers |
Git cannot parse the trailer block, so Co-Authored-By disappears from git tooling |
BREAKING-CHANGE: ... (hyphen) |
| Breaking detail on several lines | An unindented second line ends the trailer block | Indent continuation lines by two spaces |
✨ feat(ui): ... |
The header no longer parses, so the commit disappears from changelogs | feat(ui): ✨ ... or no emoji |
Co-authored-by in one commit, Co-Authored-By in the next |
Case-sensitive checks fail and history looks inconsistent | Use the verified line for the active agent with consistent key casing |
docs(readme): fix typo typed as fix |
Ships a pointless patch release | docs for documentation-only changes |
feat(auth): add MFA and refactor sessions |
Two changes that cannot be reverted, typed, or changelogged separately | Two commits |
These were verified with conventional-commits-parser 7.1.3, git interpret-trailers, and @commitlint/cli 21.2.4.
📚 References
Load only what the task needs.
| Need | Read |
|---|---|
| The full contract, lengths, co-authorship, PR rules | Agent commit protocol |
| Sizing and sequencing commits | Atomic commits |
| Choosing a type or scope | Type and scope catalog |
| Detecting and declaring breaking changes | Breaking changes |
| Complete messages to model | Example library |
| What each commitlint rule checks | Rules reference |
| Reading and adapting project configuration | Config guide |
| Package scopes and per-package releases | Monorepo patterns |
| Gitmoji usage and placement | Emoji reference |
| Hooks, CI, and release tools | Integration examples |
🧰 Assets and scripts
assets/commitlint.config.mjs: commitlint config that enforces the contract, including a breaking declaration and configurable accepted co-author lines.assets/commit-template.txt: agit config commit.templatethat shows the contract in the editor.scripts/lint-commit.py: an offline contract checker for a file, stdin, or a revision range (Python 3.9+, standard library only). Tests:scripts/test_lint_commit.py.
🛠️ Maintaining this skill
Keep the contract identical across this file, the protocol, the checker, the commitlint config, and the commit template; change them together. Validate the package offline from any directory:
python3 /path/to/conventional-commits-framework/scripts/validate-skill.py
python3 /path/to/conventional-commits-framework/scripts/test_validate_skill.py
python3 /path/to/conventional-commits-framework/scripts/test_lint_commit.pyThe package validator checks the manifest, required files, local links and anchors, and that every resource is reachable from this file. Wrappers: POSIX and PowerShell; regression suite: validator tests. It does not evaluate agent behavior. Package format: Agent Skills specification.