agentleFS
nir-monir-mo/gh-stack-pr-skill/SKILL.md

stacked-pr

Skill1 starsChanged 3 months agoMITView on GitHub

Use when the user asks to "stack a PR", "stacked PR", "branch on top of this PR", "next layer", "restack", "rebase the stack", "split this into a stack", or wants to start follow-up work while the previous PR is still in review.

  • Commits and pushes

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. OutThisLife/brooklyn-skills★ 207same name
    2. LuisUrrutia/skills★ 2same name
    3. hammoda711/stacked-pr-skill★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use GitHub's gh stack extension.

    line 8
  2. Distinctive:

    Before running any command here, check whether the changes actually depend on each other — later layers building on earlier layers' code, …

    line 20
  3. Very specific:

    If the repo's trunk is not the default branch, every init must say so, or the bottom PR targets the wrong branch:

    line 34
  4. Distinctive:

    Run any mandatory post-PR step once for the whole stack, not once per layer.

    line 68
  5. Very specific:

    Verify the bottom PR targets the intended trunk: gh stack view.

    line 69
  6. Distinctive:

    If your repo enforces a title format (ticket prefixes and the like), put it in the commit message — that is what becomes the PR title.

    line 70

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Stacked PRs

Use GitHub's gh stack extension. It already does parent tracking, cascading rebase, PR base retargeting, and bottom-up merging. Do not hand-roll this with git rebase --update-refs, git config branch.*.parent, or manual gh pr create --base — that reimplements the extension badly and drifts from what GitHub's UI shows.

Public preview — flags may change. gh stack <cmd> --help is authoritative over this file.

First: does this actually need to be a stack?

Stacking couples the PRs. They merge bottom-up only, so a review stall or a revert on a lower layer blocks everything above it.

Before running any command here, check whether the changes actually depend on each other — later layers building on earlier layers' code, or a split of one logical change too big to review at once. If they're independent (unrelated files, either could merge first, no shared new symbols), stop and ask the user whether they really want a stack, and say why you're asking: independent PRs opened straight against the trunk merge in any order and don't block each other. Only proceed once they confirm.

Setup (once)

gh extension install github/gh-stack
gh stack alias        # optional: shorter command

If the repo's trunk is not the default branch, every init must say so, or the bottom PR targets the wrong branch:

gh stack init --base develop <bottom-branch>

Create a stack

gh stack init feat-auth          # add --base <trunk> if trunk isn't the default branch
gh stack add -Am "api routes"    # -A stages all, -m commits, then branches
gh stack add -Am "ui"
gh stack submit                  # push + create/update PRs, interactive editor

gh stack submit opens an editor for titles/bodies; --auto skips it and generates titles from commits, --open marks PRs ready for review (without it, --auto creates drafts). Commit messages become the PR titles, so write them the way you want the PR titled.

Already have branches? Adopt them bottom-to-top instead of recreating:

gh stack init feat/auth feat/api feat/ui

Already have open PRs you don't want tracked locally? gh stack link --base <trunk>.

Adapt to your repo

gh stack submit creates the PRs, which means any repo-specific PR skill or convention you normally rely on is bypassed. Retrofit those rules after submit rather than before:

  • Apply required labels per PR: gh pr edit <n> --add-label <label>.
  • Run any mandatory post-PR step once for the whole stack, not once per layer.
  • Verify the bottom PR targets the intended trunk: gh stack view.
  • If your repo enforces a title format (ticket prefixes and the like), put it in the commit message — that is what becomes the PR title.

Day to day

gh stack view            # -s for short, --json for scripting
gh stack sync            # fetch, rebase, push, sync PR state — the one you want most days
gh stack rebase          # cascading rebase only; --downstack / --upstack to limit scope
gh stack push            # push branches without touching PRs
gh stack modify          # interactively reorder/restructure; --continue / --abort
gh stack up | down | top | bottom | trunk | switch | checkout

Reach for gh stack sync before assuming a stack is broken — most "my diff looks wrong" reports are just a stale local stack after trunk moved.

Merge

gh stack merge --squash      # bottom-up; can merge several layers at once

GitHub retargets the remaining PRs onto the trunk automatically as lower layers merge. Never merge a middle PR first, and never merge a stacked PR from the web UI's plain merge button unless you've confirmed everything below it is already in.

Bail out

gh stack unstack --local     # drop local tracking, leave the PRs alone
gh stack unstack             # also unstack them on GitHub

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.