GitHub Stack
Before any shell command that may contact GitHub or a package registry, read
and follow Network execution.
Role
Use this skill for stack-level work through <plugin-root>/scripts/g stack .... The wrapper delegates stack state, branch ordering, PR linking,
rebasing, synchronization, and merge behavior to the official
github/gh-stack extension while enforcing non-interactive invocation.
Resolve <plugin-root> as two directories above this SKILL.md. Read
../../references/stack-cli.md before using
the command surface, load
../../references/gh-dependency-preflight.md
for the scoped gh and gh-stack readiness gate, and load
references/workflows.md for the requested lifecycle
operation.
Boundaries
- Use
$g:send for publishing or updating one PR, including its title,
body, closing issue references, draft state, and push ownership.
- Use this skill for an explicit parent/child link, even when the PRs were just
published by
$g:send. send does not infer or invoke stack link; do not
replace this explicit relationship flow with stack submit.
- Use this skill when the user explicitly asks for stack-wide publication,
navigation, rebase, sync, restructuring, merge, or recovery.
- Do not silently turn a single-PR request into a stack-wide operation.
stack submit is an explicit multi-branch publication mode. It does not
inherit send's issue-linkage, body, or draft-preservation contract; route
those responsibilities separately when required.
Readiness and authorization
- Resolve the repository and plugin root.
- Load and pass the shared
gh dependency preflight. It owns the host CLI,
authenticated-provider, and exact github/gh-stack checks.
- If the extension is missing, stop and report the prerequisite. Run
g --json stack ensure --install only after the user explicitly
authorizes installing github/gh-stack.
- Never fall back silently to an ordinary unstacked PR workflow when stack
state is unavailable, ambiguous, or unsupported.
- Treat
push, submit, sync, rebase, merge, and remote unstack as
separate mutations. Explain their scope before executing them.
Non-interactive rules
Always supply the positional arguments and flags required by the wrapper:
init, add, and checkout require an explicit branch, stack, PR, or URL;
view requires --json;
submit requires --auto;
merge requires an explicit target and --yes;
- remote
unstack requires an explicit target; use unstack --local for local
tracking only.
Never invoke blocked interactive commands such as modify, switch, alias,
or feedback. Do not use the raw escape hatch unless the typed surface cannot
express an explicitly requested non-interactive operation.
Core operating rules
- Model the stack from trunk upward: foundational changes belong in lower
branches and dependent changes in higher branches.
- Keep each branch a cohesive, independently reviewable unit.
- When changing a lower or middle branch, work on that branch, commit there,
then run
rebase --upstack before returning to the higher branch.
- Use
view --json for a locally tracked stack; remote-only links use the
relationship readback in references/workflows.md. Verify before and after
consequential operations and preserve exact branch/PR state in the handoff.
- For conflicts, resolve and stage files, then use
rebase --continue; use
rebase --abort to restore the pre-rebase state.
- After a lower PR merges, use
sync to fetch, reconcile, rebase, push, and
update stack state. Use --prune only when local merged branches should be
removed.
- Merge stacks only with
stack merge ... --yes; do not substitute
gh pr merge.
1---2name: github-stack3description: Manage stacked Git branches and dependent pull requests through the G stack CLI.4---56# GitHub Stack78Before any shell command that may contact GitHub or a package registry, read9and follow [Network execution](../../references/network-execution.md).1011## Role1213Use this skill for stack-level work through `<plugin-root>/scripts/g14stack ...`. The wrapper delegates stack state, branch ordering, PR linking,15rebasing, synchronization, and merge behavior to the official16`github/gh-stack` extension while enforcing non-interactive invocation.1718Resolve `<plugin-root>` as two directories above this `SKILL.md`. Read19[`../../references/stack-cli.md`](../../references/stack-cli.md) before using20the command surface, load21[`../../references/gh-dependency-preflight.md`](../../references/gh-dependency-preflight.md)22for the scoped `gh` and `gh-stack` readiness gate, and load23[`references/workflows.md`](references/workflows.md) for the requested lifecycle24operation.2526## Boundaries2728- Use `$g:send` for publishing or updating one PR, including its title,29 body, closing issue references, draft state, and push ownership.30- Use this skill for an explicit parent/child link, even when the PRs were just31 published by `$g:send`. `send` does not infer or invoke `stack link`; do not32 replace this explicit relationship flow with `stack submit`.33- Use this skill when the user explicitly asks for stack-wide publication,34 navigation, rebase, sync, restructuring, merge, or recovery.35- Do not silently turn a single-PR request into a stack-wide operation.36- `stack submit` is an explicit multi-branch publication mode. It does not37 inherit `send`'s issue-linkage, body, or draft-preservation contract; route38 those responsibilities separately when required.3940## Readiness and authorization41421. Resolve the repository and plugin root.432. Load and pass the shared `gh` dependency preflight. It owns the host CLI,44 authenticated-provider, and exact `github/gh-stack` checks.453. If the extension is missing, stop and report the prerequisite. Run46 `g --json stack ensure --install` only after the user explicitly47 authorizes installing `github/gh-stack`.484. Never fall back silently to an ordinary unstacked PR workflow when stack49 state is unavailable, ambiguous, or unsupported.505. Treat `push`, `submit`, `sync`, `rebase`, `merge`, and remote `unstack` as51 separate mutations. Explain their scope before executing them.5253## Non-interactive rules5455Always supply the positional arguments and flags required by the wrapper:5657- `init`, `add`, and `checkout` require an explicit branch, stack, PR, or URL;58- `view` requires `--json`;59- `submit` requires `--auto`;60- `merge` requires an explicit target and `--yes`;61- remote `unstack` requires an explicit target; use `unstack --local` for local62 tracking only.6364Never invoke blocked interactive commands such as `modify`, `switch`, `alias`,65or `feedback`. Do not use the raw escape hatch unless the typed surface cannot66express an explicitly requested non-interactive operation.6768## Core operating rules6970- Model the stack from trunk upward: foundational changes belong in lower71 branches and dependent changes in higher branches.72- Keep each branch a cohesive, independently reviewable unit.73- When changing a lower or middle branch, work on that branch, commit there,74 then run `rebase --upstack` before returning to the higher branch.75- Use `view --json` for a locally tracked stack; remote-only links use the76 relationship readback in `references/workflows.md`. Verify before and after77 consequential operations and preserve exact branch/PR state in the handoff.78- For conflicts, resolve and stage files, then use `rebase --continue`; use79 `rebase --abort` to restore the pre-rebase state.80- After a lower PR merges, use `sync` to fetch, reconcile, rebase, push, and81 update stack state. Use `--prune` only when local merged branches should be82 removed.83- Merge stacks only with `stack merge ... --yes`; do not substitute84 `gh pr merge`.