Skip to content

commandGit and releases

Commit Message

Writes a Conventional Commits message from your staged changes, shows it to you and commits only after you say yes.

npx workspacetemplates add commit-message --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/commit-message.md14 lines · 1.2 KBFile
---
description: Writes a Conventional Commits message from your staged changes, shows it to you and commits only after you say yes.
argument-hint: "[optional scope or ticket id]"
---

Write a commit message for the staged changes. Extra context from the user: $ARGUMENTS

1. Run `git diff --staged --stat` and then `git diff --staged`. If nothing is staged, stop and say so. Do not stage anything yourself.
2. Run `git log -n 10 --oneline` and copy the project's habits for scope names and tense.
3. Pick one type: feat, fix, refactor, perf, docs, test, build, ci, chore. If two types fit, the diff is probably two commits: say so and propose the split by file.
4. Write the subject as `type(scope): summary`, imperative mood, lower case, no period, at most 72 characters. Use the scope or ticket id from the user's text when given.
5. Add a body only when the reason is not obvious from the subject. Explain why the change was needed and any trade-off, wrapped at 72 columns. Add `BREAKING CHANGE:` in the footer if a public interface changed.

Show the message in a code block, then ask: "Commit with this message?" Run `git commit` only after a clear yes. Never use --no-verify and never amend an existing commit.

What it does

Good commit messages explain why a change exists, and that is the part people skip when they are tired. This command reads what is staged, works out the one thing the change does and drafts a message in the Conventional Commits format.

It never stages files for you and never commits without an answer. If the staged diff mixes unrelated work, it says so and suggests how to split it.

Example

you › /commit-message PAY-214

agent › fix(checkout): reject expired coupons before totals are computed

Expired coupons were applied and then removed on the confirm step, so the
cart total jumped. Validate the expiry date in applyCoupon() instead.

Refs: PAY-214

Commit with this message?

Questions

Will it stage my files?
No. It only reads what you have already staged and stops if the index is empty.
What if my changes are unrelated?
It tells you the diff covers two concerns and lists which files belong to each, so you can split the commit.
  • Branch Cleanup

    CommandGit and releases

    Free
  • Changelog Entry

    CommandGit and releases

    Free
  • Cherry Pick Fix

    CommandGit and releases

    Free
  • Fixup Commits

    CommandGit and releases

    Free