agentleFS
zehuichanzehuichan/vibe-harness/skills/stacked-prs/SKILL.md

stacked-prs

Skill2 starsChanged 29 days agoMITView on GitHub

Use when landing a stack of dependent GitHub pull requests (A ← B ← C, each based on the one below) onto the default branch, merging a pull request whose base is another open pull request's branch, responding to review comments across such a stack, or whenever a request mentions "stacked PRs", "PR stack", "dependent PRs", or merging several related pull requests in sequence. Requires GitHub's official stacked-PR feature so GitHub owns stack-wide rules, CI, ordering, retargeting, and merge state.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use show-me, blast-radius and 5 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.
  • AnasX7Skill

    show-me

    Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.

    Also in 3 projects that use this

  • MicrosoftSkill

    blast-radius

    Assesses network dependency and shared-infrastructure exposure. Use when the user asks which services, customers, SLA policies, routes, or redundant links are affected by a network fault.

    Also in 3 projects that use this

  • Harut8Skill

    architect

    Also in 3 projects that use this

  • GoogleSkill

    improve-codebase-architecture

    Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

    Also in 3 projects that use this

  • GoogleSkill

    grilling

    Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

    Also in 3 projects that use this

  • SentrySkill

    skill-creator

    Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.

    Also in 3 projects that use this

  • +1 more from google

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use a clean dedicated worktree.

    line 14
  2. Distinctive:

    When a dependent pull request is not yet in the official stack:

    line 54
  3. Very specific:

    If all authors match, link the chain in bottom-to-top order: gh stack link --base <trunk> <bottom-pr> <next-pr> ...

    line 57
  4. Distinctive:

    If authors differ or any author is unavailable, ask the user before changing GitHub state.

    line 58
  5. Very specific:

    Never dissolve, reorder, or rebuild an existing stack automatically.

    line 61
  6. Distinctive:

    Do not rewrite branches merely because a refresh mechanism exists.

    line 65
  7. Distinctive:

    Verify every comment against the code before acting: a reviewer who flags the right symptom can still misdiagnose the cause.

    line 77
  8. Distinctive:

    Keep each review fix a distinct commit.

    line 79
  9. Distinctive:

    Treat a delegated fix's report as intent, not proof of what landed.

    line 80
  10. Very specific:

    Delete branches only in a separate final pass after their pull requests report MERGED, and only when gh pr list --state open --base …

    line 102

“Common” is measured: kept by at least 6 in 10 of the 13 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

Landing an official GitHub pull-request stack

Land dependent pull requests through GitHub's native stack object and gh stack merge. Do not reproduce stack semantics by merging and retargeting individual pull requests with gh pr merge and gh pr edit. The project's AGENTS.md owns which histories (merge-forward or rebase) are allowed.

Require native stack support

Run gh stack --version before changing GitHub state. Stop if the official extension or server-side stack feature is unavailable; do not fall back to merging and retargeting pull requests one at a time. Stacks require every head branch to live in the same repository, so stop on a cross-fork chain.

Use a clean dedicated worktree. Fetch current pull-request metadata and exact head commits rather than trusting branch names or an earlier report:

gh pr view <pr> --json number,author,baseRefName,baseRefOid,headRefName,headRefOid,isCrossRepository,state,isDraft,reviewDecision,mergeStateStatus,statusCheckRollup

Query PullRequest.stack and stackEntry.position for at least one pull request in each apparent chain; this official object, not base-branch inference alone, is the stack-membership authority. Paginate entries when size exceeds the returned page:

gh api graphql -F owner=<owner> -F name=<repo> -F number=<pr> -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      number
      author { login }
      baseRefName
      headRefName
      stackEntry { position }
      stack {
        number
        baseRefName
        size
        entries(first: 100) {
          nodes {
            position
            pullRequest { number author { login } baseRefName headRefName state isDraft }
          }
        }
      }
    }
  }
}'

Establish the expected bottom-to-top order from the live bases: the bottom targets the trunk, and each higher pull request targets the head branch immediately below it.

Link missing stack members

Compare existing stack entries with the expected chain. One existing stack may contain an order-preserving subset of the chain; multiple stack numbers, an unexpected entry, or a conflicting order requires user direction before any change.

When a dependent pull request is not yet in the official stack:

  1. Compare every author.login exactly.
  2. If all authors match, link the chain in bottom-to-top order: gh stack link --base <trunk> <bottom-pr> <next-pr> ... <top-pr>.
  3. If authors differ or any author is unavailable, ask the user before changing GitHub state.
  4. Re-query and require one stack number, the expected trunk, the complete pull-request set, and the expected positions and base chain.

Never dissolve, reorder, or rebuild an existing stack automatically; gh stack link is additive, and merged or queued entries cannot be unstacked.

Refresh only when needed

Do not rewrite branches merely because a refresh mechanism exists. When the live merge state or repository rules require an updated trunk, choose an allowed history:

  • Native cascading rebase: check out the stack with gh stack checkout <pr-or-stack> when it is not tracked locally, then run gh stack sync. It may rebase and lease-protected force-push every active layer before local validation, so immediately inspect the rewritten scope, run the relevant checks for every affected layer (see pre-push-checks), and do not merge or claim readiness until they pass. On a rebase conflict, use gh stack rebase, resolve and validate, then publish with gh stack push. If local and remote stack compositions diverge, stop and ask; never delete or recreate the remote stack automatically.
  • Incremental merge-forward: merge the trunk into the bottom affected branch, then propagate each updated parent into its child in bottom-to-top order and push normally. If the base advances during an in-progress merge, preserve that checkpoint before merging the newer tip.

A history rewrite invalidates commit-hash assumptions: re-fetch exact heads and re-audit unresolved review threads, approvals, mergeability, and checks after the push. Never use raw --force or overwrite a remote head that advanced concurrently.

Respond to review across the stack

Review comments may target several layers. Keep the chain linked through the official stack while fixing them.

  1. Work on each pull request's branch in its own worktree; parallel fixes never share a checkout.
  2. Verify every comment against the code before acting: a reviewer who flags the right symptom can still misdiagnose the cause.
  3. Fix each accepted finding on the pull request that introduced it, then propagate it upward through every affected child, with either refresh history above. A fix that originates in a higher layer leaves the lower one shipping the defect and hides the fix from its reviewer.
  4. Keep each review fix a distinct commit. A later rebase may change its commit hash, but do not amend a reviewed fix away; amend only your own work that is neither pushed nor reviewed.
  5. Treat a delegated fix's report as intent, not proof of what landed. Rerun the checks yourself on the actual tree, and prove a regression test fails on the unfixed code (introduce the regression, watch it fail, revert).
  6. Reply in the comment's review thread, not as a top-level comment, naming the fix and the current commit that carries it.

Before landing, verify that every fixed pull request's current diff carries its correction at the layer that introduced the issue, each child's diff against its parent shows only that child's changes, and the relevant checks pass on every affected layer, not only the top.

Preflight the merge range

Re-query the stack immediately before merging. Require every selected pull request to be open, non-draft, in the expected order, and compliant with the repository's review and check requirements, each judged independently. "Land the stack" selects the whole stack; a partial landing requires an explicit boundary pull request and includes every layer from the bottom through that boundary.

Merge through the stack API

gh stack merge <stack-number> --yes --merge   # whole stack
gh stack merge <boundary-pr> --yes --merge    # explicitly requested partial landing

Do not pass --delete-branch, retarget dependents manually, or issue per-pull-request merge commands. GitHub merges the selected range bottom-up and retargets or rebases any remaining layers. A direct stack merge is all-or-nothing; when the trunk uses a merge queue, GitHub queues the selected range together but may land it in separate groups. If the merge reports a blocker, resolve it through the owning pull request or stop and report it; never bypass requirements or fall back to gh pr merge.

Verify the landed state

Wait until every selected pull request reports MERGED; a queued request is not a completed landing (gh pr view <pr> --json number,state,mergedAt,mergeCommit). For a partial landing, re-query the stack and verify that every remaining pull request is still linked in order and targets the trunk or the layer below it. GitHub may have rebased those layers, so re-check their heads, reviews, and CI.

Delete branches only in a separate final pass after their pull requests report MERGED, and only when gh pr list --state open --base <branch> --json number --jq length returns 0.

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.