make-stacked-prs
Skill301 starsChanged 11 days agoApache-2.0View on GitHub
Create stacked GitHub PRs from a linear chain of git branches. Use when the user wants to create stacked PRs, make a PR stack, or open multiple PRs from a chain of branches. Args: <first-branch> [<last-branch>] [<onto-base-branch>]
- Commits and pushes
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- js/AGENTS.mdAGENTS.md
- sandbox-image/AGENTS.mdAGENTS.md
- amika-annotationsSkill
- amika-cliSkill
- create-cli-release-commitSkill
- create-sdk-release-commitSkill
- distill-sessionSkill
- naive-reader-reviewSkill
- new-specSkill
- release-commit-sandbox-imageSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Create stacked GitHub PRs from a linear chain of git branches.
- Very specific: line 22
If last-branch is not provided, default to the current branch.
- Very specific: line 23
If onto-base-branch is not provided, it will be determined in pre-flight checks.
- Distinctive: line 28
Run all of the following checks.
- Distinctive: line 30
Clean working tree: Run git diff --quiet HEAD.
- Very specific: line 32
Verify all branches exist: Run git rev-parse --verify for first-branch, last-branch, and onto-base-branch.
- Very specific: line 33
Verify linear ancestry: Run git merge-base --is-ancestor <first-branch> <last-branch>.
- Very specific: line 38
Edge case: If first-branch is the root commit, first-branch^ will fail.
- Distinctive: line 53
If any branch already has an open PR, error out completely.
- Very specific: line 68
Use AskUserQuestion to confirm.
- Very specific: line 77
Commit log with changed files: git log --name-status <base>..<branch> (use $(git merge-base <onto-base-branch> …
- Very specific: line 89
Show the proposed title, body, and base branch to the user: Use AskUserQuestion to confirm before running gh pr create.
- Very specific: line 90
Create the PR: gh pr create --base <base> --head <branch> --title "<title>" --body "<body>"
- Very specific: line 108
No intermediate branches: Only first-branch and last-branch exist in the range.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.
Files
Create Stacked PRs
Create stacked GitHub PRs from a linear chain of git branches. Each PR targets the previous branch in the chain, making code review easier for large changesets broken into logical steps.
Usage: /make-stacked-prs <first-branch> [<last-branch>] [<onto-base-branch>]
first-branch(required): The earliest branch in the chainlast-branch(optional): The latest branch in the chain. Defaults to the current branch.onto-base-branch(optional): The branch the first PR targets. Defaults tomain(falls back tomaster).
Procedure
Step 1: Parse arguments and record state
- Parse
$ARGUMENTS: 1st = first-branch (required), 2nd = last-branch (optional), 3rd = onto-base-branch (optional). - If
last-branchis not provided, default to the current branch. - If
onto-base-branchis not provided, it will be determined in pre-flight checks. - Record the current branch via
git rev-parse --abbrev-ref HEADso we can restore it during cleanup.
Step 2: Pre-flight checks
Run all of the following checks. If any fail, stop and report the error.
- Clean working tree: Run
git diff --quiet HEAD. Only tracked files matter; untracked files are fine. If the working tree is dirty, error out and ask the user to commit or stash changes. - Determine
onto-base-branch(if not provided): Check ifmainexists (git rev-parse --verify main). If not, trymaster. If neither exists, error out. - Verify all branches exist: Run
git rev-parse --verifyforfirst-branch,last-branch, andonto-base-branch. Error if any are missing. - Verify linear ancestry: Run
git merge-base --is-ancestor <first-branch> <last-branch>. Iffirst-branch==last-branch, this is a valid single-branch stack — skip this check. Otherwise, error if first-branch is not an ancestor of last-branch.
Step 3: Discover branches in the chain
- Get commit hashes in range:
git log --format='%H' <first-branch>^..<last-branch>- Edge case: If
first-branchis the root commit,first-branch^will fail. In that case, usegit log --format='%H' <last-branch>(all commits up to last-branch) and filter appropriately.
- Edge case: If
- Get all local branches and their SHAs:
git for-each-ref --format='%(objectname) %(refname:short)' refs/heads/ - Intersect: find branches that point at commits in the range from step 1.
- Order them oldest-to-newest by commit position in the log.
- Error if two branches point to the same commit — this is ambiguous ordering. List the conflicting branches and ask the user to resolve (e.g., delete or move one).
- The result must include at least
first-branchandlast-branch.
Step 4: Check for existing PRs
For every branch discovered in step 3, check for existing PRs:
gh pr list --head <branch> --json number,url --limit 1If any branch already has an open PR, error out completely. List all branches that have existing PRs with their PR URLs. Do not proceed — the user must close or handle those PRs first.
This check is non-negotiable. Even if the user later removes branches from the creation list in step 5, the check in this step must have passed for all discovered branches.
Step 5: Confirm branch list with user
Display the ordered chain showing each branch and its intended base:
Stack to create:
1. <first-branch> → base: <onto-base-branch>
2. <branch-B> → base: <first-branch>
3. <last-branch> → base: <branch-B>Use AskUserQuestion to confirm. The user may remove intermediate branches from the list but cannot bypass the step-4 existing-PR check.
Step 6: Push branches and create PRs
Process each branch one at a time, in order:
- Determine base:
onto-base-branchfor the first branch; the previous branch in the chain for all others. - Push:
git push origin <branch>. If it fails, ask the user how to proceed (force push, skip, abort). - Generate title and body by examining:
- Commit log with changed files:
git log --name-status <base>..<branch>(use$(git merge-base <onto-base-branch> <first-branch>)..<first-branch>ifonto-base-branchis not a direct ancestor offirst-branch) - Diff content:
git diff <base>...<branch>to understand the actual changes
- Commit log with changed files:
- PR body must include:
- A stack navigation list showing all branches in the chain. This should go at the bottom of the PR body. Each entry shows the branch name. For the current PR, show
`#THIS` ← you are here(no link). For other PRs already created, link with#<number>. For PRs not yet created, show "(PR pending)". Example:## Stack 1. `first-branch` #12 2. `branch-B` `#THIS` ← you are here 3. `branch-C` (PR pending) - A summary of changes derived from the commits and diff.
- A stack navigation list showing all branches in the chain. This should go at the bottom of the PR body. Each entry shows the branch name. For the current PR, show
- Show the proposed title, body, and base branch to the user. Use
AskUserQuestionto confirm before runninggh pr create. - Create the PR:
gh pr create --base <base> --head <branch> --title "<title>" --body "<body>"
After all PRs are created, go back and update the bodies of earlier PRs to fill in PR links that weren't available when those PRs were created. Use gh pr edit <number> --body "<updated-body>" for each PR that had "(PR pending)" placeholders. When updating, keep the self-reference as `#THIS` ← you are here (never link a PR to itself).
Step 7: Cleanup
- Restore the original branch:
git checkout <original-branch> - Display a summary of all created PRs with their URLs:
Created 3 stacked PRs: 1. `first-branch` #12 <url> (→ onto-base-branch) 2. `branch-B` #13 <url> (→ first-branch) 3. `last-branch` #14 <url> (→ branch-B)
Edge Cases
first-branch==last-branch: Valid single-PR stack. Creates one PR targetingonto-base-branch.- No intermediate branches: Only
first-branchandlast-branchexist in the range. Creates two PRs. - Root commit as
first-branch: Handlefirst-branch^failure gracefully in step 3 by not using the^suffix. - Two branches on same commit: Error in step 3, ask the user to resolve the ambiguity.
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
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.

