gh-stack
Skill by github
Manages stacked pull requests with the gh stack GitHub CLI extension. It helps split multi-part work into reviewable branches, for developers and AI agents working in GitHub repositories.
Install gh-stack
Built from the published package, never by AI.
git clone --depth 1 https://github.com/github/gh-stack /tmp/gh-stack && mkdir -p ~/.claude/skills && cp -r /tmp/gh-stack/skills/gh-stack ~/.claude/skills/gh-stackRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/github/gh-stack /tmp/gh-stack && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/gh-stack/skills/gh-stack ~/.gemini/antigravity-cli/skills/gh-stackAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
gh-stack is an agent skill for gh stack, 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. The skill covers creating and viewing stacks, adding layers, editing, pushing, submitting, syncing, rebasing, merging, and checkout.
The skill tells the assistant which flags to pass so commands do not open prompts or full-screen interfaces. It also covers branch placement, reading JSON state from view, interpreting exit codes, and recovering from rebase conflicts. It is for developers and agents who split multi-part work into reviewable branches on GitHub.
Written from the project's SKILL.md and checked against it.
What it can do
- Create a stackInitialise a stack with gh stack init and add dependent layers with gh stack add.
- Submit PRsPush every branch and open draft PRs with gh stack submit --auto, or ready PRs with --open.
- SyncFetch, reconcile with GitHub, rebase, push and refresh PR state with gh stack sync.
- Rebase upstackReplay every branch above an edited layer onto the change with gh stack rebase --upstack.
- Merge a stackMerge a PR and the unmerged PRs below it, or a whole stack, with gh stack merge.
- Read stack statePrint stack state as JSON with gh stack view --json for parsing.
- Navigate layersMove between layers with gh stack up, down, top, bottom and checkout.
- Recover from conflictsContinue or abort a rebase after a conflict, following the documented exit code recovery steps.
What you need
- Git 2.36 or later
- An authenticated GitHub CLI
- The gh stack extension installed from github/gh-stack
- Stacked PRs enabled on the repository
Try asking
- Split these auth and API changes into a reviewable stack of PRs
- Show the current stack and which branch owns the open changes
- Sync my stack with GitHub and rebase any layers that need it
Good to know
- Stacks are strictly linear, with one parent and at most one child per branch.
- gh pr merge cannot merge a stack, and merges are all-or-nothing.
- There is no non-interactive reorder or removal of layers; use unstack and init instead.
- The modify command is TUI-only and has no non-interactive path.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/gh-stack/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md9 KB -
references/commands.md11 KB -
references/stack-design.md4 KB -
references/troubleshooting.md9 KB
Alternatives to gh-stack
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
gh-stack: common questions
Does gh-stack work with multiple git remotes?
Yes, but push, submit, sync, rebase and link need --remote <name> unless remote.pushDefault is configured. checkout and trunk have no --remote flag and require that config.
Why does the skill avoid plain gh stack view?
Under a pseudo-terminal, gh stack view opens a full-screen interface and blocks. Passing --json writes parseable output to stdout instead.
What happens if local and remote stacks have diverged?
sync prints both chains, makes no changes, and exits 0 with a Sync aborted message. The source points to a troubleshooting reference for this case.
How do I install gh-stack?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is gh-stack free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is gh-stack safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to gh-stack?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
