/hb:to-stack [PR | branch] [--each]from hb
Splits a large branch or PR into a stack of small, layered PRs for incremental review. Walks through resolving, mapping concerns, planning layers, and building bottom-up.
Ships in hb. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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
--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.Resolve.
gh pr view <PR> --json headRefName,baseRefName, then gh pr checkout <PR>. A branch → check it out. Its head is <tip>; its base is the PR's baseRefName, 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> and git log --oneline origin/<base>..<tip>.Done when the scope is stated: "Splitting feat/x (#42) vs main: 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:
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-lease for 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:
git restore --source=<backup> --staged --worktree -- <paths>, listing both sides of a rename. Unlike git checkout, it also applies deletions.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.--each.check. Commit only if it's green: chain with &&. One conventional commit per layer.Done when every layer has its commit and check passed on that exact tree.
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 that git diff <backup> <top> -- <manifest> <lockfile> CHANGELOG.md shows 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.
git rebase --update-refs --onto <layer> <layer>@{1} <top>.check: git diff <green-sha> <layer> -- . ':!<fix paths>'.Done when the top differs from the backup by exactly the fixes.
Open the drafts.
-u, and the rewritten PR 1 branch with --force-with-lease.gh pr list --head <branch> --state open.gh pr create --draft --base <layer below> --head <branch> --title <title> --body "Part N of M". PR 1's base is the base branch.Done when every layer has a PR whose base is the layer below.
Write the bodies. One per layer, on the repo's PR template (.github/pull_request_template.md or its variants). Each body holds:
Part N of M and a one-sentence summary
the stack as a numbered list of the PR numbers, with ← this PR
what the layer adds
review notes on anything that arrives in a later layer
the evidence from step 5
Default: PR 1 keeps the whole-change description, because its squash is what lands, with the stack and "this PR's own diff" on top. Retitle it to the whole change with --title.
--each: PR 1 lands alone, so its body and title cover its own layer, like the others.
Apply each body with gh pr edit <n> --body-file <file>.
Done when every PR body links the whole stack.
A table of # | PR | Branch | Lines | Tests, then how to land it:
--each: merge PR 1 into the base, then rebase PR 2 onto the squashed commit (git fetch origin <base>, then git rebase --onto origin/<base> <old PR 1 tip> <PR 2>) and retarget it, and so on up the stack.--update-refs, and push the layers above with --force-with-lease.Next: /hb:feedback <PR 1> once reviews arrive.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
stacked-prs, branch-splitting, pr-workflow, incremental-review
npx claudepluginhub helderberto/agent-skills --plugin hb43 skills in this plugin
/a11y-auditAudit accessibility (WCAG) in frontend code. Use when asked to "check accessibility", "audit a11y", "check WCAG", or find accessibility issues. Don't use for backend code, bundle size (/perf-audit), or translations (/i18n)./architecture-auditSurface architectural friction across a codebase and propose deep-module refactors as RFCs./buildImplement the next unblocked ticket test-first and commit it, or fan every ticket out to parallel subagents with `--all`./checkValidate code quality — auto-fix formatting/lint, verify types, run tests. Use when asked to "validate code", "check code", or validate before committing; also lint-only asks ("run linter", "fix lint errors"). Don't use for committing (/commit), pushing (/to-pr), or writing new tests (/tdd)./codebase-designShared vocabulary for designing deep modules — interface, seam, depth. Use when designing or improving a module's interface, placing a seam, or deciding what an API hides. Don't use for codebase-wide audits (/architecture-audit), behavior-preserving cleanup (/refactor), or UI components (/frontend-ui-engineering)./code-reviewReview a PR or branch on two axes only, quality and spec, in parallel subagents reported side by side.Other plugins' skills for the same job