Skip to content

[skills] add gh-stack skill for stacked PRs - #12255

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-add-gh-stack-skill
Jul 29, 2026
Merged

[skills] add gh-stack skill for stacked PRs#12255
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-add-gh-stack-skill

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Adds the gh-stack agent skill (v0.0.8) to .github/skills/gh-stack/SKILL.md, alongside our existing skills (ci-status, tests, android-reviewer, etc.).

The skill teaches agents how to build and maintain stacked PRs: a chain of branches where each branch is based on the one below it, so each PR only shows the diff for its own layer.

main (trunk)
 └── auth-layer     → PR #1 (base: main)
  └── api-endpoints → PR #2 (base: auth-layer)
   └── frontend     → PR #3 (base: api-endpoints)

What you need to install

This skill is just documentation — it does nothing on its own. Two things are required:

1. GitHub CLI (gh) v2.0+, authenticated

2. The github/gh-stack extension

gh extension install github/gh-stack

3. Recommended git config (avoids interactive prompts that hang agents)

git config rerere.enabled true        # remember conflict resolutions
git config remote.pushDefault origin  # skip the remote picker

The skill itself was installed with the GitHub CLI's skill support:

gh skill install github/gh-stack gh-stack

(Installed into .agents/skills/ by default; moved to .github/skills/ to match this repo's layout. Docs: https://cli.github.com/manual/gh_skill and the Agent Skills spec at https://agentskills.io/specification.)

Example commands

Create a stack from scratch:

gh stack init auth-layer          # start a stack on the current trunk
# ...make commits...
gh stack add api-endpoints        # add the next layer on top
# ...make commits...
gh stack submit --auto            # push all branches and open the PRs

Inspect and navigate:

gh stack view --json              # machine-readable status (never omit --json)
gh stack down                     # move toward trunk
gh stack up                       # move away from trunk
gh stack top / gh stack bottom

Keep it healthy after a merge or an upstream main update:

gh stack sync                     # rebase the whole stack onto updated trunk
gh stack rebase                   # re-stack after amending a mid-stack branch
gh stack push                     # force-with-lease push the rebased branches

Tear down:

gh stack unstack

Agent-relevant gotchas captured in the skill: always pass branch names positionally, always use --auto with submit and --json with view, and use --remote <name> when multiple remotes exist — otherwise the commands drop into a TUI or prompt and hang.

Note

Skills are not verified by GitHub, so SKILL.md should get the usual review pass before merge. Content here is unmodified from github/gh-stack@v0.0.8 other than the file's location.

Adds the `gh-stack` agent skill from github/gh-stack v0.0.8 so agents
(and humans) have guidance for creating and maintaining stacks of
dependent pull requests.

Requires the GitHub CLI plus the `github/gh-stack` extension:

    gh extension install github/gh-stack

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9482ddb9-95d2-49ba-84ab-1ae263e31f9e
@jonathanpeppers
jonathanpeppers marked this pull request as ready for review July 28, 2026 19:48
Copilot AI review requested due to automatic review settings July 28, 2026 19:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new agent skill document for gh-stack to this repo’s .github/skills/ collection, documenting how to manage stacked PR workflows non-interactively using the github/gh-stack GitHub CLI extension.

Changes:

  • Added .github/skills/gh-stack/SKILL.md (v0.0.8) describing stacked-PR concepts, command reference, and agent-safe non-interactive usage patterns.

Comment thread .github/skills/gh-stack/SKILL.md
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Jul 28, 2026
@dalexsoto

Copy link
Copy Markdown
Member

@copilot Please mirror this PR to dotnet/macios repo using branch name dev/copilot/gh-stack

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@dalexsoto I've opened a new pull request, #12256, to work on those changes. Once the pull request is ready, I'll request review from you.

dalexsoto added a commit to dotnet/macios that referenced this pull request Jul 29, 2026
Mirrors `dotnet/android#12255`, adding the upstream `gh-stack` v0.0.8
agent skill to macios.

## Changes

- Added `.github/skills/gh-stack/SKILL.md`.
- Documented stack creation, navigation, synchronization, rebasing, and
recovery.
- Captured non-interactive agent requirements, including explicit branch
arguments, `submit --auto`, and `view --json`.

## Example

```bash
gh stack submit --auto
gh stack view --json
```

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dalexsoto <204671+dalexsoto@users.noreply.github.com>
@jonathanpeppers
jonathanpeppers merged commit 444db99 into main Jul 29, 2026
43 of 45 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-add-gh-stack-skill branch July 29, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants