skills/stacked-diffs/SKILL.md
Break large code changes into small, stacked pull requests using vanilla git and the gh CLI. Auto-trigger when implementing a feature or change that spans multiple logical steps, touches several files, or will exceed ~200 changed lines. Also trigger on "stack PRs", "break this into smaller PRs", "stacked diffs", or "create a PR stack". Do NOT trigger for single-file fixes, small bug fixes, or changes under ~200 lines that are a single logical unit.
npx skillsauth add rarestg/rarestg-skills stacked-diffsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Break large work into a chain of small, dependent PRs. Each PR is one logical unit — easy to review, test, and revert. The stack merges bottom-up into main.
Move to a new stacked branch whenever the current diff reaches a natural boundary. Do not accumulate a large changeset on one branch. Commit, push, open a PR, then branch off and keep going.
A natural boundary is any of:
Stack when the work has multiple logical steps that build on each other:
Do NOT stack independent, unrelated changes — use separate PRs instead.
Before writing code, sketch the stack — an ordered list of diffs, each one logical step:
Stack: <feature>
01-<description> — <what and why>
02-<description> — <what and why>
03-<description> — <what and why>
The plan can evolve. If a diff grows too large or a new step emerges during implementation, split on the fly.
Work through the stack sequentially. For each diff:
# First diff branches from main
git checkout main && git pull && git checkout -b <feature>/01-<description>
# Subsequent diffs branch from the previous
git checkout -b <feature>/02-<description>
When the diff is complete, commit, push, and open a PR:
git add <files> && git commit -m "<message>"
git push -u origin <branch>
# First PR targets main
gh pr create --base main --title "<title>" --body "$(cat <<'EOF'
...
EOF
)"
# Subsequent PRs target the previous branch
gh pr create --base <feature>/01-<description> --title "<title>" --body "$(cat <<'EOF'
...
EOF
)"
Then immediately check out a new branch for the next diff and keep working.
Include a stack table so reviewers see the full chain:
## Stack
PR N/M for <feature>.
| # | PR | Description |
|---|-----|-------------|
| 1 | #<number> | <description> |
| 2 | **this PR** | <description> |
## Changes
<what this specific PR does>
Update earlier PRs with the table as new PRs are created.
If an earlier diff needs changes, rebase all downstream branches:
git checkout <feature>/01-<description>
# ... make changes, commit, push ...
git checkout <feature>/02-<description>
git rebase <feature>/01-<description>
git push --force-with-lease
git checkout <feature>/03-<description>
git rebase <feature>/02-<description>
git push --force-with-lease
Always --force-with-lease, never --force.
Exception: review-comment cleanup on an active PR stack may intentionally land
in a new follow-up PR above the current stack top instead of amending an older
reviewed branch. Use the github-review-workflow queue when original review
threads need replies that reference that follow-up PR.
Pattern: <feature>/<NN>-<short-description>
auth/01-user-model
auth/02-login-endpoint
auth/03-session-middleware
development
Export a PR's clean inline review comments, CodeRabbit outside-diff comments, and CodeRabbit nitpicks into local files, then triage review feedback through a stack-aware orchestrator workflow with durable reply drafts for follow-up PRs. Use when given a GitHub pull request URL and asked to work through review comments without relying on noisy raw API blobs.
development
Create, rewrite, or maintain a repository's AGENTS.md as a short dispatcher for coding agents. Use when asked to write an AGENTS.md from scratch, update stale agent instructions, shrink a bloated AGENTS.md, add repo guidance for AI/coding agents, or document where agents should find source-of-truth docs, invariants, validation commands, and workflow rules. Triggers on: "create AGENTS.md", "write an agents file", "update AGENTS.md", "maintain AGENTS.md", "fix our agent instructions", "make this repo easier for Codex/Claude/agents", "rewrite this bloated AGENTS.md".
development
Run reusable Graphify-led architecture analysis for codebases using semantic graphs, optional subagent extraction, graph synthesis, source-search validation, graph-shape review, and follow-up refactor planning. Use when asked to analyze repo architecture, god nodes, surprising edges, topology, module boundaries, or graph-derived cleanup/refactor opportunities.
testing
Run a meaningful coding ticket through a delegated delivery workflow: tighten the ticket, assign one ticket owner, delegate implementation, get an independent review, scan for high-value simplification, validate the result, and return a compact outcome packet. Use when the user wants structured agent execution with clear scope, ownership, and review rather than a single-pass implementation. Triggers on: "delegate this ticket", "use a sub-PM", "run this through worker and reviewer", "own this ticket end to end", "send this for independent review", or "close this ticket out with review". Skip trivial fixes and tasks that are still too vague to delegate.