Agent skill

Gh Stack

by s3s-project in s3s-project/s3s

Work with stacked pull requests in this repository using gh stack.

Apache-2.0Auto-check passedDevelopment

Install Gh Stack

skills CLI
$ npx skills add s3s-project/s3s --skill gh-stack -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install s3s-project/s3s gh-stack --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/s3s-project/s3s.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/gh-stack .claude/skills/gh-stack && rm -rf skills-src

Use ~/.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/

Facts

Skill name
gh-stack
GitHub stars
311
Token cost
~1.6k tokens
SKILL.md length
739 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
Apache-2.0

At a glance

Work with stacked pull requests in this repository using gh stack.

  • A change is split across branches that build on each other
  • SKILL.md covers The local map, Publishing, When the remote cannot be chosen and Never overwrite a rebase you…, plus 3 more sections
  • Calls gh, git and cargo
  • A stack must be rebased

What it does

Gh Stack is an agent skill from s3s-project/s3s. Work with stacked pull requests in this repository using gh stack. Use when a change is split across branches that build on each other, when a stack must be rebased, synced, pushed or merged, or when a force-push to a stack branch has to be safe.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Pull requests. It works with GitHub. The licence is Apache-2.0.

When your agent uses it

  • A change is split across branches that build on each other
  • A stack must be rebased
  • A force-push to a stack branch has to be safe

Example prompts

  • “/gh-stack”

What it can do on your machine

Read from SKILL.md and the folder at commit 0fdcb86. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    Shell commands in SKILL.md call:

    • gh
    • git
    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • docs.github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Gh Stack loads about 1.6k tokens when it runs. Until then it costs about 64 tokens; SKILL.md has 739 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~64
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from s3s-project/s3s at commit 0fdcb86, republished under its Apache-2.0 licence (© s3s-project). 739 words, ~1,624 tokens.

Download SKILL.mdSave it as .claude/skills/gh-stack/SKILL.md (or your agent's skills folder).
name
gh-stack
description
Work with stacked pull requests in this repository using gh stack. Use when a change is split across branches that build on each other, when a stack must be rebased, synced, pushed or merged, or when a force-push to a stack branch has to be safe.
license
Apache-2.0

Stacked pull requests

A stack is a chain of branches where each layer is based on the one below it, main ← layer-1 ← layer-2, and each layer is its own pull request. This repository enables GitHub's stacked pull requests, and the gh stack command manages them: it keeps the local branches, the remote branches, the pull requests and the GitHub stack object in step.

gh stack is an extension, not a core gh command, so install it once and confirm it is there:

bash
gh extension install github/gh-stack
gh extension list

Reach for a stack when a change is genuinely layered: one logical change per layer, each one reviewable on its own, with the lower layers merging first. Read the pull-request skill for the commit series, title and body of each layer; this skill covers the stack around them.

The local map

bash
gh stack init layer-1 layer-2      # adopt existing branches bottom to top, or create missing ones
gh stack view                      # stack number, layers, PR links, current branch
gh stack switch                    # move between layers
gh stack checkout <branch|PR|URL>  # jump to a stack by number, PR, URL or branch
gh stack add layer-3               # branch on top of the current top, then commit
gh stack modify                    # restructure interactively

init adopts existing branches without rewriting them: the branch names and commits stay, only the relationship is recorded. When a layer changes, the layers above it need a rebase (below).

Publishing

bash
gh stack submit --auto --remote <name>   # push every layer, open the missing PRs
gh stack push --remote <name>            # push the branches only
gh stack rebase                          # fetch and cascade-rebase locally, no push
gh stack sync                            # fetch, reconcile, rebase, push atomically, re-link the stack
  • submit without --auto opens an editor; with --auto it skips it. --auto creates new pull requests as drafts and --open marks them ready. The main ruleset runs Copilot review on drafts too (review_draft_pull_requests: true, review_on_push: false), so a draft gets a review but an amend does not trigger a second one.
  • An --auto title is not always the commit subject: a layer whose branch name is not a Conventional Commit subject gets a title built from the branch name. Check every layer (gh pr view <n> --json title,isDraft,baseRefName) and correct it with gh pr edit before asking for review.
  • sync is the safe way to reconcile: it pulls down branches that were added to the stack on GitHub, fast-forwards the trunk, cascade-rebases and pushes atomically. It prompts when local and remote diverge, which is the moment to stop and look rather than push.

When the remote cannot be chosen

A checkout can carry more than one remote, and gh stack then refuses to pick one: multiple remotes configured; set remote.pushDefault or use an interactive terminal. Name the remote where the command takes one — gh stack submit --remote <name>, gh stack push --remote <name> — and for rebase and sync, which have no such flag, inject the setting for that single command rather than changing the repository configuration:

bash
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=remote.pushDefault GIT_CONFIG_VALUE_0=<name> gh stack rebase
Show full SKILL.md (359 more words)Show less

Never overwrite a rebase you did not make

gh stack push force-pushes each layer with --force-with-lease computed from the stack's own view, so it can replace work that moved the branch elsewhere — including the GitHub Rebase stack button, which rebases on the server and force-pushes both layers. The lease does not save you, because the stack refreshes what it considers the expected remote state.

Before any push, compare the three heads:

bash
git fetch <remote>
git rev-parse --short HEAD <remote>/<branch>
gh pr view <n> --json headRefOid --jq .headRefOid

When the remote head is not what you last pushed, stop and reconcile (gh stack sync, or a plain git reset --hard <remote>/<branch> when you simply want to adopt the remote) instead of pushing over it. Keep a backup ref before any rewrite: git branch backup/<what> <sha>. And run gh stack from one worktree at a time: two sessions inside one stack each see a different "local" state.

Landing

main takes pull requests through a merge queue with the squash method (minimum one entry, a ten-minute wait, all green). The ruleset requires only the status-check context, does not require branches to be up to date (strict_required_status_checks_policy: false), and requires linear history, so a stack does not have to be rebased onto the newest main to be mergeable.

  • Merge from the bottom. When layer 1 lands, GitHub retargets layer 2's base to main; merge it next. gh stack merge merges the layers in order.
  • The GitHub UI offers Rebase stack and Enqueue stack; the CLI equivalents are gh stack rebase followed by gh stack push, and enqueueing the bottom pull request.
  • CI runs on pull_request and again on merge_group: the queue re-runs the required checks, so read the merge_group run before treating a queue failure as a code failure.
  • After the last layer merges, delete the head branches (remote and local) and remove the worktree. A fully merged stack needs no gh stack unstack; that command is for abandoning or restructuring a stack whose layers will not merge in order.

Watching a stack

bash
gh stack view                                  # the map and the PR links
gh pr checks <n>                               # one layer at a time; the stack has no single check set
cargo run -p xtask -- watch-pr <n>             # the state that decides landing, with a restorable baseline
gh pr view <n> --json state,mergeStateStatus,mergedAt

Where to look

© s3s-project, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/gh-stack of s3s-project/s3s.

Open the folder on GitHubat commit 0fdcb86

Compare with similar skills

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.

Gh Stack compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Gh Stack this skills3s-project/s3s311—~1.6kAutomated safety check: PassApache-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Check PRonyx-dot-app/onyx32k2 repos~2.3kAutomated safety check: PassMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Pull Request Title and Body Writeropeninterpreter/openinterpreter69k2 repos~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Check PR

    onyx-dot-app/onyx

    Checks a GitHub, GitLab, or Perforce (p4) pull request (or merge request, or shelved changelist) for unresolved review comments, failing status checks, and incomplete PR descriptions.

    32k GitHub starsUsed in 2 repos~2.3k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Pull Request Title and Body Writer

    openinterpreter/openinterpreter

    Rewrites the title and body of one or more pull requests with gh, leading with why the change was made, then what changed, and describing only the net result.

    69k GitHub starsUsed in 2 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Official

    Runs a loop on a GitHub pull request: fetch review state, triage comments into actions, implement them and resolve threads, repeating until nothing actionable is left.

    48k GitHub stars~2.2k tokensUpdated today
    DevelopmentAuto-check passed

More from s3s-project/s3s

All 10 skills in this repo
  • Code Coverage

    s3s-project/s3s

    Measure and grow the line coverage of the s3s crate. An agent skill from s3s-project/s3s.

    311 GitHub stars~789 tokensUpdated today
    Auto-check passed
  • Code Review

    s3s-project/s3s

    Review a pull request or a proposed change to this repository.

    311 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Codegen

    s3s-project/s3s

    Change generated code in this repository. An agent skill from s3s-project/s3s.

    311 GitHub stars~726 tokensUpdated today
    Auto-check passed
  • Fuzz Testing

    s3s-project/s3s

    Add, run or schedule a fuzz target in this repository. An agent skill from s3s-project/s3s.

    311 GitHub stars~838 tokensUpdated today
    Auto-check passed
  • Mutation Testing

    s3s-project/s3s

    Run or triage the mutation sweep in this repository. An agent skill from s3s-project/s3s.

    311 GitHub stars~917 tokensUpdated today
    Auto-check passed
  • Pull Request

    s3s-project/s3s

    Prepare a change for this repository as a pull request. An agent skill from s3s-project/s3s.

    311 GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Gh Stack

What does Gh Stack do?

Work with stacked pull requests in this repository using gh stack. Gh Stack is an agent skill from s3s-project/s3s. Work with stacked pull requests in this repository using gh stack.

When should I use Gh Stack?

Gh Stack fits situations like: A change is split across branches that build on each other; A stack must be rebased; A force-push to a stack branch has to be safe.

How do I install Gh Stack in Claude Code?

Run `npx skills add s3s-project/s3s --skill gh-stack -a claude-code`. Or copy the skill folder (.agents/skills/gh-stack in s3s-project/s3s) into .claude/skills/gh-stack in your project. Claude Code loads it when a task matches its description.

How do I install Gh Stack in Codex?

Run `npx skills add s3s-project/s3s --skill gh-stack -a codex`. Or copy the skill folder (.agents/skills/gh-stack in s3s-project/s3s) into .agents/skills/gh-stack in your project. Codex loads it when a task matches its description.

Can I use Gh Stack in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add s3s-project/s3s --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.

What does Gh Stack need to run?

Going by SKILL.md and its folder, Gh Stack needs the command-line tools its instructions call (gh, git and cargo).

Does Gh Stack access the network?

SKILL.md names 2 domains. As links in the text: github.com and docs.github.com. This is read from the text; nothing was executed.

Is Gh Stack safe to install?

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.

What licence does Gh Stack use?

Gh Stack is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Gh Stack use?

About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Gh Stack?

Skills that share tags, products or a category with Gh Stack: PR Babysitter (openinterpreter/openinterpreter, 69k stars), Check PR (onyx-dot-app/onyx, 32k stars), Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars) and Create Pull Request (cline/cline, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Gh Stack?

s3s-project (a GitHub organization) maintains it in s3s-project/s3s, which has 311 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 8, 2026.

Source: s3s-project/s3s on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.