description: Commit message writing standards for this repo applyTo: "**" #
Commit messages #
Apply these rules only when writing or revising commit messages.
Do not apply these rules to changelog entries, release notes, docs, PR prose, code comments, or TSDoc unless the task is specifically about commit messages.
A commit message is not just a Git label. It is a durable record for other developers reading history later to understand what changed, why it changed, and how the change should be interpreted.
Write commit messages so a reader can understand the important change without opening the diff first.
Keep commit messages clear enough that a changelog writer can reuse the key outcome later, but preserve the implementation-relevant detail and reasoning that release notes usually omit.
Core goal #
Use this priority order when writing a commit message:
- State what changed.
- State what you were trying to achieve and why the change was needed.
- State any migration or upgrade impact.
- Preserve the behavior, workflow, edge case, reasoning, or maintenance details that a future changelog writer would need.
The subject is the scan line. The body is where nuance goes.
Subject format #
Use Conventional Commits.
Use this shape:
type(scope?): short precise outcome summary
Replace type, scope, and the summary with real values.
Do not output placeholder text literally.
Do not use vague explanation verbs such as clarify, explain, document, improve, or update unless the rest of the subject names the exact fact, contract, rule, behavior, or workflow being documented.
Good:
fix(parser): preserve trailing blank lines in stringifyfeat(events): add outline-only section eventsdocs(instructions): clarify commit body expectationsperf(tokenizer): avoid substring allocation in delimiter scan
Bad:
<type>(<scope>): <description>fix: improve parserchore: update stuffdocs: update instructions
Subject rules #
- Use lowercase for the type.
- Use a single space after the colon.
- Do not end the subject with a period.
- Keep the subject specific and outcome-focused.
- Describe the result, not just the activity.
- Name the actual behavior, workflow, edge case, or repository outcome that changed.
- Avoid filler verbs such as
improve,update,enhance,clean up, oraddressunless the object makes the change concrete. - Prefer the most important outcome when the commit includes several changes.
Good:
fix(ast): keep heading end offsets aligned after recoveryfeat(cli): add --json extraction summary outputdocs(parser): explain why recovery never throws
Bad:
fix: improve parsingfeat: add new optionrefactor: clean up codedocs: improve docs
Choosing the subject when a commit has several changes #
A commit often includes one main change and several supporting changes.
The subject should name the highest-value outcome. The body should capture the important secondary details.
Do not turn the subject into a shopping list.
Bad:
fix(parser): handle headings, tables, and links better
Better:
fix(parser): recover table parsing after unmatched row delimiter
Body:
- stop recovery from swallowing following link tokens
- preserve heading parsing after malformed tables
- add regression coverage for mixed table and heading input
When to add a body #
Add a body when any of these are true:
- the change is not obvious from the subject alone
- the commit changes more than one important case
- the change is subtle or easy to misunderstand
- the commit has migration or upgrade impact
- the commit is likely to matter in a future changelog
- the subject would be accurate but incomplete without context
A good body explains:
- what was wrong or limited before
- what is true now
- the most important cases covered
- any migration, upgrade, compatibility, or rollout note if relevant
Prefer short bullets or short paragraphs. Keep the body concrete. Do not waste the body on empty filler.
Good:
- previously the final blank line could disappear when the source ended in
\r\n - stringify now preserves the original trailing blank line count
- keeps roundtrip output stable for range-based consumers
Weak:
- improve behavior
- add tests
- cleanup
- various fixes
Type-specific precision rules #
Different commit types need different kinds of specificity.
feat #
For feat, say what new capability now exists.
Good:
feat(events): add outline-only section eventsfeat(cli): add --json extraction summary output
Avoid:
feat: add supportfeat: improve API
fix #
For fix, say what broken behavior now works correctly.
Good:
fix(tokenizer): stop merging adjacent pipe runs across template boundariesfix(stringify): preserve trailing blank lines in CRLF input
Avoid:
fix: improve parserfix: handle edge cases
docs #
For docs, name the specific fact, contract, rule, workflow, guarantee, limitation, or migration step that the docs now make clear.
Good:
docs(text_source): explain that plain strings satisfy the TextSource contractdocs(parser): document why recovery never throwsdocs(events): define stack balancing rules for nested sectionsdocs(api): describe when callers must preserve UTF-16 offsets
Avoid:
docs: update docsdocs: improve readmedocs: clarify usagedocs(text_source): clarify purpose and usage of TextSource interface
Do not describe the writing effort in vague terms such as clarify, improve, or update unless the rest of the subject names the exact thing that is now easier to understand.
refactor #
For refactor, say what internal structure changed and why that matters.
Good:
refactor(events): split section balancing from text emissionrefactor(parser): isolate table recovery from inline parsing
Avoid:
refactor: clean up coderefactor: reorganize internals
Use refactor only when there is no intended behavior change.
perf #
For perf, say what got faster, smaller, or cheaper.
Good:
perf(tokenizer): avoid substring allocation in delimiter scanperf(stringify): reduce intermediate joins for large table outputperf(events): reuse section frame objects during recovery
Avoid:
perf: improve performanceperf: optimize code
If the improvement is measurable and worth mentioning, say what improved in the body such as allocation count, hot-path work, latency, or steady-state throughput.
test #
For test, say what behavior is now protected.
Good:
test(parser): add regression case for malformed heading recoverytest(tokenizer): cover adjacent pipe runs across template boundariestest(stringify): verify trailing blank line preservation with CRLF input
Avoid:
test: add teststest: improve coverage
bench #
For bench, say what benchmark coverage or measurement trust improved.
Good:
bench(tokenizer): add malformed table hot-path scenariosbench(parser): separate recovery cases from steady-state runsbench(stringify): compare CRLF roundtrip cost against baseline
Avoid:
bench: add benchmarksbench: improve perf tests
chore #
For chore, say what maintenance outcome changed.
Good:
chore(deps): pin jsr imports for reproducible installschore(repo): remove generated parser snapshots from source controlchore(scripts): standardize release script argument parsing
Avoid:
chore: clean up repochore: maintenancechore: update dependencies
Do not use chore as a bucket for meaningful fixes, behavior changes, or performance work.
build #
For build, say what build, packaging, or dependency behavior changed.
Good:
build(npm): include generated type maps in published packagebuild(jsr): stop bundling fixture files into release tarballs
ci #
For ci, say what pipeline or automation behavior changed.
Good:
ci(actions): fail release workflow when changelog generation is missingci(test): run parser regression suite on pull requests
Scopes #
Use a scope when it helps a reader locate the area of change quickly.
Good scopes:
parsertokenizereventsaststringifycliinstructionsdepsreposcripts
Avoid vague scopes such as:
miscgeneralstuff
Skip the scope if it does not add useful meaning.
Breaking changes #
Mark breaking changes with ! and explain the migration impact in the body or footer.
Example:
feat(api)!: remove implicit trim from align()
BREAKING CHANGE: Callers that relied on implicit trimming must call trimEnd() explicitly before align().
A breaking commit must make these things clear:
- what changed
- who is affected
- what they now need to do
Anti-patterns #
Avoid:
- typeless commits
- WIP commits on main
- vague subjects
- issue or PR numbers in the subject
- subjects that describe effort instead of result
- internal implementation detail with no meaning to later readers
- bodies that only say
add tests,cleanup, ormisc fixes - using
choreorrefactorto hide meaningful behavior changes
Final check #
Before finalizing a commit message, check:
- Can another developer tell what changed from the subject alone?
- If they read the body too, can they understand the problem and outcome without opening the diff?
- Would a future changelog writer know what details are worth carrying forward?
- If the commit is breaking, is the migration impact explicit?
- If the commit has several important changes, does the body capture the secondary details clearly?