Raw view: Conventional Commits from a diff
No invisible, zero-width, or bidi-control characters detected.
---
name: conventional-commits
description: Writes a Conventional Commits message (type(scope): subject, body, footers) from a staged or unstaged git diff. Use whenever the user asks to commit, write a commit message, describe staged changes, or fix up a commit message, even if they do not say "conventional".
license: CC0-1.0
allowed-tools: Bash(git diff *) Bash(git status *) Bash(git log *)
metadata:
author: Waxmark
version: "1.0.0"
---
# Conventional Commits
Produce one commit message that a reviewer can trust without opening the diff.
## Procedure
1. Inspect what will be committed. Prefer the staged diff; fall back to the working tree.
```bash
git status --short
git diff --cached --stat
git diff --cached
```
If nothing is staged, say so and show `git diff --stat` instead of guessing.
2. Match the repo's existing style before writing: `git log --oneline -15`. Reuse its scopes (`auth`, `api`, `deps`) and its casing. A repo that uses `Feat:` keeps `Feat:`.
3. Classify the change with exactly one type from the table. When a diff mixes types, name the dominant one and suggest a split in a short note after the message.
4. Write the message in the format below. Then re-read it against the diff: every claim in the body must be visible in the diff.
## Format
```
<type>(<scope>): <subject>
<body>
<footer>
```
- **type**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`.
- **scope**: optional, lowercase, the module or area touched (`parser`, `deps`, `ci`). Omit when the change is repo-wide.
- **subject**: imperative mood, no trailing period, 50 characters target, 72 hard maximum. "add retry to fetchUser", not "added" or "adds".
- **body**: wrap at 72 columns. Explain what changed and why, not how; the diff already shows how. Skip the body for trivial one-liners.
- **footer**: `BREAKING CHANGE: <description>` for incompatible changes (also add `!` after the type/scope: `feat(api)!:`). Reference issues as `Closes #123` or `Refs #123`.
## Type selection
| Diff shows | Type |
|---|---|
| New user-visible capability | `feat` |
| Corrects wrong behavior | `fix` |
| Only comments, README, docstrings | `docs` |
| Same behavior, different structure | `refactor` |
| Measurable speed or memory change | `perf` |
| Only test files | `test` |
| Lockfile, package manifest, bundler config | `build` |
| Workflow files under `.github/`, `.gitlab-ci.yml` | `ci` |
| Formatting, whitespace, lint autofix | `style` |
| Anything else that touches no source behavior | `chore` |
## Examples
**Input:** diff adds exponential backoff to `src/http/client.ts` and a test.
**Output:**
```
fix(http): retry transient 5xx responses with exponential backoff
Requests that hit a 502 from the upstream gateway failed immediately.
Retry up to 3 times with 200ms base delay and jitter so brief outages
no longer surface as user-facing errors.
Closes #418
```
**Input:** diff renames `getUser` to `fetchUser` across 14 files; public export removed.
**Output:**
```
refactor(api)!: rename getUser to fetchUser
BREAKING CHANGE: `getUser` is no longer exported. Import `fetchUser`
from the same module.
```
## Output
Return only the commit message in a fenced block, followed by at most two sentences of notes (split suggestion, unstaged files, unclear intent). Do not run `git commit` unless the user asked for it.