Writing commit messages

From brennovich/my-favorite-things · View interactive version

Writing commit messages is an AI agent skill from the GitHub repository brennovich/my-favorite-things. Use when creating a git commit, writing a commit message, or preparing a squash-merge message

How to use this skill

Skill file

Writing Commit Messages

Overview

In a mostly monolithic codebase shared by multiple teams, commit history is read by people outside the original author's team, often long after the change was made, and is critical during incidents. Write every message with that audience in mind.

Once a PR is merged, commits are squashed into one. Treat that final squash message as permanent project history and make it count.

Workflow

  1. Review the full diff. Identify the key modifications, enhancements, or fixes — note critical details and possible mistakes.
  2. Only change code if it's required for functionality or to fix mistakes; don't refactor or polish surrounding code.
  3. For logically distinct changes within the same PR, use separate commits to keep them isolated and easier to review.
  4. Write the message following the rules below.

Title (first line)

Body

General Rules

Example

Capitalized, short (50 chars or less) summary

More detailed explanatory text, if necessary.  Wrap it to about 72
characters or so.  In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body.  The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.

Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
or "Fixes bug."  This convention matches up with commit messages generated
by commands like git merge and git revert.

Further paragraphs come after blank lines.

- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, followed by a
  single space, with blank lines in between, but conventions vary here
- Use a hanging indent
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.