to-stack
БесплатноБез исполняемых скриптовНе проверенSplit a large branch or PR into a stack of small PRs, verified layer by layer, and open them as linked drafts.
от helderberto★ 21 звезда на GitHubОб этом скилле
To Stack
Turn one large change into a stack: PR 1 on the base branch, each later PR on the one below it. Reviewers read one concern at a time, and the top of the stack is byte-for-byte the tree you already tested.
Arguments: $ARGUMENTS
- A PR number or URL, or a branch. None → the current branch and its PR.
--each— land each PR on the base in order, each with its own version bump and CHANGELOG section. Default: merge from the top down into PR 1, which lands as one squash and one release.
Workflow
Resolve.
- Dirty tree → stop and ask to commit or stash.
- A PR →
gh pr view <PR> --json headRefName,baseRefName, thengh pr checkout <PR>. A branch → check it out. Its head is<tip>; its base is the PR'sbaseRefName, else the default branch. git fetch origin <base>, then diff against the remote base, since a stale local base inflates the diff:git diff --stat origin/<base>...<tip>andgit log --oneline origin/<base>..<tip>.- Tip conflicts with the base, or the base already released the planned version → merge the base in and bump first. A collision belongs to the whole change, not to one layer.
- Under ~600 changed lines without lockfiles → say a split isn't worth it, and stop unless the user insists.
Done when the scope is stated: "Splitting
feat/x(#42) vsmain: 49 files, +3432".Map. Record what every changed file needs: its imports, and for each test case the mocks, globals, helpers and options it touches. Group the changes into concerns. For shared files (manifest, entry barrel, types index, core module, README, CHANGELOG), assign each changed line to a concern. Done when every changed line has an owner. Ownership rules: references/layering.md.
Plan. Order the concerns so each layer depends only on layers below it: manifest and config first, then the core, then features, then deprecated or compatibility code, so a future major deletes one layer. Each layer is tight:
- one concern, under ~600 changed lines without lockfiles
- green on its own
- nothing in it waits on a later layer to be used: move a reader with its writer
Present a table of layer, branch, contents, approximate lines and base, plus the merge strategy. An existing PR becomes PR 1, and its branch gets rewritten. Wait for an unambiguous yes. It covers building, pushing (
--force-with-leasefor the rewritten branch) and opening the PRs.Back up. Run
git branch <branch>-full <tip>. Every later check compares against it. Done when the backup points at the tip.Build bottom-up. For each layer, on a new branch from the one below:
- Files that land whole:
git restore --source=<backup> --staged --worktree -- <paths>, listing both sides of a rename. Unlikegit checkout, it also applies deletions. - Shared files: write only this layer's slice. In tests, keep the final cases this layer can run. If a core behavior would go untested, write the smallest stand-in case; a later layer restores the final version.
- Manifest: only this layer's fields, then regenerate the lockfile (
npm install --package-lock-only --ignore-scripts, or the repo's equivalent). The version bump goes in layer 1. With--each, each layer bumps from the one below by its own change type, so the top's version can be above the backup's. - Docs: only this layer's README and CHANGELOG lines, under the one version heading, or the layer's own heading with
--each. - Stage explicit paths. Delete any generated output the base doesn't ignore yet, such as build shims, before the checks.
- Call the Skill tool with
check. Commit only if it's green: chain with&&. One conventional commit per layer.
Done when every layer has its commit and
checkpassed on that exact tree.- Files that land whole:
Verify the stack.
git diff --quiet <backup> <top>must pass, because the top layer is the original tree. With--each, run it with-- . ':!<manifest>' ':!<lockfile>' ':!CHANGELOG.md', then check thatgit diff <backup> <top> -- <manifest> <lockfile> CHANGELOG.mdshows only version lines and version headings. If it fails, find the layer that lost or gained lines, fix it there, and restack as in step 7. Done when the diff is empty.Fold in fixes, only when the user asked for changes along with the split.
- Commit each fix on the layer that owns the code.
- Restack everything above it:
git rebase --update-refs --onto <layer> <layer>@{1} <top>. - When adjacent edits conflict, keep both sides' intent.
- Then check that each layer's files outside the fix still match the tree that passed
check:git diff <green-sha> <layer> -- . ':!<fix paths>'.
Done when the top differs from the backup by exactly the fixes.
Open the drafts.
- Push each layer branch with
-u, and the rewritten PR 1 branch with--force-with-lease. - Bottom-up, skip a layer that already has a PR:
gh pr list --head <branch> --state open.
- Push each layer branch with
Установить to-stack в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл to-stack?
Split a large branch or PR into a stack of small PRs, verified layer by layer, and open them as linked drafts.
Как установить скилл to-stack?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл to-stack запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic