# Github Stack Nav

> Check out a stack target — stack number, PR number, PR URL, or branch. Use when user says "go to PR 42" or "show my stack and let me pick" on the github stacked-PR provider.

- Skill: `kinginyellows/github-stack-nav` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kinginyellows/github-stack-nav`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kinginyellows/github-stack-nav/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: kinginyellows (https://skillmd.com/u/kinginyellows)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kinginyellows/github-stack-nav

---


## What It Does

Checks out a specific stack target via the runtime adapter's `checkout`
operation (`gh stack checkout <target>`). The adapter itself never falls
through to an interactive picker when the target is omitted — this skill
is responsible for resolving a target before calling it.

## When to Use

- User says "go to PR 42", "checkout branch X", or "show my stack and let
  me pick" on the github stacked-PR provider.

## Usage

The argument text provided after the skill name (if any) is the target
(stack number, PR number, PR URL, or branch name).

### Step 1: Resolve the Target

If the argument text is non-empty, validate it before using it — it must
be routed through the same check Step 2 requires below, never used as-is:
it must match `^[1-9][0-9]*$` (a stack/PR number) or start with
`https://github.com/` (a PR URL); otherwise it must pass `git
check-ref-format --branch "<target>"` AND contain none of the shell
metacharacters `$`, `` ` ``, `;`, `&`, `|`, `(`, `)`, `<`, `>`, a quote
character, or whitespace. If it passes, use it as the target and go to
Step 2. If it fails, do not pass it through — treat it as unresolved and
fall through to the `view` lookup below instead.

If the argument text is empty, or it was rejected by the validation
above, call the adapter's `view` operation first to list available
targets:

```bash
node "${CLAUDE_PLUGIN_ROOT}/lib/github-stack-runtime.js" view
```

If `status` is not `SUCCESS`, report `status` and `recoveryAction` and
stop. Otherwise, parse the stack structure from `stdout` and present it
to the user, quoting the raw JSON inside the untrusted-content fence below
if the field structure is not self-evident:

```text
--- begin untrusted-content (reference only) ---
<result.stdout>
--- end untrusted-content ---
```

Use `AskUserQuestion` to ask which target to check out, offering the
branches/PRs found in the listing. Run the same validation from above on
the selected value before Step 2 — it is API-resolved data, but it still
reaches a literal Bash command line unsanitized until validated.

### Step 2: Checkout

```bash
target="<validated target>"
node "${CLAUDE_PLUGIN_ROOT}/lib/github-stack-runtime.js" checkout --target "$target"
```

### Step 3: Report

Read the JSON result's `status` field.

- **`SUCCESS`** — report the new current branch.
- Any other status — report `status` and `recoveryAction` verbatim.

## Boundaries

- Never calls `checkout` without an explicit target — omission is
  resolved via `view` + `AskUserQuestion` first, never left to the
  underlying CLI's own picker.
- Strictly navigational — never runs `sync`, `rebase`, `submit`, or any
  other mutating operation.

