No slash command · from git-commit
Guides writing structured Git commit messages with subject, body, and trailers. Covers formatting, scoping, breaking changes, and factual why-the-change reasoning.
Ships in git-commit. 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.
A commit message is a factual record of one change. It tells the reader why the change happened. The reader has the diff and the docs. The message adds only what the diff and the docs cannot show.
[scope] subject
body
trailers
-- or -.->, <-, and <->.- or *.Some environments break these symbols, and the symbols add no information.
[scope] <verb> <description><verb> <description>[parser] — a top-level project[core/auth] — a nested path[web/api] — a component in a projectDerive the scope from the file paths, not from the file contents. Use the common parent directory, or the most
significant component that you changed. Use one spelling for one component. [myapp/backend] and [myapp/b] in the
same log break the filtering that the scope exists for.
A path can hold a version directory such as v2. Omit the segment while one version is alive: write [core/engine],
because the reader has one candidate. Write [core/engine/v1] and [core/engine/v2] when both versions are alive,
because the segment is then the distinction that matters.
run X, confirm Y). Never give the results that you produced in this session.Wrap each body line at 72 characters. This is a hard limit. Git tools such as log, format-patch, and email expect
72-character body lines. Trailers are the only exception.
Each paragraph after the first earns its lines, or it goes. A paragraph earns its lines when it records a fact that the diff and the docs cannot show:
BREAKING: declaration, or a step of the migration path.The reason itself depends on the kind of change:
The length follows the number of reasons, not the size of the diff. A refactor of 2000 lines with one reason gets one paragraph. A migration with 6 steps gets the 6 steps. A body of 20 lines is correct only when 20 lines of reasons, declarations, and steps exist. Such a body usually holds a walkthrough, or a second unit that belongs in its own commit.
More than one behavior change. One unit can change several behaviors. Give one line to each change, in one list. Do not give a paragraph to each change:
- <behavior that the caller sees, present tense>.
- <behavior that the caller sees, present tense>
<continuation of the same item, indented two spaces>.
Mark each item with -. A wrapped line then keeps its item visible in git log. Each line gives the behavior that the
caller sees, without the old behavior as a contrast. A line that names a file, a function, or a test inventories the
diff. Delete such a line.
The list does not license a longer body. Several behavior changes under one reason stay in one commit, and the reason keeps its paragraph. Two independent reasons are two commits, whatever the number of behavior changes.
These signs show that a body became documentation:
Two tests. Apply both to each paragraph.
The diff carries the what. The message carries the why. A body can use fragments, and it can drop articles where the meaning stays clear. Identifiers, file paths, and error strings stay exact.
The tense carries the timeline. State the current behavior in the plain present tense, because the commit itself
marks the "now". The past tense belongs to the cause of the change, and to nothing else:
Empty input dereferenced nil. Returns empty token list instead.
Never include:
BREAKING: change removes.Co-Authored-By: trailer, or write nothing.[parser] update parser code becomes [parser] handle empty input.BREAKING: <what is broken>
<explanation and migration path>
Write the BREAKING: prefix in capital letters. Give a short description of what breaks after it. The paragraphs that
follow explain the reason and the migration path. Write a migration path of more than one step as a numbered list under
a Migration: line.
Trailers are structured key-value pairs at the end of the commit message. They use the git-trailer format.
A blank line separates the body from the trailers. Each trailer stays on its own line, in the form `Key-Name: value`.Task: — a link to the issue tracker — Task: https://tracker.example.com/PROJ-123Fixes: — the issue that this commit corrects — Fixes: #456Refs: — related issues or commits — Refs: #123, #124Closes: — the issue that closes at merge time — Closes: #789See: — related documentation — See: docs/auth.mdReviewed-By: — the code reviewer — Reviewed-By: Alice <[email protected]>Co-Authored-By: — an additional author — Co-Authored-By: Bob <[email protected]>Write each trailer key in Title-Case. Keep each value on one line. For more than one value, use a comma-separated list, or repeat the trailer.
An amended commit replaces the original commit and rewrites the history. The final message must describe what the commit introduces. It must not describe the sequence of revisions.
Common violation: the agent treats the amend as iterative work. It then describes the changes against the original commit: "also update the tests", "fix the edge case from the previous version", "address review feedback". The reader has no access to the original commit, and no context for "also" or "previous".
Correct approach: read the full staged diff after the amend. Then write a message that describes the complete change as one introduction. Ignore the original message and start again.
Commits must look like regular developer commits.
## Core PrinciplesBREAKING:What SKILL.md sets; muted values are Claude Code's defaults
Invoke whenever a commit message is touched at all — writing, reviewing, validating, amending, or correcting one the validator rejected. Also invoke on the symptoms: a body that walks the reader through the new code, a subject that sells the change, a message that records the test results of the session. Covers the message text; splitting the work into units belongs to the commit skill.
Three short reads, in order
npx claudepluginhub xobotyi/cc-foundry --plugin git-commit2 skills in this plugin
Other plugins' skills for the same job