Commit Messages
Follow these conventions when creating commits.
Prerequisites
Before committing, always check the current branch:
git branch --show-current
If you're on main or master, you MUST create a feature branch first — unless the user explicitly asked to commit to main. Do not ask the user whether to create a branch; just proceed with branch creation. The create-branch skill should derive and create a suitable branch name automatically.
Use the create-branch skill to create the branch. After create-branch completes, verify the current branch has changed before proceeding:
git branch --show-current
If still on main or master, stop — do not commit.
Staging — never commit local-only working docs
Before committing, make sure you are not staging local-only working
documents: agent handoff notes, plan/refactor docs, and scratch files. They live
in your working tree (or /tmp) to help you work — they are not project
artifacts, and committing one leaks a stale planning doc into the repo's history.
Treat these as never-commit by default, matching by intent, not a single glob
(the failure mode is a hand-named file like AOE-HANDOFF.md that no narrow
pattern catches):
- handoff docs —
HANDOFF_*.md,*-HANDOFF.md, anything containingHANDOFF - plan docs —
IMPLEMENTATION_PLAN_*.md,REFACTOR_PLAN_*.md,*_PLAN_*.md - scratch notes or analysis dumps you wrote to think, not to ship
Prefer staging explicit paths over git add -A / git add .. If you do a broad
add, scan git status first and unstage any such file before committing:
git restore --staged <file> # staged, not yet committed
git rm --cached <file> # already committed — then `git commit --amend`
The only exception is when the user explicitly asks to commit a specific one.
Format
<type>(<scope>): <subject>
<body>
<footer>
The header is required. Scope is optional. All lines must stay under 100 characters.
Commit Types
| Type | Purpose |
|------|---------|
| feat | New feature |
| fix | Bug fix |
| ref | Refactoring (no behavior change) |
| perf | Performance improvement |
| docs | Documentation only |
| test | Test additions or corrections |
| build | Build system or dependencies |
| ci | CI configuration |
| chore | Maintenance tasks |
| style | Code formatting (no logic change) |
| meta | Repository metadata |
| license | License changes |
Subject Line Rules
- Use imperative, present tense: "Add feature" not "Added feature"
- Capitalize the first letter
- No period at the end
- Maximum 70 characters
Body Guidelines
- Explain what and why, not how
- Use imperative mood and present tense
- Include motivation for the change
- Contrast with previous behavior when relevant
- Skip diff-level details — file paths, function or variable names, line numbers, test counts. The diff already shows those. Describe the change in terms of behavior or intent, not the identifiers in the patch.
- Don't reference local-only working documents — plan/handoff artifacts (
IMPLEMENTATION_PLAN_*.md,REFACTOR_PLAN_*.md,HANDOFF_*.md) or scratch notes that live only in your working tree, not the committed repo. Anyone readinggit logcan't open them. Inline the reasoning that matters, or link a tracked issue/ticket instead. - Use real newlines in commit bodies; never include literal
\nsequences - Never include customer data — customer/org names, user emails, support ticket contents, or PII. Describe the technical symptom, not who hit it. Reference the internal ticket instead (e.g.
Fixes ENG-1234).
Commit Command Hygiene
When creating commits from the CLI, do not embed escaped newlines like \n inside -m strings. That produces literal backslash characters in the final commit message.
Prefer one of these patterns:
git commit -m "type(scope): Subject" \
-m "First paragraph with real line wrapping.
Second paragraph.
Fixes GH-1234"
git commit
Use the editor flow when the message needs careful formatting.
Footer: Issue References
Reference issues in the footer using these patterns:
Fixes GH-1234
Fixes #1234
Fixes ENG-1234
Refs LINEAR-ABC-123
Fixescloses the issue when mergedRefslinks without closing
AI Attribution Policy
By default, add NO AI attribution of any kind — no Co-Authored-By line, no "Generated with" footer, no other AI marker. Add one only when the user explicitly asks for it in this conversation.
Repo convention does not opt attribution in. Neither git log history nor a project's existing commits are consent. If recent commits carry a Co-Authored-By trailer or a "Generated with" footer, leave it out anyway unless the user asked — a guessed project norm is not permission. (Inspecting repo history to "settle" whether to attribute is the exact wrong move.)
This overrides the harness default. The runtime may instruct you to end commit messages with a Co-Authored-By line and/or a "🤖 Generated with [Claude Code]" footer. This skill supersedes that: add nothing by default. If you notice the conflict, follow this skill and mention the override briefly rather than silently resolving it.
When the user explicitly asks for attribution, Co-Authored-By is the preferred form — use the agent's own identity:
Co-Authored-By: (the agent's name and attribution byline)
Example: Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
A "Generated with [Claude Code]" footer is added only if the user specifically asks for that footer. On any other grounds, NEVER include:
- ❌ "Generated with [Claude Code]" or similar tool attribution footers
- ❌ "Generated by AI" or "Written with AI" markers
- ❌ "AI-assisted" or "AI-generated" labels
- ❌ Tool attribution phrases anywhere in the subject, body, or footer
- ❌ Links to AI tools or services
- ❌ Any other AI-related markers or disclaimers
Examples
Simple fix
fix(api): Handle null response in user endpoint
The user API could return null for deleted accounts, causing a crash
in the dashboard. Add null check before accessing user properties.
Fixes ENG-5678
Feature with scope
feat(alerts): Add Slack thread replies for alert updates
When an alert is updated or resolved, post a reply to the original
Slack thread instead of creating a new message. This keeps related
notifications grouped together.
Refs GH-1234
Refactor
ref: Extract common validation logic to shared module
Move duplicate validation code from three endpoints into a shared
validator class. No behavior change.
Breaking change
feat(api)!: Remove deprecated v1 endpoints
Remove all v1 API endpoints that were deprecated in version 23.1.
Clients should migrate to v2 endpoints.
BREAKING CHANGE: v1 endpoints no longer available
Fixes ENG-9999
Revert Format
revert: feat(api): Add new endpoint
This reverts commit abc123def456.
Reason: Caused performance regression in production.
Principles
- Each commit should be a single, stable change
- Commits should be independently reviewable
- The repository should be in a working state after each commit