Stacking PRs
PostHog/posthog
Create and manage GitHub native Stacked PRs in this repo with the gh stack CLI.
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
$ npx skills add vercel/next.js --skill gh-stack -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install vercel/next.js gh-stack --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/vercel/next.js.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/gh-stack .claude/skills/gh-stack && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "gh-stack" agent skill from https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stack into .claude/skills/gh-stack/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "gh-stack", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stackType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add vercel/next.js --skill gh-stack -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install vercel/next.js gh-stack --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/vercel/next.js.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/gh-stack .agents/skills/gh-stack && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "gh-stack" agent skill from https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stack into .agents/skills/gh-stack/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "gh-stack", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add vercel/next.js --skill gh-stack -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install vercel/next.js gh-stack --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/vercel/next.js.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/gh-stack .cursor/skills/gh-stack && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "gh-stack" agent skill from https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stack into .cursor/skills/gh-stack/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "gh-stack", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/vercel/next.js.git --path .agents/skills/gh-stack--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add vercel/next.js --skill gh-stack -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install vercel/next.js gh-stack --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/vercel/next.js.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/gh-stack .gemini/skills/gh-stack && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "gh-stack" agent skill from https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stack into .gemini/skills/gh-stack/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "gh-stack", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install vercel/next.js gh-stackInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add vercel/next.js --skill gh-stack -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/vercel/next.js.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/gh-stack .github/skills/gh-stack && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "gh-stack" agent skill from https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stack into .github/skills/gh-stack/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "gh-stack", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add vercel/next.js --skill gh-stack -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install vercel/next.js gh-stack --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/vercel/next.js.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/gh-stack .opencode/skills/gh-stack && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "gh-stack" agent skill from https://github.com/vercel/next.js/tree/canary/.agents/skills/gh-stack into .opencode/skills/gh-stack/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "gh-stack", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
gh-stackManages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
Gh Stack is an agent skill from vercel/next.js, published by the product's own GitHub organization. Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack. Use for stack creation, viewing, edits, push, submit, sync, rebase, merge, or checkout; when asked to split or isolate work for review; whenever a user mentions a stack, branch layers, dependent PRs, or gh stack; or when a stack is checked out.
Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/commands.md`, `references/stack-design.md` and `references/troubleshooting.md`).
The licence is MIT.
Read from SKILL.md and the folder at commit a32ddfd. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
ghgitFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
cli.github.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Gh Stack loads about 2.3k tokens when it runs, and up to ~7.4k if it reads all its reference files. Until then it costs about 85 tokens; SKILL.md has 977 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from vercel/next.js at commit a32ddfd, republished under its MIT licence (© vercel). 977 words, ~2,324 tokens.
.claude/skills/gh-stack/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.gh stack is a GitHub CLI extension for stacked branches and pull
requests. A stack is an ordered chain of branches rooted on a trunk, where each branch has one PR
based on the branch below it, so a reviewer sees only that layer's diff.
gh stack prints a stack trunk-first, left to right:
(main) <- auth <- api <- frontendLeft is the bottom, right is the top. auth is based on main and merges first;
frontend merges last. up moves toward the top, away from trunk; down moves toward it.
Foundational work belongs at the bottom, code that depends on it above. For how to choose the
layers, read references/stack-design.md.
gh extension install github/gh-stack
git config rerere.enabled true # remember conflict resolutions
git config remote.pushDefault origin # required if the repo has more than one remotegh stack branches on whether stdout is a TTY. Piped, most commands error cleanly or print
static text; under a PTY the same commands open a prompt or a full-screen TUI and block forever.
Agent harnesses differ, so always pass the flags below instead of relying on that detection.
Multiple remotes: never run push, submit, sync, rebase, or link without
--remote <name> unless remote.pushDefault is configured. checkout and trunk have no
--remote flag and require the config.
| Always run | Never run bare | Why |
|---|---|---|
gh stack view --json | gh stack view | opens a TUI under a PTY |
gh stack submit --auto | gh stack submit | prompts for a title per new PR |
gh stack merge <target> --yes | gh pr merge | gh pr merge cannot merge a stack |
gh stack init <branch>... | gh stack init | prompts for branch names |
gh stack add <branch> | gh stack add | prompts for a name, and fails even when piped |
gh stack checkout <target> | gh stack checkout | opens a selection menu |
gh stack up / down / top / bottom | gh stack switch | switch is menu-only |
| — | gh stack modify | TUI-only, no non-interactive path |
view --short is safe in both modes, but it is formatted for humans. Use --json to parse.checkout <pr> when a different local stack already covers those branches cannot be forced.
Run gh stack unstack --local first (this keeps the stack on GitHub), then retry.gh stack view --json; if
ownership is unclear, inspect git log --all -- <path>. Then check out the owner, edit, commit,
rebase upstack, and return to top.gh stack down # or: gh stack checkout api
git add ... && git commit -m "Add get-user endpoint"
gh stack rebase --upstack # replay every branch above onto the change
gh stack top # return to where you were
gh stack pushgh stack init auth # create the stack and check out its branch
git add ... && git commit -m "Add auth middleware"
gh stack add api # next layer, branched from the current one
git add ... && git commit -m "Add API routes"
gh stack submit --auto # push every branch and open draft PRs
gh stack view --json # confirmAdd --open to submit to create PRs ready for review instead of drafts. Branch names are
verbatim — gh stack add refactor/foo creates refactor/foo.
gh stack sync # fetch, reconcile with GitHub, rebase, push, refresh PR state
gh stack sync --prune # also delete local branches for merged PRsPruning never happens without --prune when non-interactive. If the local and remote stacks have
diverged, sync prints both chains, makes no changes, and exits 0 with Sync aborted — see
references/troubleshooting.md.
Scope the merge with an argument:
gh stack merge 42 --yes # PR #42 plus every unmerged PR below it
gh stack merge 7 --yes # every unmerged PR in stack #7
gh stack merge 42 --yes --squash # or --merge, --rebase, --merge-method <method>Pass a PR number to merge that PR and every unmerged PR below it, or a stack number to merge every unmerged PR in that stack. The operation is all-or-nothing: if any PR in that set cannot merge, none do.
Without a method flag the last-used method is reused. If the base branch uses a merge queue, the stack is queued instead and the queue picks the method, ignoring any flag you passed with a warning; queued PRs may land in separate groups.
gh stack view --json writes JSON to stdout. Status messages go to stderr — do not parse
them, branch on exit codes instead.
trunk string
currentBranch string
branches[] name, head, base, isCurrent, isMerged, isQueued, needsRebase
branches[].pr number, url, state ("OPEN" | "MERGED" | "QUEUED"); absent when no PR existsbase is the saved SHA of the parent branch that this branch was last known to contain. It may be
older than the parent's current tip. needsRebase is true when the current parent tip is no longer
an ancestor of the branch.
| Code | Meaning | Recovery |
|---|---|---|
| 0 | Success | — |
| 1 | Generic error | Read stderr |
| 2 | Not in a stack | gh stack init, or gh stack checkout <target> |
| 3 | Rebase conflict | Follow the Exit 3 recovery below |
| 4 | GitHub API failure | Check gh auth status, retry |
| 5 | Invalid arguments | Fix the invocation; see <command> --help |
| 6 | Disambiguation required | Branch is in several stacks; check out a non-shared branch |
| 7 | Rebase already in progress | gh stack rebase --continue or --abort |
| 8 | Stack file locked | Another gh stack process is writing; retry after ~5s |
| 9 | Stacked PRs unavailable | Not enabled on the repository; tell the user |
| 10 | Modify recovery required | gh stack modify --abort |
Exit 3 recovery:
gh stack rebase: resolve the files, run git add, then
gh stack rebase --continue; use gh stack rebase --abort to restore the stack.gh stack sync: the stack has already been restored. Run gh stack rebase to recreate the
conflict, then resolve and continue as above.gh stack modify, but it is
TUI-only — restructure with unstack then init instead.gh pr edit afterwards to change them.checkout <branch-name> resolves against local stacks only. Use a stack or PR number to pull a
stack down from GitHub.gh stack <command> --help is authoritative for flags and arguments. Note that
gh stack help <command> does not work — it prints the top-level help.
Open the reference whose trigger matches the task; no need to preload all three.
references/stack-design.md — read before creating a stack, when deciding how many layers to
use, what belongs in each one, or whether work belongs in a new stack.references/commands.md — read when a command fails unexpectedly or you need its preconditions,
side effects, atomicity, or ordering guarantees.references/troubleshooting.md — read on a rebase conflict, after a squash-merge, on local and
remote divergence, when restructuring a stack, or when driving stacks from another tool.© vercel, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 3 other files (references) in .agents/skills/gh-stack of vercel/next.js.
Open the folder on GitHubat commit a32ddfd
We found 8 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 7 other GitHub owners. This page covers the copy in vercel/next.js, which our catalogue first saw on October 8, 2026.
Gh Stack next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Gh Stack this skillvercel/next.js | 143k | 7 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Stacking PRsPostHog/posthog | 40k | — | ~2.5k | Automated safety check: Pass | Custom licence | |
| Stack Split Commitmozilla-firefox/firefox | 13k | — | ~1.3k | Automated safety check: Pass | Custom licence | |
| Stacked PRsFoundationDB/fdb-record-layer | 675 | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Secrets Managementdavila7/claude-code-templates | 32k | 12 repos | ~2k | Automated safety check: Pass | MIT | |
| Shepherd PRsflutter/flutter | 179k | — | ~1.7k | Automated safety check: Pass | BSD-3-Clause |
PostHog/posthog
Create and manage GitHub native Stacked PRs in this repo with the gh stack CLI.
mozilla-firefox/firefox
Split one large or hard-to-review commit into several commits that each stand on their own for review, in a git or a Jujutsu (jj) checkout.
FoundationDB/fdb-record-layer
Create and manage stacked pull requests on FoundationDB/fdb-record-layer using the gh stack CLI extension.
davila7/claude-code-templates
Secure secrets management practices for CI/CD pipelines using Vault, AWS Secrets Manager, and other tools.
flutter/flutter
Automate shepherding, checking status, updating branches, and landing open PRs or approved third-party contributor PRs in the flutter/flutter repository using the gh CLI.
RightNow-AI/openfang
Project management expert for Agile, estimation, risk management, and stakeholder communication
vercel/next.js
Benchmark React or Next.js changes on Vercel Sandbox VMs with paired A/B statistics: react PR/commit vs base, or Next.js PR/commit vs base, measured end-to-end through the bench/render-pipeline app…
vercel/next.js
Verify Next.js runtime behavior after editing app code. An agent skill from vercel/next.js.
vercel/next.js
Draw diagrams for the Next.js docs in the style of the ones already published there: the light/dark PNGs an mdx references with <Image srcLight="/docs/light/<name.png" srcDark="/docs/dark/<name.png".
vercel/next.js
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces.
vercel/next.js
Build local React changes in the bundle variants consumed by Next.js, sync them into a local Next.js checkout, and test the resulting integration.
vercel/next.js
Audit and reduce Next.js browser initial-load work. An agent skill from vercel/next.js.
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack. js, published by the product's own GitHub organization. Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
Gh Stack fits situations like: isolate work for review; whenever a user mentions a stack; A stack is checked out.
Run `npx skills add vercel/next.js --skill gh-stack -a claude-code`. Or copy the skill folder (.agents/skills/gh-stack in vercel/next.js) into .claude/skills/gh-stack in your project. Claude Code loads it when a task matches its description.
Run `npx skills add vercel/next.js --skill gh-stack -a codex`. Or copy the skill folder (.agents/skills/gh-stack in vercel/next.js) into .agents/skills/gh-stack in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add vercel/next.js --skill gh-stack -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gh-stack, .gemini/skills/gh-stack, .github/skills/gh-stack and .opencode/skills/gh-stack in your project.
Going by SKILL.md and its folder, Gh Stack needs the command-line tools its instructions call (gh and git).
SKILL.md names 1 domain. As links in the text: cli.github.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Gh Stack is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.3k tokens (SKILL.md is roughly 9.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Gh Stack: Stacking PRs (PostHog/posthog, 40k stars), Stack Split Commit (mozilla-firefox/firefox, 13k stars), Stacked PRs (FoundationDB/fdb-record-layer, 675 stars) and Secrets Management (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
vercel (a GitHub organization, an official publisher) maintains it in vercel/next.js, which has 143,241 GitHub stars. The repository holds 27 skills in this directory. The repository was last updated on October 8, 2026.
Source: vercel/next.js on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.