Skip to content
Skills Library
Programming · Planning

stacking-prs

/stacking-prs

Use when splitting a large branch into a stack of smaller PRs/MRs, when managing or updating an existing stack (review feedback on a lower PR, trunk moved, a broken chain), or when landing or merging a stack and syncing the rest after the bottom merges. Also use when a reviewer asks to "make this PR smaller" or the user invokes /stacking-prs.

Repository
quirk ↗
Licence
MIT
Last repository change
26.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
10
Scripts
4
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 4 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/analyze.sh, scripts/extract.sh, scripts/restack.sh, scripts/stack.sh

What it does and when to use it

Use when splitting a large branch into a stack of smaller PRs/MRs, when managing or updating an existing stack (review feedback on a lower PR, trunk moved, a broken chain), or when landing or merging a stack and syncing the rest after the bottom merges. Also use when a reviewer asks to "make this PR smaller" or the user invokes /stacking-prs.

Triggers from the description

make this PR smaller
Original author description

Use when splitting a large branch into a stack of smaller PRs/MRs, when managing or updating an existing stack (review feedback on a lower PR, trunk moved, a broken chain), or when landing or merging a stack and syncing the rest after the bottom merges. Also use when a reviewer asks to "make this PR smaller" or the user invokes /stacking-prs.

How it works

  1. Step 0: detect
  2. Pick the phase
  3. Rules every phase obeys
  4. Modes
  5. Scripts
  6. Integration
Original SKILL.md headings · 76 lines, 932 words
SKILL.md preview
---
name: stacking-prs
description: Use when splitting a large branch into a stack of smaller PRs/MRs, when managing or updating an existing stack (review feedback on a lower PR, trunk moved, a broken chain), or when landing or merging a stack and syncing the rest after the bottom merges. Also use when a reviewer asks to "make this PR smaller" or the user invokes /stacking-prs.
---

# Stacking PRs/MRs: split, manage, land

A stack is a chain of PRs/MRs where each one except the bottom targets the one below it. This skill covers the whole life of a stack, including stacks it didn't create. This file picks the phase and holds the rules every phase obeys. Each phase has its own reference file, so read only the one you're in.

**Announce:** "I'm using the stacking-prs skill to <split this branch | manage this stack | land this stack>."

## Step 0: detect

Run detection first and show the result. It only reads. It never fetches, checks out, pushes, or changes the forge.

```bash
"${CLAUDE_PLUGIN_ROOT}/skills/stacking-prs/scripts/stack.sh"
```

It prints JSON: `forge` (`github`, `ghes`, `gitlab`, `none`), `mode` (`native`, `classic`, `local`), `in_stack`, `trunk`, `native_available`, `gh_stack_installed`, `layers[]`, `merged_parents[]`, and `warnings[]`. If the forge CLI is missing or its PR/MR listing fails, it falls back to `local` mode with a `forge_unavailable` warning and still exits 0. It exits 1 only for a usage error, a non-repo, a detached HEAD, or no `jq`. Read the error and stop.

When `in_stack` is true, print the stack map before asking anything. List layers bottom first, mark the current one, and show each layer's PR, state, CI, review, and whether it's behind its parent. Mention every warning that applies:

| Warning | Say |
|---|---|
| `forge_unavailable` | Some forge data couldn't be read, and the message says which. A listing that hit its cap can hide a layer or a merged parent |
| `broken_chain` | A PR targets a merged branch or a missing one. Repair is in Land's post-merge sync |
| `branched_stack` | Two PRs share a base, so the map stops at the fork |
| `deep_stack` | More than 4 layers. Practitioners report 3-4 as the practical limit |
| `gitlab_retarget_cap`, `gitlab_mixed_authors` | GitLab retargets only up to 4 open MRs, and its stack view stops at the first MR by a different author |
| `cross_fork` | A cross-fork stack can't be native |
| `ci_filter` | A workflow filter will skip CI on layers above the bottom |
| `layer_in_other_worktree` | A layer is checked out elsewhere, which blocks a rebase |

## Pick the phase

Check the rows in order and take the first that matches.

| What Step 0 shows | Do |
|---|---|
| `merged_parents` is non-empty, or `broken_chain` is present | Flag the merged or missing parent and offer [Land's post-merge sync](references/land.md#post-merge-sync). With `layers: []`, that's its [merged anchor with several open children](references/land.md#merged-anchor-with-several-open-children) case. Don't start Split |
| `in_stack` is false: one PR to trunk, or no PR, and no stacked branches | Say "not in a stack" and start [split](references/split.md) without asking |
| `in_stack` is true, `mode` is `native` or `classic` | Ask with AskUserQuestion: Manage, Land, or Split this layer further. For a layer with others above it, [split](references/split.md#split-this-layer-further-restack-the-layers-above-it) restacks them afterward. Nothing changes until the user picks |
| `mode` is `local` | Offer Manage or Split. Don't offer Land, because nothing is pushed and nothing can merge |

If the user already named the job ("address this review comment", "PR 1 merged, what now", "split this up"), still show the stack map, then go straight to that phase.

A native stack needs the `gh stack` extension for Manage and Land. If `mode` is `native` and `gh_stack_installed` is false, stop before any git write, even when the user named the phase. Ask them to run `gh extension install github/gh-stack`, then rerun Step 0. Don't fall back to the classic flow on a native stack.

- [Split](references/split.md): cut one large branch into a stack. Includes the off-ramps for deep stacks and small diffs, the CI-filter preflight, and native registration.
- [Manage](references/manage.md): apply feedback to a lower layer, restack onto moved trunk, and handle layers checked out in other worktrees.
- [Land](references/land.md): check the bottom PR before the user merges it, then rebuild the rest of the stack after.

## Rules every phase obeys

- **No git write before approval.** Show the plan for an operation and get the user's approval before running it.
- **Back up before rewriting history.** Every rewrite makes a `backup/<branch>_<timestamp>` branch first. Backups stay local and are never pushed.
- **Force-push safely.** Use `--force-with-lease --force-if-includes`, never a bare `--force`.
- **The user merges.** The skill never runs `gh pr merge`, `gh stack merge`, or `glab mr merge`. It checks before the merge and syncs after.
- **Draft until it's the bottom.** Non-bottom PRs stay in draft. Only the current bottom is marked ready.

## Modes

- **Native:** a GitHub stack registered with GitHub's stacked PRs. GitHub draws the map, rebases after a merge, and runs CI against the stack base. Use `gh stack` for the work.
- **Classic:** PRs/MRs whose bases chain, with no native registration. The skill does the rebase and retarget work itself. Every GitLab stack and every GHES stack is classic.
- **Local:** branches chained in git ancestry, nothing pushed yet.

## Scripts

All are under `${CLAUDE_PLUGIN_ROOT}/skills/stacking-prs/scripts/`.

- `stack.sh [--branch <b>] [--trunk <t>] [--remote <r>]` reads the stack. `stack.sh --check-ci <base>...` checks which workflows would skip the planned bases.
- `restack.sh --branch <b> --onto <base> --old-tip <sha> [--pr <n>] [--no-push]` replays one layer onto a new base, with a backup, a lease push, and a retarget. Land and Manage use it.
- `analyze.sh` and `extract.sh` weigh a branch and extract a slice of it. Split uses them. The config files are `~/.quirk/stacking-prs.json` and `<repo>/.quirk/stacking-prs.json`.

## Integration

- `using-git-worktrees` — stage splits in isolated worktrees
- `finishing-a-development-branch` — once the bottom merges and the stack collapses
Files in this package (10)
  • SKILL.md 6 KB
  • evals/trigger-evals.json 3 KB
  • references/land.md 9 KB
  • references/manage.md 9 KB
  • references/split.md 23 KB
  • scripts/analyze.sh 11 KB
  • scripts/extract.sh 10 KB
  • scripts/restack.sh 13 KB
  • scripts/stack.sh 35 KB
  • scripts/weigh.awk 15 KB

Versions

RepositoryScoreLicence
This page · zpyoung/quirk100MIT
PostHog/posthog100MIT
pvliesdonk/markdown-vault-mcp100MIT

Database snapshot: 13.11.2026 · package version 7be8c5a7fd81 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100stack-pr
    Use when breaking a too-big branch into a stack of smaller chained PRs — commit-based default, --smart agent-reshape, gh-stack detection, cross-links. Invoked by $orc-stack-pr and $orc-ship's size gate.
  • 100stack-pr
    Use when breaking a too-big branch into a stack of smaller chained PRs — commit-based default, --smart agent-reshape, gh-stack detection, cross-links. Invoked by /orc:stack-pr and /orc:ship's size gate.
  • 100stacked-pr-splitter
    Break a large branch or pull request into a stack of small, independently reviewable and mergeable PRs, each building on the previous one, with a split plan, branch creation, per-PR descriptions and a verification step that the stack reproduces the original diff exactly. Use…
  • 100stacked-prs
    Break a large change into a chain of small, dependent pull requests using GitHub stacked pull requests and the gh stack CLI extension. Use this skill whenever the user mentions stacked PRs, stacked pull requests, a PR stack, stacking branches or commits, gh stack, splitting a…
  • 100merging-pr-stack
    Use when merging a stack of stacked PRs with jj. Triggered by phrases like "merge the PR stack", "merge the stacked PRs", "land these PRs", or "merge the stack into main".
  • 100pr-splitter
    Use when breaking a large, complex, messy, or hard-to-review pull request into multiple smaller PRs; planning stacked PRs; extracting independent changes from a branch; splitting mixed refactor and behavior changes; managing drift after review feedback; rebasing follow-up PRs as…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.