commit-msg
Generate a single-line commit message using the Conventional Commits format.
Steps
- Run
git diff --cached HEADto get the staged diff against HEAD. - If the diff is empty, run
git diff HEADto check for unstaged changes. If that is also empty, output:chore: no changes detectedand stop. - Analyze the diff and write ONE line in Conventional Commits format:
feat: ...for new featuresfix: ...for bug fixesrefactor: ...for restructuring without behavior changechore: ...for maintenance, deps, configdocs: ...for documentation onlytest: ...for adding or updating testsstyle: ...for formatting, whitespace, semicolonsperf: ...for performance improvementsci: ...for CI/CD changes- Add a scope in parentheses when the change is clearly scoped to one module, e.g.
fix(auth): ...
- Keep the message under 72 characters. Use imperative mood ("add", "fix", "update", not "added", "fixes", "updated"). Be specific but concise.
Output
Output ONLY the commit message — no quotes, no explanation, no markdown, no trailing newline. Just the raw message text. This is critical because the output will be used directly as: git commit -m "$(claude -p '/commit-msg')".