# Writing Commit Messages

> Drafts commit messages from a staged diff, following conventional-commit style and focusing on why a change was made. Use when the user asks for a commit message, wants help writing one, or is about to commit staged changes.

- Skill: `thekrishprasad-cmd/writing-commit-messages` (Agent Skill)
- Install (CLI): `npx skillmds@latest add thekrishprasad-cmd/writing-commit-messages`
- Raw SKILL.md: https://api.skillmd.com/api/skills/thekrishprasad-cmd/writing-commit-messages/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: thekrishprasad-cmd (https://skillmd.com/u/thekrishprasad-cmd)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/thekrishprasad-cmd/writing-commit-messages

---


# Writing commit messages

## Process

1. Read the staged diff (`git diff --cached`), not just file names.
2. Identify the *type*: feat, fix, refactor, docs, test, chore.
3. Write a subject line: `type(scope): summary`, imperative mood, under 72 chars.
4. Only add a body if the diff needs context a reviewer wouldn't infer from the code — the reason for the change, not a restatement of what changed.

## Template

```
type(scope): short imperative summary

Optional body explaining why, not what — only if non-obvious.
```

## Avoid

- Listing every changed file in the body (the diff already shows that).
- Vague subjects like "fix bug" or "update code" — name the actual bug/change.
- Mixing unrelated changes into one commit message — flag it instead of summarizing both.

