agentleFS
sreejithramansreejithraman/SreeStack/skills/gh-stack/SKILL.md

gh-stack

Skill1 starsChanged 16 days agoMITView on GitHub

Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack. Use for stack creation, viewing, edits, push, submit, sync, rebase, merge, or checkout; when asked to split or isolate work for review; whenever a user mentions a stack, branch layers, dependent PRs, or gh stack; or when a stack is checked out.

43 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use gh-create-pr, gh-commit and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ant-designSkill

    gh-create-pr

    使用 GitHub CLI (gh) 推送当前分支并创建或更新 PR。在用户说「提 PR」「新建 PR」「用 gh 建 PR」「submit PR」「create pull request」时使用。

    Also in 4 projects that use this

  • kelvincushmanSkill

    gh-commit

    Create well-formatted commits with conventional commit format.

    Also in 3 projects that use this

  • kelvincushmanSkill

    prek

    Use when setting up or running hooks with prek in any repository. prek is a Rust drop-in alternative to pre-commit for running Git hooks that check, format, lint, and validate code and repository files. Prefer it when speed, workspace mode, built-in hooks, shared toolchains, or native TOML configuration matter.

    Also in 3 projects that use this

  • carapace-shSkill

    bun

    Use when working with the bun CLI — Bun's all-in-one JavaScript runtime and toolkit. Covers the CLI command reference (install, add, remove, run, build, test, x, create, init, pm, upgrade, link, unlink), bunfig.toml configuration, environment variables, the package manager and lockfile, the test runner, the bundler, the Bun runtime API (Bun.serve, Bun.file, Bun.spawn, Bun.write, hashing, transpiler), the Bun shell ($ template literal), module resolution and loaders, and globals. Triggers on: "bun", "bunx", "bun install", "bun add", "bun remove", "bun run", "bun build", "bun test", "bun x", "bun create", "bun init", "bun pm", "bun upgrade", "bun link", "bun unlink", "bunfig.toml", "bun.lock", "Bun.serve", "Bun.file", "Bun.write", "Bun.spawn", "Bun.hash", "Bun.password", "bun:test", "Bun.build", "Bun.Transpiler", "bun shell", "$ template", "import.meta", "JavaScriptCore", "Bun.serve", "HTMLRewriter", "Bun.SQL", "Bun.RedisClient", "Bun.Glob", "Bun.plugin", "bun:ffi".

    Also in 3 projects that use this

  • xfstudioSkill

    typescript-expert

    TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling. Use PROACTIVELY for any TypeScript/JavaScript issues including complex type gymnastics, build performance, debugging, and architectural decisions. If a specialized expert is a better fit, I will recommend switching and stop.

    Also in 3 projects that use this

  • xfstudioSkill

    typescript-advanced-types

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 42 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check gh stack --version and gh stack <command> --help before relying on newer capabilities.

    line 26
  2. Very specific:

    Before a new stack's first init, check that setup for the rerere prompt.

    line 29
  3. Distinctive:

    Before checkout or history-changing work, follow Preserve local files in every affected worktree.

    line 31
  4. Distinctive:

    Use names from the task; branch names are used verbatim, including slashes.

    line 59

“Common” is measured: kept by at least 6 in 10 of the 42 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

gh-stack

gh stack manages linear chains of branches and PRs. Stacks print trunk-first: (main) <- auth <- api <- frontend. Left is bottom and merges first; right is top. up moves away from trunk; down moves toward it. Put dependencies below their callers and use separate stacks for independent work.

Before acting

  • Plan new layers with stack design before writing code. For an existing stack, inspect gh stack view --json and edit the layer that owns the concern; use git log --all -- <path> when ownership is unclear.
  • Check gh stack --version and gh stack <command> --help before relying on newer capabilities. gh stack help <command> prints top-level help instead. For installation/configuration, use setup. Before a new stack's first init, check that setup for the rerere prompt; explicit branch names alone do not suppress it.
  • Before checkout or history-changing work, follow Preserve local files in every affected worktree. Retain verified backups through conflicts and recovery.
  • With multiple remotes, push, submit, sync, rebase, and link need --remote <name> unless remote.pushDefault selects it. checkout and trunk have no --remote flag and require that config.
  • Register every scoped PR taken over, created, or pushed through T3 thread registration; a CLI operation does not register its layers with the thread.

Worktree capabilities

Shared catalogs, foreign-owner navigation, and owner-aware recovery require a supporting extension. Check the installed version and relevant help before assuming those behaviors. If navigation help lacks --print-path, use Git's worktree inventory to locate an existing owner and work there; do not invent that flag, force another checkout, mix old/new writers, or upgrade outside scope.

With supported path mode, navigation or explicit-target checkout --print-path returns an owner's path without taking its checkout. Unoccupied targets are checked out here first. Use stdout only after exit 0, quote the path, and never eval it. See navigation for the guarded shell helper and worktree recovery for migration and ownership limits.

Common calls

Give explicit arguments and flags even under a PTY: bare commands can open a TUI. Use names from the task; branch names are used verbatim, including slashes.

TaskNon-interactive call
Inspect stategh stack view --json
Create layers bottom to topgh stack init <branch>...
Add the next layer from the topgh stack add <branch>
Select a layer or stackgh stack checkout <target>
Navigategh stack up, down, top, bottom, or trunk
Publish PR layersgh stack submit --auto
Update branches without creating PRsgh stack push
Replay upper layers after a lower-layer editgh stack rebase --upstack
Synchronizegh stack sync
Merge a scoped setgh stack merge <target> --yes

Stage specific files and commit the owning layer before moving up. After an edit below the top, rebase upstack, return to the top, then push. Read the affected command behavior for preconditions and partial effects.

submit --auto creates drafts; --open marks new and existing PRs ready for review. Titles/bodies are generated; use gh pr edit for custom text. sync fetches, reconciles, rebases, pushes, and refreshes PR state; pruning needs --prune when non-interactive. A diverged stack can return exit 0 with Sync aborted: verify the resulting state instead of declaring synchronization.

A merge target scopes the operation: a PR includes every unmerged PR below it; a stack number includes the whole unmerged stack. Bare numbers resolve as stack numbers first; confirm the selected set when IDs overlap. The selected set is all-or-nothing for direct merging. A base merge queue chooses the method despite method flags and can land separate groups. Use gh stack merge, following the caller's merge authorization. See merge behavior.

Other public commands: link, unstack (see command behavior); alias, feedback (see installed help). switch and the modify editor are menu-only; use explicit checkout/navigation, or the documented recovery flags for an existing interrupted operation. For non-interactive restructuring, read restructuring.

State and failures

Parse successful view --json stdout; status messages are on stderr. view --short is human-readable. The state schema and exit codes live with command behavior.

On exit 3, follow conflict recovery. A failed rebase pauses; sync attempts rollback. Inspect whether restoration completed before restarting anything. Resolve/stage only in the diagnostic's owner worktree; a later conflict may name another owner. Supported recovery flags use recorded owners. Keep retained files accounted for after success or recovery. Lock and interrupted-modify diagnostics also require their specific recovery procedure, rather than bypassing state.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.