writing-good-commits
Write or reword a git commit message and size the commit it describes. Use when committing, or when reshaping commits during a rebase.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 10
- Forks
- 2
01 前言 Front Matter
- name
- writing-good-commits
- description
- Write or reword a git commit message and size the commit it describes. Use when committing, or when reshaping commits during a rebase.
- user-invokable
- false
- disable-model-invocation
- false
03 SKILL.md 正文
Writing good commits
A commit message is what a maintainer reads in git log, git blame, and git bisect months later, with no PR or chat beside it. The subject names the change. The body says why the change was needed.
Edit the prose with the unslop skill.
Size
- Put one logical change in each commit. A change across many files is still one commit, and two changes in one file are two commits.
- Make every commit build and pass the checks, so
git bisectcan stop on any of them. Check a series withgit rebase -x '<check>' <base>. In a linked worktree, git exportsGIT_DIRto that command, so a test that builds scratch repos without unsetting it runs its git commands against the real repository; run such checks asenv -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE <check>. - Move or rename code in its own commit, with no edits mixed in.
- Split a commit whose message you cannot summarize in one subject.
Subject
Use Conventional Commits, type(scope): subject.
- The type is one of
feat,fix,perf,refactor,docs,test,build,ci,chore,revert, orstyle. A commit that fits two types is two commits. - The scope is a noun for the area, such as
subagentsorweb. Reuse the scopes ingit log --no-merges --format=%s -- <files>. - Write the subject in the imperative, so it completes "If applied, this commit will …". Start it lowercase unless it starts with an identifier or a proper noun, and end it without a period.
- Aim for 50 characters, and keep the whole header within 72.
- Say what changes, uniquely within the series. A bare file name or "address feedback" says nothing in
git log --oneline. - Mark a breaking change with
!before the colon, such asfeat(api)!: drop the v1 routes.
Body
Leave the body out when the subject says it all. Otherwise, after one blank line, wrap at 72 columns and cover:
- The problem, in the present tense: what the code does without this change.
- Why this approach, and the rejected alternatives a reader would ask about.
- The impact a user sees. Back a performance claim with a
before → afternumber.
Leave the how to the diff. Make the message self-contained: summarize a discussion rather than only linking it, and cite another commit as abc1234 ("subject"). Keep the process out: the commands you ran, review rounds, and "v2" notes belong in the PR.
Trailers
End with one trailer block after a blank line, one Token: value per line. Use only these:
BREAKING CHANGE: <what breaks and how to migrate>, alongside the!in the header.Closes #Nfor an issue the commit resolves.Refs: #Nfor a related issue or commit it does not resolve.
Example
fix(subagents): kill the child tree when the launcher exits
A SIGKILL to the launcher leaves grandchildren running, because
cleanup runs only on SIGTERM. Put each run in its own process group
and kill the group from the parent's exit hook. A pidfile sweep was
rejected because it races with PID reuse.
Closes #142
The same change written badly:
Fixed stuff in subagents and also updated docs.
Changed launcher.ts to call process.kill. Updated README. Ran tests.
It has no type or scope, uses the past tense, ends in a period, mixes two changes, restates the diff and the process, and never says why.
04 同仓库更多 Skills
changelog
Write the changelog entry for a pull request. Use when a PR changes behavior that users, operators, or integrators can notice.
writing-good-tickets
Write, file, or update an issue or ticket that an agent or a developer can take to one PR. Use when filing a bug or feature, updating an issue, or breaking a plan into tickets.
writing-good-prs
Write or update a pull request title and body that a reviewer can trust and own. Use when opening a PR or editing its description.
writing-for-agents
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
wizard
Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Use how for runtime behavior.