Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
← Back to list

gh-stack Stacked PR Playbook

A playbook for using the GitHub CLI gh-stack extension to split multi-part work into reviewable stacked branches and PRs, safely and non-interactively.

Dev & CodingAdvanced★ 183⑂ 13AI score 9/10Last updated: Oct 9, 2026

What it does

  • Creates and manages stacked branch/PR chains rooted on trunk with gh stack, so each reviewer only sees that layer's diff.
  • Gives non-interactive rules so an agent never hangs on a TUI: a table of required flags (view --json, submit --auto, merge <target> --yes, init <branch>) and commands you must never call bare (modify, switch).
  • Explains branch placement: pick the layer that owns a change, edit it, rebase --upstack, return to top and push; plus sync / sync --prune for staying aligned with GitHub.
  • Documents stack merging scope (PR number vs stack number, all-or-nothing, merge-queue behavior), the view --json schema (trunk, branches[].pr, needsRebase), and recovery for exit codes 0–10 including rebase conflicts and lock contention.
  • Points to references/stack-design.md, commands.md, and troubleshooting.md with clear read triggers.

Who it's for

  • Developers on teams that break large features into small, dependent PRs.
  • Anyone letting an AI agent run git/gh commands who has been burned by interactive prompts or full-screen TUIs.
  • Monorepo / multi-remote / worktree users who need --remote and remote.pushDefault discipline.

Examples

  1. "Stack auth → api → frontend and open PRs": gh stack init auth, commit, gh stack add api, commit, then gh stack submit --auto for draft PRs (--open for review-ready).
  2. Fixing a middle layer: gh stack down, commit the endpoint change, gh stack rebase --upstack to replay every branch above, then gh stack top and gh stack push.
  3. Landing approved lower PRs: gh stack merge 42 --yes --squash merges PR #42 and all unmerged PRs below it atomically, followed by gh stack sync --prune to clean up local branches.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/molefrog/moi/HEAD/.agents/skills/gh-stack/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
↓ Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the .agents/skills/gh-stack folder from the GitHub repo molefrog/moi into my ~/.claude/skills/gh-stack/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/molefrog/moi.git /tmp/moi && mkdir -p ~/.claude/skills && cp -r /tmp/moi/.agents/skills/gh-stack ~/.claude/skills/gh-stack

⚠ This is a third-party skill. Check the source repository before installing.

  1. Prerequisites: install Git 2.36+ and the GitHub CLI, then verify auth with gh auth status.
  2. Install the extension: gh extension install github/gh-stack
  3. Recommended config: git config rerere.enabled true, and if the repo has multiple remotes also git config remote.pushDefault origin.
  4. Clone the skill repo: git clone https://github.com/molefrog/moi.git /tmp/moi
  5. Copy the skill: mkdir -p ~/.claude/skills && cp -r /tmp/moi/.agents/skills/gh-stack ~/.claude/skills/gh-stack (include the references folder).
  6. Activate: restart Claude Code and ask something like "split this work into stacked PRs".
  7. Smoke test: run gh stack view --json; exit code 9 means Stacked PRs aren't enabled on that repository.
View source on GitHub ↗License: NOASSERTION