---
name: stack-prs
description: Slice a phased or staged plan into a stack of PRs so the human can review and merge them in parallel as later PRs land. Use when the user asks to open a PR for a phase/stage, when finishing a phase from to-implementation, or when deciding "should this be one PR or several?" — even if they don't say "stack" explicitly. Triggers include "PR this phase", "submit this stack", "stack these phases", "open a PR for this work", "should we bundle these into one PR".
title: stack-prs
canonical_url: https://skilld.dev/gh/mohasarc/mo-skills/stack-prs
last_updated: 2026-11-12T08:03:07.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install mohasarc/mo-skills/stack-prs`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/stack-prs`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/mohasarc/mo-skills/stack-prs) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/stack-prs`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/stack-prs --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/stack-prs --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Stacking PRs from a phased plan

Phases and stages are *planning units*; PRs are *review units*. They don't have to be 1:1, but they often should be. This skill is the judgment layer for slicing a plan into a stack of PRs that the human can review and merge in parallel while later PRs are still being written. For command mechanics, defer to the stacking tool's docs.

## Why stack

The human reviews **PR-1** while you build **PR-2** on top of it. Each PR is independently green, independently mergeable. When PR-1 lands on `main`, the rest restacks onto fresh `main` and keeps moving. The point is to keep the human's review queue full and your build queue full *at the same time*.

## The sizing decision

A PR contains exactly the work it needs — no padding, no cramming. If a small feature is two commits, the PR is two commits. If a phase is a single line change, that PR is one commit. Don't bundle just to hit a number.

The size of the work scales with the feature:

- **Large feature** → large stages → large phases. Each phase is usually a PR on its own; sometimes a single phase splits into two PRs if it's heavy.
- **Small feature** → one stage, a few small phases. The whole thing is often a single PR.
- **In between** → bundle adjacent phases into PRs of natural size.

**Soft heuristic for when you're actively choosing how to bundle: ~7–12 commits per PR feels right; past ~20 reviewers stop reading carefully.** This is a target when grouping, not a minimum any PR has to clear and not a hard ceiling.

When grouping phases:

- A phase that's already substantial → its own PR.
- Several tiny phases that share a theme → bundle until the PR is coherent (often into the 7–12 range, but stop sooner if there's nothing more to add).
- A phase that would blow past ~20 → split along a natural seam (test boundary, module boundary).
- Phases coupled tightly enough that splitting breaks CI (e.g. function added in one phase, first caller in the next) → bundle regardless of size.

**When in doubt, ask.** Cost of asking is one short message; cost of opening 4 PRs the user wanted as 1 is real churn. Present the slicing as options:

> "5 phases, ~14 commits total. Default would be 1 PR for the whole stack — phases are small. Or: 2 PRs split at phase 3 (8 + 6 commits). Or: 5 separate PRs. Which?"

## Workflow

Use the stacking tool the repo's rules name, and its docs for commands. No tool named: use `stack-prs-manual`. The shape:

1. First PR branches off `main`. Subsequent PRs branch off the current top of stack — that's what makes it a stack.
2. Submit after each phase finishes green, as a draft. Submitting per-phase is what unlocks parallel review.
3. Sync the stack at the **start** of every session, before making any commits — and again after a PR merges to `main`. A downstack merge can rebase the stack on the remote, so yesterday's local may already be stale. If you build commits on a stale base and *then* sync, the sync can favor the remote and drop your unpushed local work.
4. If you've already committed and only then notice the remote diverged: don't sync. Fetch and rebase manually — `git fetch origin <branch> && git rebase origin/<branch>` — then submit.
5. If the stack gets ~4–5 unmerged PRs deep, pause and check whether the human wants the bottom landed first.

## PR discipline

- **Always open PRs as drafts.** The human marks the PR ready for review themselves when they decide it's ready — never auto-publish a non-draft PR.
- **Create and push PRs through the stacking tool.** Going around it can set the wrong base branch and break the stack.
- **Set titles and bodies with `gh pr edit`** when the tool doesn't manage them. `--body-file` avoids heredoc escaping issues.

## Writing the PR description

Write it with the describe-work skill. The body covers this PR's own context only.

## Don't

- Don't open or push PRs the user didn't authorize. Surface "ready to submit — go?" first.
- Don't squash the stack into one PR after the fact to be tidy. If they wanted one PR they'd have said so.
