| name | graphite-create-stack |
| description | Turn uncommitted working-tree changes into a Graphite stack by slicing the dirty diff, temporarily stashing later slices so validation sees only the current slice, using `gt create` to mint each new branch, and verifying the final top branch matches the saved tree exactly. Use when the user wants to stack WIP, a dirty worktree, unstaged changes, or local changes that are not committed yet. |
Graphite Create Stack
Use this skill when the user wants to turn uncommitted working-tree changes into a Graphite stack.
For normal day-to-day gt work, use .cursor/skills/graphite/SKILL.md.
If the task is to split an existing committed branch or preserve or close an
existing PR, use .cursor/skills/graphite-split-stack/SKILL.md instead.
Defaults
- Start from a dirty working tree on the current branch.
- Keep the current branch as the stack base. Do not ask which resulting slice
should keep the current branch name.
- Build the stack oldest to newest with this loop: stage the current slice,
stash later slices so validation sees only the current slice, run validation,
use
gt create, restore the stash, and repeat.
- It is acceptable for an intermediate branch to add temporary compatibility
code, placeholder wiring, or a shim if that is required to keep that branch
buildable and testable. That temporary code should be planned up front and
removed by later branches so the final top-branch tree still matches the
saved working-tree target exactly.
Before Mutating
- Confirm the current branch is safe to stack from:
- dirty worktree
- no rebase in progress
- an editable current branch, including trunk
- Capture:
- current
HEAD SHA
- the target tree for "commit everything at once"
- Ask the user to confirm:
- the ordered slices
- branch names
- what validation each slice must pass
- whether temporary placeholder code is acceptable if an earlier slice needs it to stay green
- If the user has not specified the stack, inspect the diff and propose a concrete slice plan before proceeding.
Core Workflow
- Capture the target tree that represents committing all current changes on top of
HEAD.
- For each slice, stage only that slice and temporarily stash the later slices
so validation runs against just the current branch candidate.
- If the slice validates, use
gt create to mint the next branch from the
staged changes, then restore the stashed remainder on top of it.
- Introduce the smallest temporary compatibility shim or placeholder code
needed to keep an intermediate branch green, and remove it in a later slice
once its dependents land.
- Verify the final top branch tree matches the saved target tree exactly.
Hard Stops
- The user has not approved the stack plan.
- The worktree is clean, so there is nothing to turn into a stack.
- The current branch is in rebase or otherwise not safe to use as the stack
base.
- Capturing the full target tree would disturb staged state the user cares about and they have not approved that.
- A slice cannot pass validation independently.
- A proposed branch name collides and the user has not approved the alternative.
- Keeping an intermediate branch green would require placeholder code or a compatibility shim that the user has not approved.
HEAD changed after preflight and the target tree has not been recaptured.
- The final top branch tree hash differs from the saved target tree.
Reference
Read reference.md for the working-tree-specific preflight, tree
capture, and gt create slice loop.
For the shared discovery prompt, validation-isolation workflow, recovery rules,
temporary compatibility guidance, and final verification checklist, read
../graphite-stack-shared/REFERENCE.md.