Generates or validates Conventional Commits messages from staged diffs. Use when drafting commit messages, checking repo rules, or inferring scope from changed files.
Generate or validate Conventional Commits for the staged surface.
Default posture: subject line first; body only when risk, rationale, or breaking-change detail is needed; standard types only unless the repo already defines custom ones; never claim behavior not visible in the diff.
VALIDATION: WARN
Message:
feat: update stuff
Issues:
- `update stuff` is too vague
- summary should name the changed behavior or surface
Suggested fix:
feat(auth): add refresh token rotation
AI-Authored Commits
The commit message describes the change, not the tool that produced it. Apply the same rules regardless of whether a human or an AI agent drafted the code.
Banned in subject and body: generated by, co-authored-by: <ai-tool>, via copilot, via claude, chatgpt, ai assistant, bot.
If your team requires an audit trail for AI-assisted code, add an Assisted-by: trailer as an opt-in team policy (not a default). Keep it out of the subject line. Example:
This is an organizational opt-in pattern, not a general requirement. The default rule remains: no attribution.
Assisted-by: is a distinct trailer from Co-Authored-By: — several large open-source projects (Linux Kernel, Apache Software Foundation, LLVM, QEMU) have converged on Assisted-by: through 2026 specifically because Co-Authored-By: implies authorship/copyright standing that an AI tool cannot hold or sign a CLA for. If a repo already uses Co-Authored-By: <ai-tool> by convention, do not silently rewrite it to Assisted-by: — flag the distinction and let the maintainer choose; changing trailer conventions after history exists breaks blame/provenance tooling that greps for the old trailer.
Repo Policy Checks
Block or rewrite messages that:
omit the type prefix
use vague summaries: update, fix stuff, change code, WIP, misc
include assistant/tool attribution (see above)
overstate impact not visible in the diff
use past tense or gerund after the type prefix
exceed 72 characters on the subject line
end the subject line with a period
Scripts
Script
Purpose
scripts/commit_validator.py
Validate a single message, lint a history file, or generate a Markdown quality report
# Validate one message
python scripts/commit_validator.py validate --message "feat(auth): add refresh token rotation"
# Lint a batch history file
python scripts/commit_validator.py lint --input data/sample-commit-history.json
# Generate a full Markdown report
python scripts/commit_validator.py report --input data/sample-commit-history.json --output report.md
See scripts/README.md for the full quick-start, input format, and rule reference.
Worktree PR Loop
Use this skill as the commit step inside the broader worktree-first delivery loop defined by ../dev-git-workflow/SKILL.md.
In that loop: create or enter feature worktree → make code changes → stage intentionally → use this skill → run repo gate → open PR.
If the staged diff mixes several unrelated surfaces, stop and recommend split commits before the PR step.
Known Traps
Inferring scope from filenames alone, producing scopes that do not match the repo's bounded-context map.
Compressing unrelated changes into one "clean" conventional commit, destroying revert and release-note usefulness.
Treating AI-generated summaries as authoritative when the diff still contains hidden migrations or breaking changes.
Optimizing for lint-pass format while losing the operational intent maintainers need for incident archaeology.
Using ! or BREAKING CHANGE casually and creating noisy downstream automation.
Navigation
config.yaml — repo-specific scope mapping and validation defaults
assets/template-commit-message.md — optional detailed body template for complex commits
assets/template-security-commits.md — wording guidance for security-sensitive commits
references/conventional-commits-guide.md — full spec v1.0.0 (current stable), type definitions, breaking changes, tooling setup
references/monorepo-commit-conventions.md — scope strategy, per-package changelog generation, affected-package CI routing
references/changelog-generation-guide.md — release tooling comparison (standard-version deprecated since 2022; prefer release-please or changesets)
data/sources.json — curated primary sources for tool verification
data/sample-commit-history.json — 20-commit sample dataset for lint and report subcommands
Related: ../dev-git-workflow/SKILL.md — branching, hooks, PR workflow, release automation; use dev-git-workflow for branching/PR strategy, this skill for commit-message standards
Fact-Checking
Conventional Commits spec is v1.0.0 (stable as of July 2026; no v2 released).
commitlint is at v21.x (21.2.1 as of July 2026); requires Node 22+; config uses ESM (export default { extends: [...] }).
standard-version is deprecated, not archived — the repo carries a deprecation notice pointing to release-please (GitHub-native) or the community fork commit-and-tag-version. Do not recommend it for new projects either way.
release-please-action is at v5 (Node 24 runtime, April 2026 breaking change); the underlying release-please package is at v17.x. Re-check the major tag before pinning a workflow — this skill will drift again.
semantic-release is at v25.x as of mid-2026 and actively maintained (recent work adds npm trusted publishing).
For current tooling, hook behavior, or release-automation recommendations, verify against primary sources in data/sources.json and use web search when available — pinned major-version numbers in this skill are a snapshot, not a guarantee.
If browsing is unavailable, mark volatile tool guidance as unverified.
Learnings Loop
Before applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).
After applying it, if you encountered a pattern worth remembering, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
1---
2name: dev-git-commit-message
3description: "Generates or validates Conventional Commits messages from staged diffs. Use when drafting commit messages, checking repo rules, or inferring scope from changed files."
4compatibility: Target runtime is repo-local skill frontmatter with `argument-hint` support.
5argument-hint: "[--validate 'msg' | --tier short|detailed]"
6version: "1.2"
7last_validated: 2026-07-11
8---
910# Git Commit Message Generator
1112Generate or validate Conventional Commits for the staged surface.
1314Default posture: subject line first; body only when risk, rationale, or breaking-change detail is needed; standard types only unless the repo already defines custom ones; never claim behavior not visible in the diff.
1516## Quick Reference
1718| Need | Default | Reference |
19|------|---------|-----------|
20| Pick a type | `feat`/`fix`/`perf`/`refactor`/`docs`/`test`/`build`/`ci`/`chore`/`style`/`revert` | Type Selection table below |
21| Format a subject | `type(scope): imperative summary`, ≤72 chars (50 ideal), no trailing period | Pre-Commit Message Checklist below |
22| Mark a breaking change | `!` after type/scope, or a `BREAKING CHANGE:` footer | Breaking Change Format table below |
23| Decide on a body | Only for risk, non-obvious rationale, or breaking-change detail | Body Required? table below |
24| Handle AI-authored commits | No tool attribution ever; `Assisted-by:` trailer only if the repo opts in | AI-Authored Commits below |
25| Pick a release/changelog tool | release-please for reviewed PR releases; semantic-release for full automation; changesets for monorepos | [references/changelog-generation-guide.md](references/changelog-generation-guide.md) |
26| Scope a monorepo commit | package/app/service directory name, one level deep, stable over time | [references/monorepo-commit-conventions.md](references/monorepo-commit-conventions.md) |
27| Validate a message locally | `python scripts/commit_validator.py validate --message "..."` | Scripts section below |
2829## Decision Tables
3031### Mode Selection
3233| Trigger | Mode | Action |
34|---------|------|--------|
35| User provides staged diff or asks to commit | Generate | Inspect staged surface, produce primary + alternatives |
36| User provides an existing message string | Validate | Check rules, return PASS/WARN/FAIL + exact rewrite |
37| Staged diff mixes unrelated areas | Split | Recommend split commits before generating |
38| No staged changes | Stop | Report "no staged changes" |
3940### Type Selection
4142| Change | Type | Notes |
43|--------|------|-------|
44| New user- or API-visible capability | `feat` | Triggers MINOR bump |
45| Incorrect behavior corrected | `fix` | Triggers PATCH bump |
46| Measurable speed or memory improvement | `perf` | Triggers PATCH bump |
47| Structure improved, behavior unchanged | `refactor` | No release by default |
48| Documentation only | `docs` | No release by default |
49| Tests only | `test` | No release by default |
50| Build tooling or packaging | `build` | No release by default |
51| CI/CD workflow | `ci` | No release by default |
52| Repo hygiene, no product change | `chore` | No release by default |
53| Whitespace or formatting only | `style` | No release by default |
54| Reverting a prior commit | `revert` | Triggers PATCH bump |
55| Security fix | `fix(security):` | Prefer standard type + scope over custom `security:` type |
56| Prompt/skill/YAML behavioral change | `feat` or `fix` | Do not classify by file extension alone |
5758### Scope Selection
5960| Situation | Action |
61|-----------|--------|
62| Repo has a scope map in [config.yaml](config.yaml) | Use mapped scope |
63| One directory or package clearly dominates | Use that name, lowercase kebab-case |
64| Change spans 2+ stable areas equally | Use broader parent scope or omit |
65| Repository-wide change | Omit scope |
66| Monorepo with independently versioned packages | See [references/monorepo-commit-conventions.md](references/monorepo-commit-conventions.md) |
6768### Body Required?
6970| Condition | Include body? |
71|-----------|--------------|
72| Subject is self-explanatory | No |
73| Reason is non-obvious from subject | Yes — one sentence why |
74| Security-sensitive or risky change | Yes — risk/rollback note |
75| Breaking change | Yes — `BREAKING CHANGE:` footer required |
76| Caller requests detailed template | Yes — use [assets/template-commit-message.md](assets/template-commit-message.md) |
7778### Breaking Change Format
7980| Signal | Format |
81|--------|--------|
82| Inline marker | `feat(api)!: change auth to OAuth2` |
83| Footer | `BREAKING CHANGE: <migration summary>` |
84| Both | Acceptable; footer body gets the detail |
8586## Before/After Examples
8788```text
89BAD: update
90GOOD: docs(readme): add deployment instructions
9192BAD: fix stuff
93GOOD: fix(cart): prevent negative quantity on rapid add
9495BAD: feat: added user dashboard (past tense, missing scope)
96GOOD: feat(dashboard): add analytics overview panel
9798BAD: feat: add search (generated by Copilot)
99GOOD: feat(search): add full-text product search
100101BAD: feat(api): add comprehensive user search endpoint with full-text search across all profile fields including bio and location
102GOOD: feat(api): add full-text user search endpoint
103104BAD: feat: add dashboard, fix auth bug, update deps (mixed concerns)
105GOOD: (3 separate commits)
106 feat(dashboard): add analytics overview panel
107 fix(auth): correct token refresh race condition
108 chore(deps): update react to 18.3.0
109```
110111## Pre-Commit Message Checklist
112113- [ ] Starts with a valid type prefix (`feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `build`, `ci`, `chore`, `style`, `revert`)
114- [ ] Subject is 72 characters or fewer (50 preferred)
115- [ ] Imperative mood: "add" not "added", "fix" not "fixing"
116- [ ] No trailing period on subject line
117- [ ] Scope, if used, matches repo conventions (lowercase kebab-case)
118- [ ] Single logical change; unrelated concerns split into separate commits
119- [ ] No tool/assistant attribution in subject or body
120- [ ] No generic placeholders: "update", "fix stuff", "WIP", "misc"
121- [ ] Breaking changes marked with `!` or `BREAKING CHANGE:` footer
122- [ ] Body present only when needed; answers "why", not "what"
123124## Workflow
1251261. Decide mode from the Mode Selection table above.
1272. For generate mode, inspect staged changes in this order:
128 - `git diff --staged --name-status`
129 - `git diff --staged --stat`
130 - `git diff --staged --unified=1` only when type, scope, or risk is ambiguous
1313. Classify type and scope using the tables above.
1324. Detect scope from [config.yaml](config.yaml) first, then from the nearest stable directory.
1335. Generate: one primary suggestion, up to two alternatives when scope or emphasis is ambiguous, short rationale.
1346. Validate: run all checklist items, return PASS/WARN/FAIL with exact rewrite on failure.
1357. If the diff mixes unrelated work, recommend split commits before offering a combined message.
136137## Output Contract
138139### Generate
140141```text
142[NOTE] Suggested commit messages (3 files changed)
143144PRIMARY:
145fix(auth): reject expired refresh tokens
146147ALTERNATIVES:
1481. fix(api): reject expired refresh tokens
1492. fix: reject expired refresh tokens during rotation
150151RATIONALE:
152- Type: fix
153- Scope: auth
154- Signals: token validation path, regression test update, no new feature surface
155```
156157### Validate
158159```text
160VALIDATION: WARN
161162Message:
163feat: update stuff
164165Issues:
166- `update stuff` is too vague
167- summary should name the changed behavior or surface
168169Suggested fix:
170feat(auth): add refresh token rotation
171```
172173## AI-Authored Commits
174175The commit message describes the change, not the tool that produced it. Apply the same rules regardless of whether a human or an AI agent drafted the code.
176177Banned in subject and body: `generated by`, `co-authored-by: <ai-tool>`, `via copilot`, `via claude`, `chatgpt`, `ai assistant`, `bot`.
178179If your team requires an audit trail for AI-assisted code, add an `Assisted-by:` trailer as an opt-in team policy (not a default). Keep it out of the subject line. Example:
180181```text
182feat(search): add full-text product search
183184Assisted-by: claude-sonnet-4-6
185```
186187This is an organizational opt-in pattern, not a general requirement. The default rule remains: no attribution.
188189`Assisted-by:` is a distinct trailer from `Co-Authored-By:` — several large open-source projects (Linux Kernel, Apache Software Foundation, LLVM, QEMU) have converged on `Assisted-by:` through 2026 specifically because `Co-Authored-By:` implies authorship/copyright standing that an AI tool cannot hold or sign a CLA for. If a repo already uses `Co-Authored-By: <ai-tool>` by convention, do not silently rewrite it to `Assisted-by:` — flag the distinction and let the maintainer choose; changing trailer conventions after history exists breaks blame/provenance tooling that greps for the old trailer.
190191## Repo Policy Checks
192193Block or rewrite messages that:
194195- omit the type prefix
196- use vague summaries: `update`, `fix stuff`, `change code`, `WIP`, `misc`
197- include assistant/tool attribution (see above)
198- overstate impact not visible in the diff
199- use past tense or gerund after the type prefix
200- exceed 72 characters on the subject line
201- end the subject line with a period
202203## Scripts
204205| Script | Purpose |
206|--------|---------|
207| [scripts/commit_validator.py](scripts/commit_validator.py) | Validate a single message, lint a history file, or generate a Markdown quality report |
208209```bash
210# Validate one message
211python scripts/commit_validator.py validate --message "feat(auth): add refresh token rotation"
212213# Lint a batch history file
214python scripts/commit_validator.py lint --input data/sample-commit-history.json
215216# Generate a full Markdown report
217python scripts/commit_validator.py report --input data/sample-commit-history.json --output report.md
218```
219220See [scripts/README.md](scripts/README.md) for the full quick-start, input format, and rule reference.
221222## Worktree PR Loop
223224Use this skill as the commit step inside the broader worktree-first delivery loop defined by [../dev-git-workflow/SKILL.md](../dev-git-workflow/SKILL.md).
225226In that loop: create or enter feature worktree → make code changes → stage intentionally → use this skill → run repo gate → open PR.
227228If the staged diff mixes several unrelated surfaces, stop and recommend split commits before the PR step.
229230## Known Traps
231232- Inferring scope from filenames alone, producing scopes that do not match the repo's bounded-context map.
233- Compressing unrelated changes into one "clean" conventional commit, destroying revert and release-note usefulness.
234- Treating AI-generated summaries as authoritative when the diff still contains hidden migrations or breaking changes.
235- Optimizing for lint-pass format while losing the operational intent maintainers need for incident archaeology.
236- Using `!` or `BREAKING CHANGE` casually and creating noisy downstream automation.
237238## Navigation
239240- [config.yaml](config.yaml) — repo-specific scope mapping and validation defaults
241- [assets/template-commit-message.md](assets/template-commit-message.md) — optional detailed body template for complex commits
242- [assets/template-security-commits.md](assets/template-security-commits.md) — wording guidance for security-sensitive commits
243- [references/conventional-commits-guide.md](references/conventional-commits-guide.md) — full spec v1.0.0 (current stable), type definitions, breaking changes, tooling setup
244- [references/commit-message-antipatterns.md](references/commit-message-antipatterns.md) — anti-pattern catalog, regex detection patterns, commitlint config, CI examples
245- [references/monorepo-commit-conventions.md](references/monorepo-commit-conventions.md) — scope strategy, per-package changelog generation, affected-package CI routing
246- [references/changelog-generation-guide.md](references/changelog-generation-guide.md) — release tooling comparison (standard-version deprecated since 2022; prefer release-please or changesets)
247- [data/sources.json](data/sources.json) — curated primary sources for tool verification
248- [data/sample-commit-history.json](data/sample-commit-history.json) — 20-commit sample dataset for lint and report subcommands
249- Related: [../dev-git-workflow/SKILL.md](../dev-git-workflow/SKILL.md) — branching, hooks, PR workflow, release automation; use dev-git-workflow for branching/PR strategy, this skill for commit-message standards
250251## Fact-Checking
252253- Conventional Commits spec is v1.0.0 (stable as of July 2026; no v2 released).
254- commitlint is at v21.x (21.2.1 as of July 2026); requires Node 22+; config uses ESM (`export default { extends: [...] }`).
255- `standard-version` is deprecated, not archived — the repo carries a deprecation notice pointing to `release-please` (GitHub-native) or the community fork `commit-and-tag-version`. Do not recommend it for new projects either way.
256- `release-please-action` is at v5 (Node 24 runtime, April 2026 breaking change); the underlying `release-please` package is at v17.x. Re-check the major tag before pinning a workflow — this skill will drift again.
257- `semantic-release` is at v25.x as of mid-2026 and actively maintained (recent work adds npm trusted publishing).
258- For current tooling, hook behavior, or release-automation recommendations, verify against primary sources in [data/sources.json](data/sources.json) and use web search when available — pinned major-version numbers in this skill are a snapshot, not a guarantee.
259- If browsing is unavailable, mark volatile tool guidance as unverified.
260261## Learnings Loop
262263Before applying this skill on a non-trivial task, read `learnings.consolidated.md` in this directory (and `learnings.md` if present).
264265After applying it, if you encountered a pattern worth remembering, append one dated bullet to `learnings.md` via `agents-skills-feedback-loop/scripts/append_learning.py`. Do not modify `SKILL.md` itself.
Run npx skillmds@latest add gabrielmoreira/dev-git-commit-message in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Generates or validates Conventional Commits messages from staged diffs. Use when drafting commit messages, checking repo rules, or inferring scope from changed files. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: CAUTION, Skill Scanner: PASS. Capability flags: reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
gabrielmoreira (@gabrielmoreira) published this skill. Their other Agent Skills are listed on their SkillMD profile.