/git-conventions:conventional-commit [create|validate|convert|fix] [optional message, branch, or linter output]from git-conventions
Create and validate commit messages following the Conventional Commits standard. Use when committing code, reviewing commit messages, converting existing commits to conventional format, or when someone asks about commit message formatting. Also use proactively when preparing commits to ensure compliance, and when a commit linter (commitlint or a commit-msg hook) rejects a commit message and the last commit needs correcting and amending.
Ships in git-conventions. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
All commit descriptions for commits to work branches must use the Conventional Commits standard.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Resolve the permitted set in this order; the first that applies wins:
commitlint config (.commitlintrc*, commitlint.config.*, or a commitlint key in package.json), a documented type list in README.md, or an equivalent declared standard. Follow it exactly.
A machine-global linter counts as policy too: a Claude Code PostToolUse hook (for example ~/.claude/last_commit.py running a last_commit commitlint wrapper) lints HEAD of whatever repository the shell sits in after every git commit, with its own type set, subject and body limits and required trailers, even in a repository that declares nothing. Read that hook's rules before assuming a silent repository allows the full set; on a machine with such a hook, its narrower set wins over step 3.feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.| Type | Purpose |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only changes |
style | Formatting, whitespace, semicolons (no code meaning change) |
refactor | Code change that neither fixes a bug nor adds a feature |
perf | Code change that improves performance |
test | Adding missing tests or correcting existing tests |
build | Build system or external dependency changes |
ci | CI configuration files and scripts |
chore | Other changes that do not modify src or test files |
revert | Reverts a previous commit |
security | Security fixes and hardening |
deps | Dependency-only changes |
config | Configuration changes |
release | Release versioning |
Never reject a type the repository itself permits. ADR-1's narrower list is a work-branch discipline, not a universal rule.
One type per commit. A commit must contain only one type of change (house rule, checked in code review where the repository has it; the user may accept a single type for a mixed change, see the create step).
README.md at repo root)api, service, lib, cronfeat(api): Add invoice exportRefs: #123 or BREAKING CHANGE: description! after type/scope: feat(api)!: Remove legacy endpointBREAKING CHANGE: in the footer! suffix is preferred for visibilitysubject-exclamation-mark (commitlint's config-conventional does), the ! form is rejected after the fact; use the BREAKING CHANGE: footer thereUnder the house squash-merge policy, work branch merge commits to main use a different standard:
When /conventional-commit create is invoked:
git diff --staged --stat. IF the output is empty, tell the user nothing is staged and STOP.git diff --staged to understand what changed.README.md at the repository root for defined scopes. IF scopes are defined, use the matching one. IF scope is marked required, never omit it. IF no scopes are defined, include a scope only when the impact area is obvious.git log --oneline -15 | grep -F '<description>' must print nothing, because a heredoc adapted from an earlier commit in the same session has shipped a duplicate title before.Claude-Session: line) as the last lines of the message. Never type Signed-off-by; step 9 has git write it, and it must be the final line.awk 'NR==1{sub(/^[^:]*: /,""); if(length>50)print "subject "length} NR>1&&length>72{print NR": "length}'. Anything it prints is rewrapped or shortened before committing.git commit -s -F -, passing the full message on standard input. -s appends Signed-off-by from the repository's configured user.name and user.email, after every trailer in the message. Never pass a multi-line message with -m. Standard input avoids shell quoting problems, preserves the pre-wrapped body, and leaves no shared temporary file for a concurrent session to clobber. If a file is genuinely needed, use a uniquely named one in the session scratchpad directory and remove it afterwards.git show --stat HEAD that only the intended files were committed. Push in a separate Bash call, after the commit hook has had its say: a PostToolUse linter runs only when the whole command has finished, so git commit ... && git push in one call pushes an unlinted message, and the repair is then an amend plus a force-push instead of a plain re-commit.When /conventional-commit validate is invoked:
git log --format="%h %s" -20, or limit to the range named in the provided arguments.<type>[scope]: <description> using the permitted set resolved under Commit Types.git log --format="%h|%b" over the same range and flag commits with an empty body).When /conventional-commit convert is invoked:
git log 'main..the-branch' --format="%h %s", substituting the real refs as a single quoted argument. Do not write bare angle-bracket placeholders into the command: the shell reads <base> as a redirection and fails with no such file or directory. Resolve the base as the explicit argument, else the remote default from git symbolic-ref refs/remotes/origin/HEAD, else main, else develop; ask if none resolves. Otherwise run git log --format="%h %s" -20.When /conventional-commit fix is invoked, or a commit linter has rejected a message:
Step 0 (MANDATORY): decide whether a commit actually exists.
A commit-msg hook rejects before the commit object is written. The commit was never created, HEAD still points at the previous, unrelated commit, and the changes are still staged. Amending in that state rewrites the wrong commit and folds the staged work into it.
The deciding evidence is WHERE the rejection came from, not the state of the tree. A local commit-msg or pre-commit hook rejects a commit that was never created (Branch A). A CI commitlint run, a review comment, or the user pointing at a commit all concern a commit that exists (Branch B). Establish that first:
git rev-parse --verify -q HEAD || echo "UNBORN: no commit exists yet"
git status --porcelain
git log -1 --format='%h %s' 2>/dev/null
Then classify:
UNBORN printed: there is no commit to amend under any circumstances. Branch A, always.cd ~/wiki && git commit ... && cd -, or any git -C <other-repo> commit): the hook lints HEAD of the repository the shell ended in, which may be an unrelated commit by someone else. Run git log -1 --format='%an %s' in that repository and git -C <intended-repo> log -1 in the one you committed to. If the flagged commit is not yours, it is a false positive: amend nothing and report it.One caveat for Branch A: if the rejected attempt used git commit -a or a pathspec, the changes may not be in the index at all, so a bare git commit would commit nothing. Re-stage exactly what the original attempt covered, or re-run it with the same flags and the corrected message.
Branch A: the commit was rejected and never created (a commit-msg or pre-commit hook failed, and HEAD is an older commit unrelated to the staged work). This is the common case.
git commit -s -F - with the corrected message on standard input. Never amend.Branch B: a commit exists and its message is wrong (CI commitlint flagged an existing commit, or the user names the HEAD commit explicitly).
git log -1 --format=%B and rewrite it as in Branch A step 2.git fetch --all --quiet (skip if offline, and say so), then git branch -r --contains HEAD and git tag --contains HEAD. If the commit is reachable from any remote ref or tag, STOP: report that amending would require a force-push and show the corrected message instead. If the fetch failed, STOP as well, because a blank result after a failed fetch proves nothing. A branch with no upstream is NOT a reason to stop: never having been pushed is precisely what makes amending safe.git commit --amend --only -s -F - with the corrected message (measured as in create step 8, sign-off left out) on standard input. --only keeps the current index out of the commit, so unrelated staged work is not swept in; -s keeps the sign-off last and does not duplicate one already there. Piping via standard input avoids both shell quoting problems and a shared temporary file.git show --stat HEAD that the message changed and the file list did not.When invoked without arguments or with just a message:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub marjovanlier/claude-plugins --plugin git-conventions2 skills in this plugin