hoc-git-commit
Conventions for git commits, in either message format. Use before writing a commit message, and before splitting a working tree into commits. The order…
by openreachtech★ 17 GitHub stars
Install hoc-git-commit in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Git Commit
Conventions for what goes into one commit and how that commit is described.
These are two concerns decided at two different moments:
- Granularity is decided while working — which changes get staged together.
- Format is decided at commit time — how the staged change is worded.
Granularity comes first. A badly scoped commit cannot be rescued by a well-written subject line, because the subject is then forced to describe several unrelated things at once.
Choosing the format
Two message formats are in use across projects. They are not interchangeable within a repository — one repository uses one format throughout its history.
Resolve which one applies, in this order.
The project's
CLAUDE.md. A project declares its format under a## Commit message formatheading:## Commit message format - Format: imperativeThe accepted values are
imperativeandconventional.The existing history, when
CLAUDE.mddeclares nothing. Read the recent non-merge subjects and count how many carry a type prefix:git log --no-merges -n 30 --pretty=format:'%s'If most of them begin with a lowercase word and a colon —
feat:/fix:/refactor:/docs:and the rest, optionally with a scope, as infeat(resolver):— the project uses conventional. Otherwise it uses imperative. The types themselves are listed in the conventional format file; read the ones named here as examples, not as the whole set.Default to imperative when the history is too short to judge, as in a new repository.
- Never mix the two formats within one repository. A history that is genuinely split down the middle is a defect to raise with the user — it is not a licence to choose per commit.
- When a project's resolved format contradicts what the user asks for in the moment, follow the user for that commit, but tell them which format the repository otherwise uses.
- Once resolved, follow the matching detail file: format-imperative.md or format-conventional.md.
The resolved format governs what to write, never how to read
A history may hold subjects in any other convention — written before the project settled on one, or by another team, or by hand in a hurry — and those commits are still the record of what happened. So when searching for where something changed, do not filter on the resolved format alone.
git log --format='%h %s' <range> # no filter
git log --format='%h %s' <range> | grep -P '^\S+ [a-z-]+(\([^)]*\))?!?: ' # type prefixes
Filter the subject line, as above, rather than reaching for --grep: that searches the whole
message, so it also matches trailers such as Co-Authored-By:. And treat any subject filter as
a shortcut rather than a guarantee — read the range's subjects, or its diff, without one before
concluding that a change is not in the history.
Rules that apply to both formats
Subject line
- The subject is a single line, and carries no trailing period.
- Keep the subject below 72 characters as much as possible. This is a target, not a hard
limit — most subjects should clear it, and a minority legitimately will not.
- When a subject runs long, the usual cause is that the commit is doing more than one thing. Reach for granularity.md first: splitting the commit shortens both subjects and is the fix that actually improves the history.
- The other legitimate cause is a long but precise identifier. Here the target yields:
naming
BaseRestfulApiLauncher#createResponseBodyParser()in full is worth more than hitting 72. Never truncate, abbreviate, or paraphrase an identifier to fit. - What the target rules out is padding — the redundant trailing clause that restates what the identifier already says. Cut the clause, not the identifier.
- Describe the change, not the activity that produced it.
wip,save progress,Update files, andAddress feedbackdescribe a working session; they tell a later reader nothing about what the tree now does differently. (Two commits are deliberate exceptions: the branch-opening marker below, which carries no changes at all, and the throwaway save point in granularity.md, which is deleted before anyone reads it.) - A subject names the work, never the paths it touched. A path is where the change landed,
and a list of paths is the diff's own table of contents, which the reader already holds.
Add the API reference of AlphaClasssays what was done, andAdd docs/en/api/AlphaClass.mdsays only where it ended up; a subject written that way grows one path for every file the work reaches. What anAddbrings and what aPurgetakes away are named by what they are — `Add RE
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- references/format-conventional.md
- references/format-imperative.md
- references/granularity.md
FAQ
What does the hoc-git-commit skill do?
Conventions for git commits, in either message format. Use before writing a commit message, and before splitting a working tree into commits. The order commits land in belongs to the commit order convention; the branches commits land on, and the two commits a branch makes about itself, to the git branch convention; the commands that gate a commit, to the workflows convention.
How do I install the hoc-git-commit skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the hoc-git-commit skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…