commit-messages

rockorager's avatarfrom rockorager

Write clear commit messages. Use when asked to commit changes, write a commit message, prepare a commit, or describe changes for version control.

⭐1stars🔀1forks📁View on GitHub🕐Updated Dec 14, 2025

When & Why to Use This Skill

This Claude skill streamlines the version control workflow by generating clear, professional, and atomic Git commit messages. It automatically analyzes code changes, stages files or specific hunks, and crafts messages following industry best practices—including imperative mood, character limits, and structured body paragraphs—to ensure a clean, readable, and searchable project history.

Use Cases

  • Case 1: Automating the creation of descriptive commit titles and bodies after complex code changes to maintain a high-quality git log without manual effort.
  • Case 2: Breaking down large updates into small, atomic commits by staging specific hunks and generating unique, logical messages for each change.
  • Case 3: Ensuring team-wide compliance with commit conventions, such as using the imperative mood and adding mandatory trailers for bug fixes or regression tracking.
  • Case 4: Improving long-term codebase maintainability by providing clear 'why' explanations in commit bodies, making future debugging and code reviews significantly more efficient.
namecommit-messages
descriptionWrite clear commit messages. Use when asked to commit changes, write a commit message, prepare a commit, or describe changes for version control.

Committing Changes

Make small, atomic commits with clear messages.

Workflow

1. Understand the Changes

If you don't already understand the changes, review them first:

git diff HEAD
git status --short

2. Stage and Commit

Make small, atomic commits—each commit should address one logical change. If your work spans multiple concerns (e.g., a refactor and a bug fix), break it into separate commits.

# Stage entire files
git add <files>

# Or stage specific hunks for finer control
git hunks list                            # List all hunks with IDs
git hunks add 'file:@-old,len+new,len'    # Stage specific hunks by ID

git commit -m "title" -m "body paragraph"

3. Commit Message Format

Title (first line):

  • Limit to 60 characters maximum
  • Use lowercase except for symbols or acronyms
  • Use imperative mood ("add feature" not "adds feature")
  • Use a short prefix for readability in git log --oneline (avoid "fix:" or "feature:" prefixes)

Body:

  • Explain what the change does and why
  • Use proper grammar and punctuation
  • Use imperative mood throughout

Trailers:

  • If fixing a ticket, add appropriate trailers
  • If fixing a regression, add a "Fixes:" trailer with the commit id and title