commit-message

A command that reads staged Git changes and writes a conventional commit message, a standard format that labels the kind of change such as a feature, bug fix, test, or documentation update.

In plain words
What is it for?
Use it after running `git add` to identify the main change type and scope, then produce a concise subject and supporting commit details from the diff.
Why use it?
It removes the need to work out the commit wording manually and keeps a project’s history consistent. It also refuses to proceed when no changes have been staged.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/halflength-ampleness75/claude-code-recipes/commit-message
Clone the repo
git clone --depth 1 https://github.com/halflength-ampleness75/claude-code-recipes
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 698 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00008 $0.00698
Opus 5 $0.00004 $0.00349
Sonnet 5 $0.00002 $0.00140
Haiku 4.5 $0.00001 $0.00070

Measured 2d ago against content hash 5ed0f46185d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

commit-message scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/commit-message.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate a well-structured conventional commit message from the currently staged git changes.

Step 1 — Get the Staged Diff

Run git diff --cached to see what is staged. Also run git diff --cached --stat for a file summary.

If nothing is staged, inform the user: "No changes are staged. Run git add first, then invoke this command again." Then stop.

Step 2 — Determine the Commit Type

Analyze the diff to select the most appropriate type:

Type When to Use
feat A new feature or user-facing capability
fix A bug fix
refactor Code restructuring with no behavior change
perf A performance improvement
test Adding or updating tests only
docs Documentation-only changes
style Formatting, whitespace, semicolons — no logic change
chore Build scripts, CI config, dependency bumps, tooling
ci CI/CD pipeline changes
build Build system or external dependency changes
revert Reverting a previous commit

If the diff spans multiple types, choose the dominant one. If it is truly mixed, prefer feat > fix > refactor > chore.

Step 3 — Determine the Scope

Identify a short scope in parentheses that indicates the area of the codebase:

  • Module or package name: feat(auth):, fix(payments):
  • Component name: refactor(Button):
  • Layer: test(api):, docs(readme):

Omit the scope only if the change is truly project-wide.

Step 4 — Write the Subject Line

Format: type(scope): imperative description

Rules:

  • Use imperative mood ("add", not "added" or "adds")
  • Do not capitalize the first word after the colon
  • Do not end with a period
  • Keep it under 72 characters
  • Be specific — "fix null check" is too vague; "fix null dereference in user lookup when email is missing" is good

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 79 lines · 8 tokens per session scan A 5ed0f46185d2

Subscribe to this mod's changes

commit-message is a command published in the GitHub repository halflength-ampleness75/claude-code-recipes (2 stars, last pushed 3d ago), licensed MIT. It adds 8 tokens to every session and 698 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories