agentleFS
nfeuernfeuer/project-foundation-kit/.claude/skills/pr-babysitter/SKILL.md

pr-babysitter

Skill0 starsChanged 4 months agoMITView on GitHub

Watch the open-PR queue on an interval, rebase stale-but-green PRs onto main, surface blockers to a human, and keep CI moving — without auto-merging anything

  • Deletes or force-pushes
  • Commits and pushes

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    When two or more PRs are stale simultaneously, run branch-conflict-check (or check.sh) on each to find the safer rebase order.

    line 57
  2. Distinctive:

    Don't wait in-line — dispatch the ci-watch skill for the rebased branch and move on to the next PR.

    line 60
  3. Distinctive:

    Never force-push someone else's active branch: If the branch received a non-bot commit in the last 10 minutes, skip it and note it as …

    line 68
  4. Distinctive:

    Stop thrashing: If the same PR has been rebased twice in one loop iteration and CI is still red, escalate to the human rather than rebasing …

    line 72

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

PR Babysitter

Use this as a recurring loop when a batch of PRs is in flight and the queue needs active tending. It keeps PRs in a mergeable state — rebasing stale ones, kicking CI back into motion, and pinging a human when only a human can unblock. It does not merge; it prepares.

Profile-driven. The trunk branch for rebase commands comes from trunk_branch in .claude/kit.yaml (default: main). Update that one key to propagate the change here.

Pair with the /loop skill for the interval mechanism (e.g. /loop 10m pr-babysitter). Hand CI failures to the ci-watch skill for the diagnose-fix-push loop. Before rebasing multiple stale PRs at once, run branch-conflict-check to find the safer rebase order.

Workflow

1. Fetch the open-PR queue

gh pr list --state open \
    --json number,headRefName,mergeable,reviewDecision,statusCheckRollup,isDraft,locked,updatedAt

2. Triage each PR

Classify every open PR with this table, then execute the action column:

PR stateCImergeablereviewDecisionAction
Up-to-date, all checks passGreenMERGEABLEAPPROVEDPing human: ready to merge.
Stale (behind trunk_branch)GreenMERGEABLEanyRebase onto trunk_branch, push, hand to ci-watch.
StaleRedanyanyRebase first, then hand to ci-watch for the fix loop.
Up-to-dateRedMERGEABLEanyHand to ci-watch. Do not rebase — that can hide the failure.
Up-to-dateGreenCONFLICTINGanyReal merge conflict — ping human with the conflicting file list.
CI pending / queued—anyanyWait; skip to the next PR and revisit on the next interval.
Draft or lockedanyanyanySkip entirely. Draft = author not ready; locked = another agent is active.
CHANGES_REQUESTEDanyanyCHANGES_REQUESTEDPing human: review needs a response before CI matters.

3. Rebase a stale PR

# trunk_branch from kit.yaml (default: main)
branch=<headRefName>
git fetch origin main
git switch "$branch"
git rebase origin/main
git push --force-with-lease

Substitute main with trunk_branch from .claude/kit.yaml if your project overrides it. --force-with-lease refuses to push if someone else updated the branch since your last fetch. Never use bare --force.

4. Check for file-set conflicts before rebasing multiple stale PRs

When two or more PRs are stale simultaneously, run branch-conflict-check (or check.sh) on each to find the safer rebase order. Rebase the depended-on PR first; let its CI green before rebasing anything that overlaps it.

5. After a rebase push, hand off to ci-watch

Don't wait in-line — dispatch the ci-watch skill for the rebased branch and move on to the next PR. Collect results when the interval fires again.

6. Batch human pings into one message

Collect every PR that needs human action across the full queue, then send a single consolidated message: PR number, specific blocker, suggested next step. One ping per loop run, not one per PR.

Guardrails

  • Never auto-merge. Merging is a deliberate human act. Prepare and present; don't decide.
  • Never force-push someone else's active branch. If the branch received a non-bot commit in the last 10 minutes, skip it and note it as "possibly active."
  • Never rebase a red PR to mask failures. Diagnose and fix first (ci-watch), then rebase if the branch is still stale afterward.
  • Never touch locked or draft PRs. Locked = in-flight by another agent; draft = author not ready.
  • Never merge a red or CONFLICTING PR. Both are human-decision blockers.
  • Stop thrashing. If the same PR has been rebased twice in one loop iteration and CI is still red, escalate to the human rather than rebasing a third time.

Output

Emit this summary at the end of each loop iteration:

## PR Queue  <ISO-timestamp>

| PR | Branch | CI | Action taken | Human needed |
|---|---|---|---|---|
| #<n> | <ref> | green | rebased + pushed → ci-watch | — |
| #<m> | <ref> | green | none | merge-ready (green + approved) |
| #<k> | <ref> | red | ci-watch dispatched | — |
| #<j> | <ref> | green | — | real conflict in <files> |

Human queue:
- #<m>: ready to merge (green + approved)
- #<j>: merge conflict — <files> — resolve manually

Next check in: <interval>

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.