atomic-commits
БесплатноБез исполняемых скриптовНе проверенUse this skill when a working tree contains uncommitted changes that need to be split into a sequence of atomic commits — typically after a long session, an…
от NickCrew★ 76 звёзд на GitHubОб этом скилле
Atomic Commits
Overview
Take a dirty working tree of uncertain provenance and produce a clean, linear sequence of atomic commits where every commit builds, every commit could be reverted in isolation, and git bisect will land on a meaningful unit when chasing a regression. The agent does not assume it remembers what changed — it investigates, classifies, groups, then commits.
Core Principle: The Bisect Test
Every commit must satisfy this test:
If
git bisectlands on this commit alone, can the project still build, run its test suite, and be deployed? And does the commit's title accurately describe a single coherent change?
This produces two rules that govern every grouping decision:
- Smallest buildable + deployable unit. Do not split a change so finely that an intermediate commit fails to compile, breaks tests, or leaves an import dangling. A new module and its first caller belong together if the caller would not compile without the module.
- No smaller, no larger. Do not bundle two unrelated improvements just because they touched the same file. Two bug fixes in
auth.pyshould be two commits — bisect cannot tell which one introduced a regression if they ship together.
When the two pull in different directions, prefer the smaller commit and add the minimum scaffolding (e.g., a stub, a no-op default) needed to keep the tree green.
Workflow
Phase 1 — Survey
Before classifying anything, get a complete picture of the working tree.
git status --short
git diff --stat
git diff # unstaged
git diff --cached # staged (rare in this workflow but check)
git log -10 --oneline # recent history for tone/style of messages
If there are staged changes already, decide whether to keep them as-is (commit first) or unstage to reclassify (git reset HEAD) — but never use destructive resets. When unsure, ask the user.
Phase 2 — Investigate
Treat the diff as code written by someone else. For each modified file:
- Read the full diff for the file (
git diff -- path/to/file), not just the hunks summary. - Read surrounding code when the diff alone does not explain intent — function signatures, imports, related call sites.
- Note the kind of change for each hunk: feature addition, bug fix, refactor, test, docs, formatting, dependency bump, generated/lockfile, config, dead-code removal.
- Note dependencies between hunks: does hunk B import a symbol introduced by hunk A? Does a test in
tests/exercise a new function insrc/?
Write a brief mental (or scratch) inventory: a list of logical changes, each tagged with the files and hunks it spans. This inventory is what gets converted into commits.
Phase 3 — Group
Map the inventory of logical changes onto a commit sequence:
- One logical change → one commit. A bug fix and the regression test that proves it is one logical change and belongs in one commit.
- Order commits to keep the tree green. Foundations first (new module, then its callers; new field on a struct, then code that reads it; new test fixture, then tests using it). Never schedule a commit that depends on a symbol introduced by a later commit.
- Refactors are their own commits. A behavior-preserving rename or extraction should not ride along with a behavioral change. If a feature commit also contains an unrelated refactor, split them.
- Generated files travel with the change that regenerates them. A lockfile bump goes with the dependency change that caused it; a generated client goes with the schema change.
- Formatting-only changes are their own commit, ideally first or last. Mixing a reformat into a feature commit obscures the diff under review and confuses bisect.
- Docs, tests, and code touching the same change live together. Splitting these is over-fragmentation and breaks the "deployable" half of the rule.
If a single file contains hunks belonging to multiple logical changes, plan to use cortex git patch (Phase 4 — hunk-level path).
Phase 4 — Commit
Use the right tool for the shape of the commit.
File-level: cortex git commit
When every hunk in each named file belongs to the same logical change, commit the files whole:
cortex git commit "feat(auth): add OAuth2 device flow support" \
src/auth/oauth_device.py tests/auth/test_oauth_device.py
This stages the named files in full from the working tree and commits atomically. Use this whenever possible — it's the simplest and safest path.
Hunk-level: cortex git patch --diff
When a file contains hunks that belong to different logical changes, isolate the hunks for one commit via a diff fed through --diff. The files positional is an allowlist — the command will refuse to commit if the diff stages anything outside that list, so name only the files this particular commit should touch.
Two practical ways to produce the diff:
*Option A — interactive split via temp file.
Установить atomic-commits в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл atomic-commits?
Use this skill when a working tree contains uncommitted changes that need to be split into a sequence of atomic commits — typically after a long session, an agent hand-off, a rebase resolution, or anytime `git status` shows mixed work that was not committed as it landed. The skill assumes the agent has fresh context and did not author most of the diff, so it treats the working tree as evidence to investigate before grouping. Optimizes for `git bisect`: each commit is the smallest buildable and deployable unit, and no smaller. Uses `cortex git commit` for file-level commits and `cortex git patch --diff` when unrelated changes share a file.
Как установить скилл atomic-commits?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл atomic-commits запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic