pr-stack
/pr-stack
Maintain the "## スタック(PR シリーズ)" section across a stacked PR chain on GitHub. Use when adding a PR to a stack or refreshing the stack list — discovers the open base→tip chain, carries the merged ancestors and their descriptions forward, and patches every open PR body consistently (strikethrough for merged PRs, `(this)` per PR), preserving the rest of each body. Trigger phrases: "PR 스택 시리즈", "스택 본문 업데이트", "add this PR to the stack series".
- Author
- powdream ↗
- Repository
- claude-plugins ↗
- Licence
- MIT
- Last repository change
- 02.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: apply_stack.py
What it does and when to use it
Maintain the "## スタック(PR シリーズ)" section across a stacked PR chain on GitHub. Use when adding a PR to a stack or refreshing the stack list — discovers the open base→tip chain, carries the merged ancestors and their descriptions forward, and patches every open PR body consistently (strikethrough for merged PRs, `(this)` per PR), preserving the rest of each body. Trigger phrases: "PR 스택 시리즈", "스택 본문 업데이트", "add this PR to the stack series".
Triggers from the description
Arguments
/pr-stack [PR番号] [日本語の説明]
Original author description
Maintain the "## スタック(PR シリーズ)" section across a stacked PR chain on GitHub. Use when adding a PR to a stack or refreshing the stack list — discovers the open base→tip chain, carries the merged ancestors and their descriptions forward, and patches every open PR body consistently (strikethrough for merged PRs, `(this)` per PR), preserving the rest of each body. Trigger phrases: "PR 스택 시리즈", "스택 본문 업데이트", "add this PR to the stack series".
How it works
- How the stack chain is discovered (the foundation)
- Arguments
- Steps
- Notes
SKILL.md preview
---
name: pr-stack
description: Maintain the "## スタック(PR シリーズ)" section across a stacked PR chain on GitHub. Use when adding a PR to a stack or refreshing the stack list — discovers the open base→tip chain, carries the merged ancestors and their descriptions forward, and patches every open PR body consistently (strikethrough for merged PRs, `(this)` per PR), preserving the rest of each body. Trigger phrases: "PR 스택 시리즈", "스택 본문 업데이트", "add this PR to the stack series".
argument-hint: '[PR番号] [日本語の説明]'
---
# PR Stack Series
Keeps the **`## スタック(PR シリーズ)`** section in sync across a chain of
stacked PRs. The bundled `apply_stack.py` does the deterministic work:
discovering the chain, preserving the rest of each body (no clobbering pasted
images), carrying merged history forward, and placing the `(this)` marker per
PR.
The section it maintains looks like:
```
## スタック(PR シリーズ)
`(this)` が本 PR。左がベース(先にマージ)。
~~#71~~ → ~~#83~~ → #90 (this) → #94
- ~~#71~~ 短い説明 (TICKET-xxxx)
- ~~#83~~ 短い説明 (TICKET-xxxx)
- #90 短い説明 (TICKET-xxxx)
- #94 短い説明 (TICKET-xxxx)
```
`~~#N~~` = merged, plain `#N` = open, `(this)` marks the PR whose body you read.
## How the stack chain is discovered (the foundation)
The chain has two parts, found two different ways. **Always verify both before
writing** — the script prints them.
**1. The open chain — auto-discovered from branch relationships.** Stacked PRs
link by branch: each PR's `base` branch IS the `head` branch of the PR below it.
Among the open PRs:
- Build a `head branch → PR` map.
- From the target PR, walk **down**: while this PR's `base` is some open PR's
`head`, step to that PR (its parent). Stop when `base` is `master`/`main` (or
any branch with no open PR) — that is the bottom of the open chain.
- Walk **up**: while some open PR's `base` equals this PR's `head`, step to that
PR (its child). Stop at the tip.
- Order base → tip.
(Linear stacks resolve cleanly. At a branch point the script takes the first
child — eyeball the printed chain.)
**2. Merged ancestors — carried forward from the existing section.** When a PR
merges, GitHub retargets its children onto `master`, so the merged PR drops out
of the base/head chain and **cannot be auto-discovered**. The script recovers
the merged ancestors (and every PR's description) by parsing the `## スタック`
bullets already in a stack PR's body. The curated list is therefore the source
of truth for history; re-running is idempotent.
**The script prints the split so you can check it:**
```
open chain (base→tip, auto-discovered): #2082 → #2080 → #2085
merged ancestors (carried forward from section): #2071, #2083, #2078
full stack: ~~#2071~~ → ~~#2083~~ → ~~#2078~~ → #2082 → #2080 → #2085
```
If the open chain or merged set is wrong, fix the input (or the existing
section) before applying — do not push a wrong chain.
## Arguments
`/pr-stack [PR番号] [日本語の説明]` — both optional:
- **PR番号** — the PR to anchor on (any open PR in the stack; usually the new
tip). Omitted ⇒ the current branch's PR
(`gh pr view --json number -q .number`).
- **日本語の説明** — bullet text for a newly added PR, style
`<短い説明> (<ISSUE-ID>)`. Omitted ⇒ derive a concise one from the PR
title / issue (confirm if unsure). Already-listed PRs ignore this; their
text is carried forward.
Examples: `/pr-stack` · `/pr-stack 機能の概要 (TICKET-123)` ·
`/pr-stack 2085 機能の概要 (TICKET-123)`.
## Steps
1. Run from inside the repo (or pass `--repo owner/name`).
2. Resolve the target PR from the argument, else the current branch's PR
(`gh pr view --json number -q .number`).
3. For a **new** PR not yet in the section, take the Japanese description from
the argument (or derive `<短い説明> (<ISSUE-ID>)` from the title/issue) and
pass it via `--desc`. PRs already in the section need no flag — their
description and merged/open status are derived automatically.
4. **Dry-run, read the printed chain split + bodies, then apply.**
`apply_stack.py` sits next to this `SKILL.md`. Resolve this skill's directory
(the folder containing this `SKILL.md`) and run the script from there:
```bash
python3 <skill-dir>/apply_stack.py \
--pr <NUMBER> --desc "<NUMBER>=<短い説明> (<ISSUE-ID>)" --dry-run
# chain + bodies look right ↓
python3 <skill-dir>/apply_stack.py \
--pr <NUMBER> --desc "<NUMBER>=<短い説明> (<ISSUE-ID>)"
```
5. Verify one PR's chain line: `gh pr view <N> --json body -q .body`.
## Notes
- GitHub body content here is **Japanese** — keep descriptions Japanese.
- Only open PRs are patched; merged ones are left alone (just shown struck).
- **Bootstrapping** (no section yet, ancestors already merged): the walk only
finds the open chain, so list merged ancestors by hand via `--desc` the first
time; they persist afterward.
- The script inserts the section before a trailing `---` footer when present,
else appends it. It replaces only the section, never the rest of the body.
- `--repo` is optional inside the repo; `gh` infers it.
Files in this package (2)
- SKILL.md 5 KB
- apply_stack.py 6 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · powdream/claude-plugins | 100 | MIT |
| piabrota/nix-os | 100 | MPL-2.0 |
| gathertown/eng-workflow | 100 | MIT |
Database snapshot: 13.11.2026 · package version 1cb729fa924f (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100stacked-prs
Open, update and merge pull requests that depend on each other as a GitHub stack, with the gh stack extension. Use whenever a change builds on another pull request that hasn't merged yet, when splitting a large change into reviewable layers, when a stacked PR needs rebasing… - 100pg-merging-stacked-prs
Use when landing a stack of dependent GitHub PRs (A ← B ← C, where each bases on the one below) onto the trunk, merging a PR whose base is another open PR's branch, or whenever a request mentions "stacked PRs", "PR stack", "dependent PRs", or merging several related PRs in… - 100dsh-merging-stacked-prs
Use when landing a stack of dependent GitHub PRs (A ← B ← C, where each bases on the one below) onto master, merging a PR whose base is another open PR's branch, or whenever a request mentions "stacked PRs", "PR stack", "dependent PRs", or merging several related PRs in… - 100stacked-prs
Work with GitHub stacked pull requests (gh stack) in the team's repos. Put a branch on the right stack, commit, push and open its PR with the "Stacked on" banner, fix a merge conflict on the one branch that has it, and walk a stack bottom to top. Use whenever the user says "on… - 100dsh-merging-stacked-prs
Use when landing a stack of dependent GitHub PRs (A ← B ← C, where each bases on the one below) onto master, merging a PR whose base is another open PR's branch, or whenever a request mentions "stacked PRs", "PR stack", "dependent PRs", or merging several related PRs in… - 100stacked-prs
GitHub's native stacked pull requests and the `gh stack` CLI. Covers creating a stack, editing a layer, restacking after a merge, and merging part or all of a stack. Use whenever the user mentions stacked PRs, a PR stack, GitHub stacks, dependent PRs, or `gh stack`, when…