with one click
review-stack
// Walk a Graphite stack bottom-to-top, fixing PR review comments on each branch
// Walk a Graphite stack bottom-to-top, fixing PR review comments on each branch
Execute a list of tasks as a stack of PRs using Graphite (`gt`). Each task becomes one branch, one commit, one PR. Use when the project uses stacked PRs via Graphite and you have multiple tasks to ship.
Stacked PRs with Graphite CLI (gt)
Expert guidance on Neovim configuration, plugin management, lazy.nvim, LSP setup, and editor workflow optimization
Stacked PRs with Charcoal CLI (charcoal)
Distribute uncommitted changes across a Graphite stack using a backup branch
Generate feature documentation — PRDs, RFCs, ADRs, plans, technical docs, tasks, guides, testing docs, runbooks, and changelogs — individually or as a progressive pipeline covering a feature's full lifecycle
| name | review-stack |
| description | Walk a Graphite stack bottom-to-top, fixing PR review comments on each branch |
Walk a Graphite PR stack from bottom to top, fetching review comments for each PR, fixing the issues, verifying, and pushing — then moving up to the next branch until the entire stack is addressed.
gt) installed and configuredgh) authenticated with repo accessWARNING: Do NOT run /fresh or gt checkout main before starting this
workflow. You must stay on a branch within the target stack so that
gt log short shows the correct stack topology. Switching to main loses the
stack context.
gh-pr-info — Look up repo, PR numbers, review status, CI checks, diffsgh-pr-comments — Fetch all three comment types from a PRgh-pr-reply — Post replies to inline review commentsBefore touching any code, understand the full picture.
Use gh-pr-info to identify the stack's PRs:
SCRIPT=~/.claude/skills/gh-pr-info/scripts/get-pr-info.sh
# 1. Get the repo owner/name
$SCRIPT repo
# 2. View the current stack — THIS defines which branches are in the stack
gt log short
# 3. Get PR number for each stack branch
$SCRIPT pr-for-branch <branch-name>
# 4. Or list all open PRs and cross-reference with gt log short
$SCRIPT list-open
CRITICAL: Do NOT treat list-open as "the stack." It returns ALL open PRs
across ALL stacks. Cross-reference with gt log short to identify which PRs are
in the current stack. See the graphite/references/identify-stack-prs.md
reference for details.
Build a map of branch → PR number for ONLY the branches shown in
gt log short. Discard PRs whose branch doesn't appear in the gt log short
output — those belong to other stacks.
# Start at the bottom of the stack
gt bottom
Then for each branch, repeat the Fix Cycle below until you reach the top.
~/.claude/skills/gh-pr-info/scripts/get-pr-info.sh pr-for-branch
Use gh-pr-comments to get all three comment types:
~/.claude/skills/gh-pr-comments/scripts/fetch-pr-comments.sh <owner/repo> <pr_number>
This returns inline review comments, general discussion, and review summaries in a single JSON response with bot comments filtered out.
For each comment, determine:
Present the triage to the user before making changes, summarizing:
PR #XX: [title] — [N] comments
1. [actionable] path/to/file.ex:42 — "Add comment explaining <<0>>"
2. [actionable] path/to/file.ex:101 — "Refactor to reuse helper"
3. [question] path/to/file.ex:55 — "Why not use Stream here?"
4. [stale] path/to/file.ex:76 — Already fixed in previous push
For each actionable comment:
Run the project's verification command before committing:
# Check CLAUDE.md for project-specific verification
# Common examples:
mix precommit # Elixir/Phoenix
npm run lint && npm test # Node.js
cargo clippy && cargo test # Rust
Fix any verification failures before proceeding.
# Amend the current branch's commit with the fixes
gt modify --all
# Push the entire stack (restacks upstack branches automatically)
gt submit --stack --publish --ai
Always use --stack — this ensures upstack branches are rebased onto your
fixes and all PRs stay in sync.
# Move to the next branch in the stack
gt up
If gt up fails (you're at the top), the traversal is complete.
After processing all branches, present a summary:
Stack Review Complete
PR #20: feat(sandbox): hardening — 4 comments fixed
PR #21: feat(agent): file actions — 0 comments (clean)
PR #22: test(agent): add tests — 2 comments fixed, 1 question flagged
PR #23: docs(agent): update docs — 1 comment fixed
Action needed:
- PR #22: Reply to question about Stream usage on line 55
--stack on SubmitWrong: gt submit (only pushes current branch) Right:
gt submit --stack --publish --ai (pushes entire stack, keeps it in sync)
Without --stack, upstack branches won't be rebased onto your fixes, causing
divergence.
GitHub has THREE places where review feedback can appear. The gh-pr-comments
script fetches all three automatically. See the gh-pr-comments skill for
details on comment types.
After pushing fixes, old review comments remain on the PR pointing at outdated line numbers. Before fixing a comment:
Each PR corresponds to a specific branch. Before making any changes:
# Verify you're on the right branch
git branch --show-current
# Verify this matches the PR you're fixing
~/.claude/skills/gh-pr-info/scripts/get-pr-info.sh pr-for-branch
Fixes on one branch can break tests for upstack branches after restacking.
Always verify after gt modify --all and before gt submit.
A comment on PR #22 might reference code that was introduced in PR #20. The fix must be applied on PR #20's branch, not PR #22's. Check which branch introduced the code before fixing.
# Check which branch introduced a file
gt log short # See the stack order
git log --oneline --follow path/to/file.ex # See which commit added/modified it
Skip it — gt up and continue.
Flag it to the user with the comment text and context. Don't make changes.
Consider using gh-pr-reply to respond.
If gt submit --stack hits a restack conflict:
# Resolve conflicts in editor
git add .
gt continue
# Then retry
gt submit --stack --publish --ai
If a branch in the middle of the stack was merged:
gt sync # Clean up merged branches
gt log short # Verify remaining stack
# Continue from the next unmerged branch
| Step | Command / Skill |
|---|---|
| View stack | gt log short |
| Go to bottom | gt bottom |
| Get repo | gh-pr-info → repo |
| Get current branch PR | gh-pr-info → pr-for-branch |
| Fetch all comments | gh-pr-comments → fetch-pr-comments.sh <repo> <number> |
| Reply to comment | gh-pr-reply → reply-to-comment.sh <repo> <pr> <id> |
| Amend fixes | gt modify --all |
| Push entire stack | gt submit --stack --publish --ai |
| Move up | gt up |
| Check for top | gt up (fails if already at top) |