Git commit

From abatilo/vimrc · View interactive version

Git commit is an AI agent skill from the GitHub repository abatilo/vimrc. This skill should be used whenever a git commit is about to be created, including when Claude decides on its own to commit at the end of a task. Use it instead of running `git commit` directly with Bash. Trigger phrases include "commit", "commit this", "commit these changes", "make a commit", "commi

How to use this skill

Skill file

Git Commit Skill

Create a set of logically grouped, atomic commits from the current changes.

Keep each commit's scope minimal. Stage parts of a file separately when it

contains changes that belong to different commits.

Process

  1. Analyze Current State
  1. Group Changes Logically

for the current commit. git add -p is interactive and does not work in

this environment, so stage hunks through a patch instead:

```bash

git diff -- path/to/file > "$TMPDIR/full.patch"

# Copy full.patch to part.patch and delete the hunks for other commits

git apply --cached "$TMPDIR/part.patch"

git diff --cached -- path/to/file

```

When hunks are too tangled to split by patch, temporarily edit the file

to the intermediate state, git add it, then restore the final state

  1. Create Commits

Commit Message Format Detection

For conventional commits, see references/conventional-commits.md for

types, scopes, and breaking-change syntax. The type and scope count toward

the subject length limits below.

Git Commit Message Best Practices

A diff shows what changed; only the message can say why. Follow these

seven rules from https://cbea.ms/git-commit/, adjusted for the project's

conventions:

  1. Separate subject from body with a blank line - git log --oneline,

shortlog, and rebase treat the first line as the subject

  1. Limit the subject line to 50 characters - A rule of thumb; 72 is the

hard limit, where GitHub truncates the subject

  1. Capitalize the subject line - Use lowercase when the project uses

lowercase conventional commits

  1. Do not end the subject line with a period
  2. Use the imperative mood in the subject line - The subject completes

"If applied, this commit will _". The imperative applies only to the

subject; the body can use normal prose

  1. Wrap the body at 72 characters - Git does not wrap text, so wrap it

by hand

  1. Use the body to explain what and why, not how - Describe the problem,

the previous behavior, why the change fixes it, and any side effects or

consequences a reader would not expect. The code already shows how

Not every commit needs a body. When the subject says everything, such as

Fix typo in user guide introduction, omit the body. When the change needs

context, write the body.

Pass a multi-line message through a heredoc so that the blank line and the

wrapping stay exact:

git commit -F - <<'MSG'
Summarize the change in about 50 characters

Explain the problem that this commit solves and why this approach
solves it. Wrap lines at 72 characters.

Resolves: #123
MSG

Put issue and pull request references in trailers at the end of the body,

matching the trailer style that the project already uses.

Examples

Good Examples (Traditional Style):

Good Examples (Conventional Commits):

Bad Examples:

Notes

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.