agentleFS
HanZephyrHanZephyr/dsh-generalized-skills/skills/merging-stacked-prs/SKILL.md

merging-stacked-prs

Skill0 starsChanged 3 months agoMITView on GitHub

Land dependent pull requests in dependency order while preserving each layer's changes, checking current heads and gates, and keeping remaining dependents valid.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. jukanntenn/harness-deepseek-harness★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository8 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Delete branches only within authorized cleanup, after their corresponding changes are confirmed landed and no open pull request or …

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

Merge Dependent Pull Requests

A stack is a dependency chain: the lowest pull request targets the destination branch, and each higher layer depends on the one below. Use the repository's supported workflow and merge policy. Native stack tooling is useful when available, but a particular hosting service, API, or extension is not required.

Establish the live dependency chain

Read current pull-request metadata and fetch relevant Git refs. Record each layer's repository, base, head branch and exact OID, open or merged state, and required review and check status. Branch names alone are insufficient, especially across forks. If the host provides stack metadata, compare it with the base chain and Git history; resolve contradictions before changing the affected layers.

Determine the requested landing range. Landing a dependent layer also requires its unlanded dependencies; do not silently include unrelated pull requests. Ask only when conflicting metadata or an unspecified boundary changes the authorized merge scope.

Preserve local work. Use a clean checkout or isolated worktree when branch operations would interfere with existing edits. Record old parent tips before rewriting or landing lower layers; they may be needed to isolate a child's own commits later.

Choose the supported path

Discover available tools, their documented operations, merge methods, and concurrency guarantees. Do not invent host API fields or assume a stack command is installed. Follow any repository requirement to use a merge queue or stack manager.

  • With a supported stack manager, verify the selected range and its effects on upper layers before invoking it. Do not rebuild or relink a stack merely because the tool can do so.
  • Without one, merge sequentially from the bottom up, updating and validating each remaining dependency as described below.

Different authors or fork locations are not inherently blockers. Check actual permission to update every branch that needs adjustment. If a required mutation is unavailable, finish independent preparation and report the precise blocked operation.

Refresh and validate affected layers

Refresh only when required by mergeability, repository policy, or the requested work. Use the project's permitted merge-forward or rebase strategy and propagate necessary changes from parents to children in order.

For a rewritten push, capture the exact remote OID and require an explicit --force-with-lease=refs/heads/<branch>:<observed-oid> or a verified equivalent. A concurrent update requires inspection; raw force is not a substitute. Rewrites and conflict resolutions invalidate prior evidence for affected commits: inspect each layer's diff against its live base and rerun applicable checks, then refresh reviews, approvals, and merge status.

Some stack tools publish rewrites before local validation is possible. Confirm that behavior first, and inspect and validate every affected layer immediately afterward. Do not merge while required evidence is pending or failing.

Land from the bottom upward

Immediately before submitting each merge or supported stack range, recheck current head OIDs, dependency order, non-draft/open state, and required gates. Use a head-match condition when the host supports it. If a head moves, reassess that change instead of merging based on stale review evidence. Do not bypass required reviews or checks.

For sequential landing:

  1. Merge the lowest ready layer with the repository's permitted merge method. If queued, wait for its actual landing before depending on that result.
  2. Fetch the resulting destination and inspect remaining pull requests; hosts may have retargeted or rewritten them automatically.
  3. Retarget the next dependent to the correct live base where necessary. Verify that its diff contains its intended changes and does not replay already-landed work.
  4. When the parent landed through squash or rebase, its original commits may no longer be ancestors of the destination. Merely changing the pull request base may duplicate changes or produce conflicts. Use the recorded old parent boundary to isolate the child's own commits and replay them onto the new base when needed. Inspect the resulting tree and diff; do not blindly rebase the entire old chain.
  5. Validate the updated layer and recheck required host gates before merging it. Continue only through the authorized range.

For a native range operation, verify every selected layer's result independently; submission success does not prove atomic or completed landing. If a failure occurs partway through either path, inspect the actual merged, queued, and open states before retrying. Preserve successful landings and repair only the remaining range.

Verify completion and remaining dependencies

Confirm every selected pull request is merged and its intended changes are present in the destination. Merge and squash strategies require different ancestry evidence; a missing original commit alone does not mean a squashed change is missing.

For partial landing, verify the remaining base chain, each live head and diff, and any reviews or CI invalidated by retargeting or rewriting. Keep pending queues and checks explicitly pending.

Delete branches only within authorized cleanup, after their corresponding changes are confirmed landed and no open pull request or remaining dependency still needs them. Report what landed, what remains, the relevant verification, and any cleanup not performed.

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.