name: commit description: Stage and create git commits using Conventional Commits / commitizen style (type(scope): subject, imperative mood, focused per-change, path-scoped, no co-author trailer). Use whenever the user wants to commit the current changes.
commit
Create one or more git commits for the current changes, following the Conventional Commits / commitizen standard.
Format
type(scope): subject
- type — one of:
feat,fix,chore,refactor,docs,test,ci,perf,style,build - scope — the affected area (a module, a crate, a page); omit only when
the change is genuinely cross-cutting. Follow the scopes
git logalready uses in the repository. - subject — imperative mood, lower-case, no trailing period ("add", not "added" / "adds")
- body — wrap at ~72 cols and explain the why, not the what.
Required for
feat,fixandperf, and for any commit touching 5+ files. Optional only for mechanicalchore/docs/style/build.
The body is where the reasoning is kept
An empty body on a large landing is a bug, not a style choice. The big
feature landings are exactly the ones tempted to explain nothing, and the
finding that made one work (on cartopolis: the road graph must be noded, or
ordinary routes silently return NoPath) then survives nowhere in git.
Before writing the body, ask four questions. Any yes must reach the body:
- Did I measure something? Numbers, and how they were obtained.
- Did I reject something? The alternative, and the reason it lost.
- Did I hit a constraint from outside the codebase? Upstream policy, licence, a browser/platform limit, a format quirk.
- Did something bite me silently? A failure that produced a plausible wrong answer instead of an error.
Four noes → a one-line subject is the honest message. Don't pad.
Commit or note?
Ask: will this still be true after the next ten commits?
- No — it explains this diff → commit body. Frozen with the code it describes.
- Yes — it constrains all future work → also write it where the project
keeps standing facts (its
CLAUDE.mdsays where — cartopolis:docs/notes/), which is edited in place and found by topic. A commit message cannot be updated when it stops being true, and nobody grepsgit logbefore editing a file.
Standing constraints, external-world facts, and directions abandoned without a diff are the note's job — the last of these has no commit to attach to at all.
Rules
- Prefer focused commits per logical change — if the working tree mixes unrelated changes, split them into several commits rather than one.
- A subject that lists several things ("routing, screenshots, vector tiles", anything joined by a comma or "and") is the signal to split, not to write a longer subject. Each part then gets its own body.
- Stage by path (
git add <path> ..., or hunks withgit add -pwhen a file mixes two changes) and commit what is staged, so a parallel session's files aren't swept in.git commit -- <path>commits the working tree of those paths and silently undoes hunk staging: use it only when every change in them belongs to this commit. - Never add a
Co-Authored-By:or any attribution / co-author trailer. - Never commit a secret or private information (a token, key or password;
a real name, e-mail address, hostname, public IP, device name or screenshot
of the live workspace) without the owner's explicit permission for that
item. Fixtures use made-up names (
sam,acme/…,example.org, TEST-NET addresses, keys generated for the test). - A binary you did not make is a stop. Before staging, look at what is
new:
git status --porcelain | grep '^??'and, for anything over 1 MB,fileit. Acore,core.<pid>, a browser profile or a.dumpnever goes in — twelve 28 MB core dumps of a crashed headless browser, the agent's environment and its tokens inside, were committed beside mockups by staging the folder (2026-11). Stage files, not folders. - Don't commit on the default branch if the change warrants a branch — ask first.
- Don't push unless explicitly asked.
Steps
- Run
git statusandgit diff(andgit diff --staged) to see all changes. - Group them into logical commits.
- For each group: stage its paths and commit with a compliant message. If the
group is
feat/fix/perfor spans 5+ files, answer the four questions above and write the body before committing. - Show the resulting
git log --onelinefor the new commits so the user can confirm, and flag any commit that ended up bodiless despite qualifying.
If the user passed extra guidance as arguments, honor it (e.g. how to split the commits, a specific scope, or an explicit message).