Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when you want to replace a single large commit on the current branch, in place, with a sequence of small review-sized commits, each of which passes CI on its own. Every commit is 100% pure in its Conventional Commits type (refactor means zero behavior change). Automatically creates a timestamped backup branch before rewriting, and fully preserves the original commit's author, dates, and tree. Descendant commits are restacked automatically. Triggers: "split this commit", "break this commit in
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 209% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 65% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 197% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 125% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 136% | 0% |
Split a single commit on the current branch into multiple small commits, each sized so it can be reasonably evaluated in a single review pass, and rewrite the current branch's history in place to minimize reviewer cognitive load and missed defects. The pre-rewrite state is preserved in a timestamped backup branch.
/carve-it <commit-hash><commit-hash>: the commit to split (required; short form, full form, or relative specs such as HEAD~2 are accepted). Must exist on the current branch.Verify the following and abort if any check fails:
git merge-base --is-ancestor <commit> HEAD).<commit>..HEAD range.Pushed-commit check: if the target commit is already reachable from the upstream (e.g. origin/<branch>), warn that "after the rewrite, git push --force-with-lease will be required; if this is a shared branch, it will affect others", and obtain explicit confirmation before continuing.
After validation passes, collect and present:
<commit>..HEAD (to be restacked in Phase 4; if none, state explicitly that "the target is HEAD")Design a commit sequence that minimizes review cost. The number of commits varies with the size of the change (a few for small changes; 10-20 or more for large ones).
Split principles (in priority order):
Order commits from depended-upon to dependent.
For the green-constraint corollaries (when test-only commits are allowed), the full type-purity rules with worked violation examples (guards, changed constants, new I/O, error-policy changes), and the entanglement decision flow (refactor-first vs. combine-into-one), see references/purity-examples.md.
Design fields for each commit: commit number (3-digit zero-padded, starting at 001), target files (for files split across multiple commits, also the policy for intermediate states), added/deleted line counts, behavior (preserved/changed), estimated review load (low/medium/high), commit message (<type>: <short summary> plus body).
Type-vs-behavior consistency check (required before presenting): refactor/style/test/docs/chore/build/ci → preserved; feat/fix/perf → changed. If even one row is inconsistent, do not present the plan; redesign it.
Present the plan using the fill-in template in assets/plan-template.md — the approval block to render verbatim (with the {{...}} placeholders filled), the commit-message conventions for each subject, and how to handle the yes / no / adjust response. Do not proceed to execution (Phase 3 onward) until approval is given.
First create the backup branch (no checkout round-trip). Run the helper, which stamps the timestamp, refuses to overwrite an existing ref, and prints the created ref name for the completion report:
scripts/backup.sh <branch>This creates backup/<branch>/<YYYYMMDD-HHMMSS> pointing at the current tip.
Check out the target commit's parent as a detached HEAD and stack each commit on top of it in plan order. Show progress in the form ✓ [n/total] ....
Stage changes in only the following two ways (no patch application):
git checkout <target> -- <file> (use git rm for deletions).After staging, commit always carrying over the author and dates from the original commit.
For commits declared behavior-preserving (refactor/style/test/docs/chore/build/ci), read the diff and inspect for signs of behavior change: added/removed/changed conditionals / changed constant or literal values / new external calls or I/O / changed error-handling policy / changed meaning of public APIs. On detection, stop immediately and present remediation options (re-split with refactor-first, or move the change into the behavior-changing commit), deferring the decision to the user. See references/purity-examples.md for the concrete patterns to look for.
Confirm that the commit alone is green with a minimal run, and stop immediately on failure (never stack further commits on a red base). Do not run the full suite or the whole repository; fix the scope to these two rules:
scripts/verify-tree.sh <target> <constructed-tip> (exit 0 = identical trees; exit 1 = mismatch with a diff summary; it compares ^{tree} values via git rev-parse). If they match, the result is byte-for-byte identical, so if the original commit was green the final commit is green too (no full test/lint needed). If they differ, some diff was dropped or duplicated; present the mismatch and abort (switchover has not happened yet, so the branch is untouched — git switch <branch> returns to it). For the typical causes of a mismatch and how to diagnose each path, see references/troubleshooting.md.<commit>..HEAD oldest-first (--allow-empty to preserve empty commits; cherry-pick carries over author and dates). Because of tree equivalence, conflicts cannot occur in principle. If one does occur, it signals a dropped change, so abort (do not resolve it by hand; git cherry-pick --abort then re-examine — see references/troubleshooting.md).git branch -f <branch> <new-tip> → git switch <branch>.Present the following:
git log --oneline / git show)scripts/restore.sh --run <branch> auto-detects the latest backup; or manually git reset --hard backup/<branch>/<ts>), and the deletion command for when it is no longer needed (git branch -D backup/<branch>/<ts>)git push --force-with-lease is requiredgh-stack skill. Settle push state first — if the target was already pushed, run the git push --force-with-lease above before stacking; if it was never pushed, gh-stack can create and push the per-commit branches itself.git switch <branch> to return (construction runs on a detached HEAD). This is why the skill deliberately has no automatic-rollback mechanism: until switchover there is nothing to roll back.scripts/restore.sh --run <branch> (auto-detects the latest backup) or git reset --hard backup/<branch>/<ts>.For symptom-driven recovery — tree-equivalence mismatch, an interrupted detached-HEAD construction, a cherry-pick conflict during restack, a failed/empty restore — see references/troubleshooting.md.
Other measured skills in the registry, with their headline benchmark lift.