Use when the GitHub CLI or its gh-stack extension is missing or unauthenticated, when `gh stack` commands fail with an auth error, or when the user asks to install gh-stack, set up stacked PRs, or log in to GitHub. Triggered by check-status.sh reporting "gh=NOT installed", "ext=NOT installed", or "auth=NOT authenticated".
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Stack Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/xingliu0923-stack-setup)
---
name: stack-setup
description: Use when the GitHub CLI or its gh-stack extension is missing or unauthenticated, when `gh stack` commands fail with an auth error, or when the user asks to install gh-stack, set up stacked PRs, or log in to GitHub. Triggered by check-status.sh reporting "gh=NOT installed", "ext=NOT installed", or "auth=NOT authenticated".
---
# Setting up `gh stack`
Work through only the steps the probe says are missing. Re-run the probe after
each one.
## 1. Confirm what is actually missing
```bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-status.sh"
```
## 2. `gh=NOT installed` — install the GitHub CLI
Ask the user which they prefer; do not pick silently.
```bash
brew install gh # macOS / Linuxbrew
winget install --id GitHub.cli # Windows
```
Anything else: point them at <https://github.com/cli/cli#installation>.
## 3. `auth=NOT authenticated` — log in
**The user runs this in their own terminal, not you.**
```bash
gh auth login
```
It is interactive: it opens a browser and prompts for a one-time code. Running
it from an agent session blocks forever.
### Token handling rules — no exceptions
* Never ask the user to paste a token into the chat.
* Never run `gh auth login --with-token` yourself.
* Never echo, log, store, or copy a token.
* Never read `~/.config/gh/hosts.yml` or `$GH_CONFIG_DIR`.
* `gh auth status` is the only supported check. It prints no secret.
If the user is on GitHub Enterprise, `gh auth login --hostname <host>`, and
`GH_HOST` selects it for later commands.
## 4. `ext=NOT installed` — install the extension
```bash
gh extension install github/gh-stack
```
This compiles from source and can take a minute or two. Later upgrades:
```bash
gh extension upgrade gh-stack
```
## 5. Configure git for stack work
Both of these prevent real failures, so set them unless the user objects:
```bash
git config --global rerere.enabled true # remember conflict resolutions;
# a restack replays the same conflict
# once per layer without it
git config remote.pushDefault origin # REQUIRED if the repo has more than
# one remote, or push/submit/sync/
# rebase/link need --remote every time
```
`gh stack checkout` and `gh stack trunk` have **no** `--remote` flag at all, so
in a multi-remote repository `remote.pushDefault` is not optional.
## 6. Verify
```bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-status.sh"
```
All of `gh=installed`, `ext=installed`, `auth=authenticated` should now hold.
`stacks=NOT available` is **not** a setup failure — it means stacked PRs are not
enabled on that particular repository. Nothing in this skill fixes that; tell
the user and use the ordinary single-PR workflow there.
## Related skills
* **pr-stack:stack** — the workflow itself, and the blocked-command contract.
* **pr-stack:split-pr** — split an existing oversized branch into a stack.