- name
- gh-stack
- description
- Manage Cherry Studio stacked branches and pull requests with the GitHub gh-stack extension. Use for planning, creating, inspecting, rebasing, syncing, linking, or recovering a stack of dependent PRs.
- metadata
- author: github upstream-version: "0.0.8"
GitHub Stack
Use gh stack for branch topology and synchronization. Use the repository's gh-create-pr skill for Cherry-specific PR bodies, Spec approval, AC coverage, verification, and Agent Note lifecycle.
Availability and prerequisites
This public skill is tracked in .agents/skills/ and discovered from the repository. Developers do not install a separate agent skill. pnpm skills:sync maintains the .claude/skills/ compatibility symlink.
Run this preflight before the first gh stack command in a task:
command -v gh >/dev/null 2>&1 || {
echo "GitHub CLI is required: https://cli.github.com/" >&2
exit 1
}
gh auth status
if ! gh stack --help >/dev/null 2>&1; then
gh extension install github/gh-stack
fi
gh stack --help >/dev/null
If GitHub CLI authentication, extension installation, or the final verification fails, stop and report the failing command. Do not guess stack topology with ad hoc branch comparisons.
Before initializing a stack, avoid extension prompts:
git config rerere.enabled true
When multiple remotes exist, resolve the intended remote and pass --remote <name> to commands that accept it. Do not silently change remote.pushDefault for the developer.
Stack model
A stack is a linear dependency chain. The bottom branch is closest to the trunk; each higher branch contains only work that depends on the layer below it.
main
-> spec
-> implementation-core
-> implementation-ui
Plan the complete dependency order before creating branches. Put a newly discovered lower-layer change on its owning branch, then rebase the upstack branches; do not hide it in the current layer.
Agent-safe commands
All commands must be non-interactive:
- Always run
gh stack view --json; plainviewopens a TUI. - Always supply branch names to
init,add, andcheckout. - Always use
--autowithsubmitif that command is explicitly allowed. - Pass to , , , or when more than one remote exists.