Agent skill
git-commit-hygiene
Draft and review Git commits and commit messages with an emphasis on atomic change sets and clean history. Use when asked to commit changes, propose commit messages, split/squash/rebase commits, or clean up a branch via fixup commits and interactive rebase/autosquash.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/git-commit-hygiene
SKILL.md
Git Commit Hygiene
Use this skill as the playbook for producing reviewable commits and clean commit history.
Default workflow
- Confirm intent: should we commit now, and should history be cleaned (fixups/rebase) or left as-is?
- Decide commit boundaries: identify independent changes and split them into separate commits.
- Stage intentionally: stage only what belongs in the current commit.
- Write the message: short imperative subject, optional body for rationale.
- (Optional) Clean up history: fixup commits + rebase/autosquash when appropriate.
Atomic commits
- Keep commits small, focused, and atomic.
- Avoid commits that mix unrelated changes (e.g., "Address feedback").
History hygiene
Prefer fixups and rebasing when working on a branch that isn’t upstream yet, or on a PR that is still in draft.
- Create a fixup commit against the target commit:
git commit --fixup <sha> - Autosquash during interactive rebase:
git rebase -i --autosquash <base> - If there are multiple fixups, repeat and rebase again until the branch tells a clean, coherent story.
Commit message guidelines
Follow these best practices when drafting commit messages:
- Write a short subject line:
- Up to 50 chars
- Start subject with a capital letter, don’t end with a period
- Use imperative mood (e.g. "Fix memory leak while scrolling widget")
- If the project uses conventional commits, use them too
- Leave a blank line between subject and body
- Only when needed (don’t force it for trivial changes), write a body:
- Wrap lines at 72 chars
- Focus on "what" and "why", not the "how"
- Explain the motivation
- Mention side effects, trade-offs, or alternatives considered
- Reference relevant issue IDs / tickets at the bottom if known
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?