Conventional Commit Message from a Diff
Writes a Conventional Commits message from a staged diff — correct type and scope, imperative subject under 72 chars, a body that explains why, and a warning when the diff should be split.
Prompt variables
2 variables detected — fill them and Copy inserts your values (0/2 filled).
Write a commit message for this staged diff, following the Conventional Commits spec exactly.
Format:
```
<type>(<scope>): <subject>
<body>
<footer>
```
Rules:
- **type**: one of feat, fix, refactor, perf, test, docs, build, ci, chore. Pick by the diff's actual primary effect, not by what was intended — a bug fix that also adds a test is `fix`, not `test`. `refactor` means observable behavior is unchanged; if any behavior changed, it is not a refactor.
- **scope**: the module/package/area from the file paths (e.g. `auth`, `api`, `parser`). Omit if the change is genuinely cross-cutting.
- **subject**: imperative mood ("add", not "added"/"adds"), ≤ 72 chars, no trailing period, specific — `fix(orders): handle null discount in total calculation`, never `fix: fix bug` or `chore: update code`.
- **body**: 2–5 lines explaining WHY the change was needed and any non-obvious HOW (tricky decision, rejected alternative, gotcha for future readers). Do not narrate the diff line by line — the diff shows what changed. Wrap at 72. Omit the body entirely for genuinely trivial changes.
- **footer**: `BREAKING CHANGE: <description + migration hint>` if any public API, config format, CLI flag, or schema changed incompatibly — inspect the diff for this even if it looks routine. Reference issues only if an issue number appears in the diff context or I provided one; NEVER invent ticket numbers.
Honesty checks:
- If the diff contains multiple unrelated changes (e.g. a feature plus a drive-by rename elsewhere), say so first and propose how to split it into separate commits, each with its own message. Then give the combined message anyway, marked as second-best.
- If you cannot determine why the change was made from the diff alone, write the body with `[WHY: fill in — e.g. what bug/request prompted this]` rather than inventing a motivation.
Extra context (optional): {{context}}
```diff
{{diff}}
```
Proof of work
Example outputs
⚠ This diff contains two unrelated changes: the retry logic in `http/client.ts` and a rename of `parseHeaders` → `readHeaders` across 6 files. Recommend splitting; messages for each below. Combined message (second-best): fix(http): stop retrying non-idempotent requests after connection reset POST and PATCH requests were re-sent when the connection dropped mid-response, causing duplicate order submissions under flaky networks (the Sentry spike from June 12). Retries are now gated on an idempotency allowlist; connection-reset on unsafe methods surfaces as RetryableError to the caller instead. Also renames parseHeaders to readHeaders for consistency with readBody (should have been its own refactor commit).
Comments (0)