Create Commit
Preconditions — stop if any fails:
- The user asked to commit. Never commit on your own.
git branch --show-currentis not empty (detached HEAD) and notmain/master/develop, unless the user said to commit there.- You read
git status --short,git diffandgit diff --cachedfirst.
Steps:
- Stage only the paths of the current task with
git add <path>.... Nevergit add -Aorgit add .. If the set is unclear, or already-staged files are unrelated, ask. git diff --cached --check— stop on whitespace or conflict markers.- Find the project's own lint and test commands (
package.json,Makefile,nx.json,pyproject.toml,Cargo.toml, CI config). Run the ones affected by the change, after the last edit. Stop on non-zero exit. - Write the message using the
conventional-commitskill, in this shape:
<type>(<scope>): <description> [ABC-123]
Why:
<one reason>
Changes:
- <2–5 concrete outcomes from the staged diff>
Tests:
- <command> — <result> (or "not run — <why>")- Ticket: Jira-style key from the branch name (
feature/ABC-123-x→[ABC-123]); omit if none. - Body required for code changes; a trivial docs/format commit may skip it. Lines ≤ 100 chars.
- Pass subject and each section as separate
-marguments.
git commit. Never--no-verify. If a hook fails, fix and commit again — don't amend.- Report hash, subject, files and test results. Do not push, amend, rebase or open a PR.