atomic-commits

apfk88's avatarfrom apfk88

Enforce atomic git commits by committing only the files touched and listing each path explicitly. Use when asked to create commits, split changes, or stage files so each commit is focused and limited to specific file paths.

0stars🔀0forks📁View on GitHub🕐Updated Jan 10, 2026

When & Why to Use This Skill

This Claude skill streamlines version control by enforcing atomic Git commits, ensuring each commit represents a single logical change with explicitly listed file paths. It prevents messy commit histories by avoiding blanket staging commands like 'git add .', making codebases easier to audit, review, and maintain.

Use Cases

  • Refactoring Code: Separating structural code changes from functional updates to simplify the peer review process.
  • Selective Bug Fixing: Committing a critical hotfix while keeping other ongoing feature developments or debug logs unstaged.
  • Clean History Management: Creating a granular commit log that allows for precise 'git revert' operations and more effective use of 'git bisect'.
  • Multi-tasking: Managing multiple small tasks in the same workspace without accidentally merging unrelated changes into a single commit.
nameatomic-commits
descriptionEnforce atomic git commits by committing only the files touched and listing each path explicitly. Use when asked to create commits, split changes, or stage files so each commit is focused and limited to specific file paths.

Atomic Commits

Overview

Commit only the files touched for a single logical change. Always pass explicit paths to git commit and avoid blanket staging.

Workflow

  1. Inspect state: git status -sb, git diff, git diff --staged.
  2. Define the smallest logical change (one commit scope).
  3. Commit only the files in that scope with explicit paths.

Commands

Tracked files only

git commit -m "<scoped message>" -- path/to/file1 path/to/file2

New files included

git restore --staged :/ && git add "path/to/file1" "path/to/file2" && git commit -m "<scoped message>" -- path/to/file1 path/to/file2

Guardrails

  • Never use git commit -am or git add . for atomic commits.
  • Leave unrelated changes unstaged and uncommitted.
  • If a single file mixes concerns, split by hunks before committing.