prepare
Skill22 starsChanged 33 days agoMITView on GitHub
Gets a PR, and every PR stacked above it, green without new work: resolves merge conflicts, fixes failing CI, and applies unresolved review comments, in that order, then confirms CI; --merge squash-merges bottom to top once every gate passes. Triggers on "get this PR green", "prepare this PR", "make the stack mergeable", "fix and merge", "/prepare".
- Deletes or force-pushes
- Commits and pushes
5 other projects use a version of this.
Adopted by
Most recently taken up by
- Aquilo-Solution-S/tesla-valvetheir own version, first seen Nov 1, 2026
- samueltuoyo15/Dokugentheir own version, first seen Oct 17, 2026
- mik2win/foureyestheir own version, first seen Oct 8, 2026
- iliasedelkin/jobissimotheir own version, first seen Oct 2, 2026
- 2389-research/git-repo-preptheir own version, first seen Sep 25, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- samueltuoyo15/Dokugen★ 346same name
- iliasedelkin/jobissimo★ 8same name
- 2389-research/git-repo-prep★ 2same name
- mik2win/foureyes★ 2same name
- Aquilo-Solution-S/tesla-valve★ 1same 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 repository53 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- skills/workflow/autonomous-workflow/CLAUDE.mdCLAUDE.md
- ideateSkill
- interviewSkill
- playwright-trace-analyzerSkill
- profile-optimizerSkill
- rum-trackingSkill
- screencastSkill
- video-analyserSkill
- youtube-transcriptSkill
- create-skillSkill
- docsSkill
- handoffSkill
- optimize-claude-mdSkill
- persistent-memorySkill
- attach-mediaSkill
- ci-auto-fixSkill
- create-prSkill
- github-actions-authorSkill
- resolve-conflictsSkill
- ticketSkill
- animations-nativeSkill
- animationsSkill
- behavioral-designSkill
- chartingSkill
- storybookSkill
- uxSkill
- visual-designSkill
- ai-engineeringSkill
- confidenceSkill
- criticalSkill
- fitSkill
- impact-mapSkill
- jev-assertSkill
- measurableSkill
- polishSkill
- pr-reviewSkill
- review-loopSkill
- tddSkill
- verify-behaviorSkill
- aw-verifySkill
- deployment-verifySkill
- e2e-testing-mobileSkill
- e2e-testingSkill
- telemetry-verifySkill
- ui-verifySkill
- atelierSkill
- autonomous-workflowSkill
- aw-create-planSkill
- aw-create-walkthroughSkill
- fix-bugSkill
- implement-suggestionSkill
- improveSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
When a PR has more than one child, order by depth, then PR number.
- Very specific: line 70
If no PR needs work and every PR ran CI, print Already green (without --merge) and stop.
- Very specific: line 95
If a Skill() call is refused, apply that skill's contract inline rather than skipping the step.
- Distinctive: line 97
Do not stop after the first PR, even when it was already green.
- Distinctive: line 100
If a rebase conflict is not one you can resolve with confidence, stop and ask.
- Distinctive: line 119
Never: start new work, refactor, or re-review.
“Common” is measured: kept by at least 6 in 10 of the 5 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.
Files
Prepare
Gets one PR, and every open PR stacked above it, to green: no conflicts, passing CI, no unresolved review threads. It delegates each fix to an existing skill and starts no new work.
Arguments
Parse $ARGUMENTS: the first non-flag token is the PR, everything else is a flag.
| Argument | Default | Effect |
<pr-url|#n> | the current branch's PR (gh pr view --json url -q .url) | The bottom PR of the job. |
--merge | off | After the fixes, squash-merge bottom to top behind explicit gates. Read and follow rules/merge.md. |
--single | off | Only this PR; skip the stack walk. |
Step 0: Resolve scope
- Set
PRSto the given PR. - Unless
--single, walk up: for each PR inPRS, rungh pr list --base <its head branch> --state open --json number,url,headRefName, and append the results. When a PR has more than one child, order by depth, then PR number. PRSis now ordered bottom to top, which is also merge order.
Step 1: Check state
For each PR in PRS:
gh pr view <n> --json mergeable,mergeStateStatus,statusCheckRollup,reviewDecision,headRefName,baseRefName
node "${CLAUDE_SKILL_DIR:-$HOME/.claude/skills/prepare}/scripts/threads.mjs" --pr <pr-url>threads.mjs prints THREADS: clear|open|pending — <reason> last, naming each unresolved thread (outdated ones count); exit 0 only for clear.
A PR needs work when mergeable is CONFLICTING, any check is failing, or any review thread is unresolved.
A check still running is not green: gh pr checks <n> --watch first, then decide.
Then classify the head's CI with the bundled helper; its last line is the answer, its exit code 0 only for green:
node "${CLAUDE_SKILL_DIR:-$HOME/.claude/skills/prepare}/scripts/ci-ran.mjs" --pr <pr-url> # CI: green|pending|red|not-run — <reason>CI ran when at least one required check completed without being skipped, or, when the head reports no required check, at least one GitHub Actions check run did.
External commit statuses and other apps' checks (Vercel, security scanners) never prove CI ran on their own, unless the repo marks one required.
CI: not-run (a repo that skips CI on drafts) → report CI not run (<its reason>), never green, and do not merge it.
✗ draft PR, 16 checks SKIPPED, 2 Vercel statuses SUCCESS, none failing → Already green
✓ #41 CI not run (CI not run at b56dfb5: every required check skipped (4))If no PR needs work and every PR ran CI, print Already green (without --merge) and stop.
Under --merge, skip Step 2 and go to the merge step.
Step 2: Fix, bottom to top
Work one PR at a time, bottom first, and finish it before moving up.
gh pr checkout <n> before touching any PR other than the one already checked out.
Skip every step that does not apply:
| Order | Condition | Run |
| 1 | Merge conflicts | Start the update, then Skill("resolve-conflicts") (below) |
| 2 | Failing CI | Skill("ci-auto-fix", "<pr-url>") |
| 3 | Unresolved review threads | Skill("implement-suggestion", "<pr-url> --resolve-all") |
resolve-conflicts only resolves a merge or rebase that is already in progress, and previews against origin/main otherwise.
So for row 1, start the update against the PR's own base first, so a stacked PR is compared with its real base:
git fetch origin <baseRefName>
git rebase origin/<baseRefName> # stops on conflicts; resolve-conflicts takes it from thereOnce the rebase finishes, git push --force-with-lease.
If a Skill() call is refused, apply that skill's contract inline rather than skipping the step.
A push to a lower PR can create conflicts or red CI above it, so after every push re-run Step 1 for the PRs above.
Do not stop after the first PR, even when it was already green.
Rebases use --force-with-lease, never --force.
If a rebase conflict is not one you can resolve with confidence, stop and ask; do not resolve unfamiliar conflicts to make the stack green.
Step 3: Confirm
Watch CI on each PR's new head: gh pr checks <n> --watch.
A PR that is not passing after the fixes is reported as blocked, with the reason.
Step 4: Report
One line per PR:
#1 already green · #2 fixed CI · #3 resolved conflicts · #4 CI not run (every required check skipped)Say Already green only when every PR in scope is, and never for a PR whose CI did not run.
Hard rules
- Never start new work, refactor, or re-review.
- Never weaken a check to get CI green.
- Never merge without
--merge. - Never merge a PR that sits above one that is still open.
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.

