askill
atomic-commits

atomic-commitsSafety 90Repository

Split staged git changes into logical atomic commits. Use when asked to "commit atomically", "split my changes", "make atomic commits", or "create separate commits".

7 stars
1.2k downloads
Updated 2/8/2026

Package Files

Loading files...
SKILL.md

Atomic Commits

Split staged changes into multiple logical commits. Each commit does ONE thing.

Priority Order (for format, language, types, scopes — everything)

  1. User's explicit instructions — always wins
  2. Project config — .commitlintrc*, .czrc, .babygit.json
  3. Recent commits — match style from git log --oneline -10
  4. Defaults — Conventional Commits, English

How It Works

1. Check prerequisites

git diff --cached --name-only
  • 0 files? → Tell user "Nothing staged. Run git add first."
  • 1 file? → Ask: "Only one file staged. Want a single commit or split by hunks?"

2. Detect conventions

Check for config: ls .commitlintrc* .czrc .babygit.json 2>/dev/null

If found → read and extract types, scopes, format rules. If not → analyze git log --oneline -10 for patterns.

3. Get diffs and think about grouping

For each file: git diff --cached -- <file>

Reasoning for grouping:

  • Same feature/module? → together (auth.ts + auth.types.ts)
  • Test + implementation? → together (utils.ts + utils.test.ts)
  • Unrelated purpose? → separate (feature vs deps vs docs)
  • Config/deps changes? → usually separate commit

Ask yourself: "If I need to revert just THIS change, can I do it with one commit?"

4. Validate before showing

  • Every staged file in exactly one group? ✓
  • No file in multiple groups? ✓
  • Commit messages match detected format? ✓

5. Show and confirm

Proposed commits (3):

1. feat(auth): implement OAuth2 flow
   └─ src/auth/oauth.ts, src/auth/types.ts

2. feat(ui): add login button
   └─ components/LoginButton.tsx

3. chore(deps): update dependencies
   └─ package.json, bun.lock

[Y]es / [E]dit / [C]ancel?

On Edit → let user reassign files or change messages. On Cancel → stop, leave everything staged as-is.

6. Execute commits

For each group in order:

git stash push -q                    # Save current state
git reset HEAD . -q                  # Unstage all
git add <files-in-group>             # Stage this group only
git commit -m "<message>"            # Commit

After all groups done:

git stash pop -q 2>/dev/null || true # Restore if anything left

If any commit fails → stop, show error, don't continue.

Edge Cases

SituationAction
No staged filesTell user, stop
1 file onlyAsk if split by hunks or single commit
Binary filesInclude in commits, skip diff analysis
Pre-commit hooksWarn user they will run
Commit failsStop immediately, show error
User wants to editAllow reassigning files between groups

Commit Message Format

Default (Conventional Commits):

<type>(<scope>): <description>

- detail 1
- detail 2

Types: feat fix refactor chore docs test style perf ci build

Adapt format based on Priority Order above.

Example with User Override

User: "commit atomically, use gitmoji, write in russian"

Staged: auth.ts, auth.test.ts, package.json

Output:

1. ✨ добавить OAuth2 аутентификацию
   └─ auth.ts, auth.test.ts

2. ⬆️ обновить зависимости
   └─ package.json

User instruction (gitmoji + russian) overrides any project config.

Troubleshooting

ProblemCauseSolution
Pre-commit hook failsLinting/formatting errorsFix the issue, re-stage, create NEW commit (don't amend)
Stash conflictUncommitted changes conflict with stashResolve manually with git stash show -p | git apply
"Nothing to commit"All files already committedCheck git status, ensure files are staged
Permission deniedNo write accessCheck file permissions, repository ownership
Commit partially appliedScript interrupted mid-executionRun git stash pop to recover, start over

Present Results to User

When presenting the commit plan, use this format:

Proposed commits ({N}):

1. {type}({scope}): {description}
   └─ {file1}, {file2}

2. {type}({scope}): {description}
   └─ {file1}

...

[Y]es to commit all / [E]dit to modify / [C]ancel

After successful execution:

✓ Created {N} commits:
  • {hash1} {message1}
  • {hash2} {message2}

On failure, stop immediately and show which commit failed and why.

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/12/2026

A highly structured and actionable skill for creating atomic git commits. It includes robust logic for grouping changes, handling configurations, and executing commands safely with user confirmation.

90
95
90
95
95

Metadata

Licenseunknown
Version1.0.0
Updated2/8/2026
PublisherNeverSight

Tags

ci-cdpromptingsecuritytesting