agentleFS
AI-Degen-69AI-Degen-69/issue-to-pr-skills/skills/v-babysit-pr-and-merge/SKILL.md

v-babysit-pr-and-merge

Skill0 starsChanged 54 days agoMITView on GitHub

Station V (Babysit PR & Merge) — Sits on PR through one focused CodeRabbit review round (or fallback), resolves comments, squash-merges on green CI, and fast-forwards local base branch.

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before merging, to confirm zero unhandled blocking feedback.

    line 22
  2. Very specific:

    Mandatory inline reply on every resolution: Every single resolved thread MUST have an explicit inline reply (ACCEPT: <summary of fix> or …

    line 99
  3. Very specific:

    Programmatic extraction only: Read review comments via gh api repos/:owner/:repo/pulls/<pr_number>/comments (id, path, line, start_line, …

    line 100
  4. Very specific:

    Descending line order: When applying edits to a single file, sort hunks in descending line order so earlier line anchors do not drift.

    line 108
  5. Very specific:

    No auto-fix on partial rejections: Never run @coderabbitai auto-fix when any comments were rejected.

    line 112
  6. Very specific:

    Never commit red: If a suggestion breaks a test, git checkout <file>, reply with the failure log, resolve as REJECT, and re-run the …

    line 113
  7. Distinctive:

    Repo conventions win: Always observe repo-specific PR templates and review rules.

    line 115
  8. Distinctive:

    After the local reset lands on a clean base, run these three quick checks to decide the vi-close-pipeline recommendation in the report:

    line 130

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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

Station V: Babysit PR and Merge (v-babysit-pr-and-merge)

A global, model-agnostic habit: ensure every branch is pushed and opened as a PR (or handed off directly from Station IV iv-review-build-and-pr), then sit on the PR through review until it is mergeable. Every comment is triaged, every dismissal carries a reason, review waiting follows a deterministic 5m → 4m → 3m → 2m → 1m countdown check cycle, the review loop runs exactly one focused round (to conserve CodeRabbit quota and eliminate review churn), auto-triggers @coderabbitai review if auto-review is not invoked or was skipped, and concludes — merged or escalated.

Pipeline Position

  • Station: Station V of VI
  • Previous Station: iv-review-build-and-pr (Review & Ship)
  • Next Station: vi-close-pipeline (Close Pipeline — prune, issue close, clean-exit gate)

Zero human in the loop. Extraction, triage, rejection replies, thread resolution, code application, test verification, self-healing, commit, push, and merge are all performed autonomously by the agent. The operator is contacted only if critical blockers cannot be resolved.

When to use

  • Hand-off immediately after Station IV (iv-review-build-and-pr) to track CodeRabbit review and merge the PR.
  • Working changes or commits exist on a feature branch with no PR yet — Station V delegates opening to iv-review-build-and-pr, then starts babysitting once the PR exists.
  • A PR was created or pushed, requiring CodeRabbit review tracking.
  • Review comments arrive on an open PR.
  • Before merging, to confirm zero unhandled blocking feedback.

Multi-PR Priority Order & Pipelining

Multiple open PRs and no specific number → follow references/multi-pr-pipelining.md (stack dependencies first; pipelining only inside wait windows).


Step Map (load the detail on demand)

StepWhat it doesDetail
Step 0Ship handshake — find the PR, or delegate to iv-review-build-and-prreferences/review-loop.md
Step 1Verify the @coderabbitai review trigger, then wait out the 5m→4m→3m→2m→1m countdown and classify completion honestly — a summary-only review with zero inline findings (private repo on Free) is SUMMARY_ONLY, not a clean passreferences/review-loop.md
Step 2Pull every comment via the API; triage each one yourself — ACCEPT or REJECT, no rubber-stampingreferences/triage-and-apply.md
Step 2BAgent fallback review when CodeRabbit is rate-limited, skipped, or stuck on processing; probe @coderabbitai configuration first when a review contradicts the committed configreferences/triage-and-apply.md
Step 3Late rejections — pointer only, Step 2.4 is the one canonical REJECT flowreferences/triage-and-apply.md
Step 4Apply accepted fixes (Type A suggestions / Type B intent), run targeted tests, self-heal, one batch commit, reply to and resolve every threadreferences/triage-and-apply.md
Step 5Check the stack for foreign commits, then GitHub CI is the merge gate; post @coderabbitai resolve to close the review loop, then squash-merge — dismissing a stale CHANGES_REQUESTED verdict when it is what blocks — or deploy a <stack>-build-resolver persona on failurereferences/merge-and-reset.md
Step 5aClose the issue — verify GitHub auto-closed it via Closes #<id>, or close manually if it missedreferences/merge-and-reset.md
Step 5bReturn the local checkout to a clean, fast-forwarded base and delete the merged branch locally and on the remote (git push origin --delete, after the MERGED guard)references/merge-and-reset.md

Round exit condition: zero unresolved threads carrying a REJECT, and zero threads resolved without an inline reply. Then CI, then merge, then reset — always, merge or escalate.


The Review Loop

digraph babysit_pr_and_merge {
    "PR exists?" [shape=diamond];
    "Delegate to iv-review-build-and-pr (push, open PR, trigger review)" [shape=box];
    "Trigger Comment Exists On PR? (idempotency check)" [shape=diamond];
    "Trigger @coderabbitai review (ONLY if none exists)" [shape=box];
    "Wait 5m (Check 1)" [shape=box];
    "Review finished?" [shape=diamond];
    "Countdown Wait (4m, 3m, 2m, 1m)" [shape=box];
    "Extract Comments (gh api)" [shape=box];
    "Auto-Triage (ACCEPT/REJECT)" [shape=box];
    "Reject: Reply & Resolve Thread" [shape=box];
    "Apply Accepted Fixes (Type A / B)" [shape=box];
    "Run Targeted Tests" [shape=diamond];
    "Self-Heal: revert, reply, resolve REJECT" [shape=box];
    "Batch Commit & Push (1 commit) — PR stays trigger-locked" [shape=box];
    "Resolve Fixed Threads" [shape=box];
    "Check CI Checks & Merge" [shape=box];

    "PR exists?" -> "Delegate to iv-review-build-and-pr (push, open PR, trigger review)" [label="no"];
    "PR exists?" -> "Trigger Comment Exists On PR? (idempotency check)" [label="yes"];
    "Delegate to iv-review-build-and-pr (push, open PR, trigger review)" -> "Trigger Comment Exists On PR? (idempotency check)";
    "Trigger Comment Exists On PR? (idempotency check)" -> "Trigger @coderabbitai review (ONLY if none exists)" [label="no"];
    "Trigger Comment Exists On PR? (idempotency check)" -> "Wait 5m (Check 1)" [label="yes — NEVER re-trigger"];
    "Trigger @coderabbitai review (ONLY if none exists)" -> "Wait 5m (Check 1)";
    "Wait 5m (Check 1)" -> "Review finished?";
    "Review finished?" -> "Countdown Wait (4m, 3m, 2m, 1m)" [label="no"];
    "Countdown Wait (4m, 3m, 2m, 1m)" -> "Review finished?";
    "Review finished?" -> "Extract Comments (gh api)" [label="yes"];
    "Extract Comments (gh api)" -> "Auto-Triage (ACCEPT/REJECT heuristics)";
    "Auto-Triage (ACCEPT/REJECT heuristics)" -> "Reject: Reply & Resolve Thread";
    "Reject: Reply & Resolve Thread" -> "Apply Accepted Fixes Locally (Type A / Type B)";
    "Apply Accepted Fixes Locally (Type A / Type B)" -> "Run Targeted Tests";
    "Run Targeted Tests" -> "Self-Heal: revert file, reply, resolve as REJECT" [label="fail"];
    "Self-Heal: revert file, reply, resolve as REJECT" -> "Run Targeted Tests";
    "Run Targeted Tests" -> "Batch Commit & Push (1 commit)" [label="pass"];
    "Batch Commit & Push (1 commit)" -> "Resolve Fixed Threads on GitHub";
    "Resolve Fixed Threads on GitHub" -> "Check CI Checks & Merge";
}

Standing Rules

  • Zero human in the loop: Extraction, triage, replies, thread resolution, code application, verification, self-healing, commit, push, and merge run autonomously. Escalate only if critical blockers cannot be resolved.
  • Full autonomy on GitHub operations: Agent commits, pushes, creates PRs, and merges without requiring manual sign-offs.
  • Mandatory inline reply on every resolution: Every single resolved thread MUST have an explicit inline reply (ACCEPT: <summary of fix> or REJECT: <concrete technical reason>) posted before resolution via repos/:owner/:repo/pulls/:pr/comments/:id/replies. Never resolve silently, and never run blind bulk resolutions that close unaddressed or newly arrived comments.
  • Programmatic extraction only: Read review comments via gh api repos/:owner/:repo/pulls/<pr_number>/comments (id, path, line, start_line, body) — never by eyeballing rendered PR HTML.
  • Manual review trigger: CodeRabbit never auto-reviews. iv-review-build-and-pr posts @coderabbitai review right after opening the PR. Never treat a green check as a review — read the check text.
  • One trigger per PR — HARD RULE: check for an existing @coderabbitai review comment (or PR body) FIRST; post a trigger only when none exists anywhere. An existing trigger is never re-posted, re-verified, or "confirmed", and an old/unacknowledged bot reply does NOT license a second trigger — after one review the round is spent, the quota is gone, and a new trigger is guaranteed to hit the rate limit. This lock is permanent: pushing the fix commit in Step 4.3 does not unlock a second review.
  • Single review round: Exactly 1 focused review round to conserve CodeRabbit quota and eliminate review churn. Proceed directly to CI verification and merge after resolving round 1.
  • Countdown polling schedule: 5 min initial wait (hard minimum — never shorten), then 4 min, 3 min, 2 min, and 1 min checks thereafter. Use non-blocking schedule tool instead of long shell sleeps.
  • An explicit rate-limit reply ends the wait immediately. When the bot answers the trigger with "Action not completed / Review rate limited" (or any ## Review limit reached form), that reply IS review content: never run the 5m→4m→3m→2m→1m countdown against a refused trigger — the countdown waits for a review that will not arrive. Classify RATE_LIMITED, take the Step 2B reuse path (Station IV evidence + delta check), and merge on green CI under the timeout-merge rule. The one-trigger HARD RULE still applies: never re-post the trigger to "try again".
  • @coderabbitai resolve draws on the same quota as the review. When the trigger was rate-limit-declined, expect resolve to be declined the same way — record "declined (rate-limited)" honestly instead of treating the silence as a closed loop. When there are genuinely zero threads (a rate-limited or summary-only review produces none), record an explicit "not applicable — zero threads" line rather than skipping the mention.
  • Thoughtful deliberation: Never blindly reject suggestions. Evaluate each CodeRabbit suggestion on its technical merits against the codebase, domain spec, and architecture. If it genuinely improves performance, safety, or readability, accept and verify with tests. Only reject if it violates domain specs, introduces bloat, or breaks behavior.
  • Descending line order: When applying edits to a single file, sort hunks in descending line order so earlier line anchors do not drift.
  • Operator milestone updates: Give concise updates on actions taken (Working on [branch]..., Committed & Pushed..., PR Opened #..., Merged PR #...).
  • Pipelined multi-PR processing: Interleave PR tasks during countdown wait windows.
  • One commit per round: Batch all accepted fixes into a single commit and push once.
  • No auto-fix on partial rejections: Never run @coderabbitai auto-fix when any comments were rejected. Apply fixes locally and test.
  • Never commit red: If a suggestion breaks a test, git checkout <file>, reply with the failure log, resolve as REJECT, and re-run the targeted tests.
  • Read the CI log before touching code when a shard fails: gh pr checks <pr> gives each job's URL; gh run view --log-failed --job <job-id> names the exact failing test and its error — a shard summary ('4 failed') never names the importer or the cause. Fix that test, re-run it locally, and push once with the round's other fixes.
  • Repo conventions win: Always observe repo-specific PR templates and review rules.
  • Post-merge local reset is mandatory: After every merge (or abandoned-PR escalation), return the checkout to base: confirm MERGED via gh pr view, switch to base, git pull --ff-only, force-delete the local branch (-D only after remote confirms MERGED — squash merges are never -d-deletable), then delete it on the remote with git push origin --delete (never remote-first; --delete-branch on the merge is best-effort and this repository's deleteBranchOnMerge is false), then git fetch --prune. Stash untracked artifacts with -u (git stash push -u -m "pre-reset: ...") — a plain git stash leaves untracked files in place and the tree stays dirty. Fold the remote-delete outcome (deleted / already gone / declined) into the condensed 1–2 line merge summary — never a silent no-op, never a verbose git-ops block. Never reset a dirty tree without committing/stashing first; escalate on ambiguity.
  • In a linked worktree the base branch may be held by the primary worktree. git switch <base> then fails with "already used by worktree at ...": switch the worktree to its own branch and fast-forward THAT to origin/<base> (git switch <own-branch> && git pull --ff-only origin <base>) — same clean, synced end state — and disclose the deviation in the report. Never force the primary worktree's checkout.
  • Verify a merged base in a throwaway worktree, never in the primary checkout. The primary repo is routinely on another session's branch holding their uncommitted work — a suite or rehearsal run there tests the wrong code and risks disturbing work you do not own. Create a detached worktree at the merged base, verify, remove it, then re-read the primary checkout's branch and git status to prove you left it untouched:
    git worktree add --detach .worktrees/<verify-name> origin/main
    # ... verify ...
    git worktree remove --force .worktrees/<verify-name>
    A runtime-artefact directory (runtime/, data/, reports/) is normally gitignored, so a fresh worktree starts without it — a run that reads it fails or silently finds nothing. Seed or regenerate it before the run, and expect a two-step chain (produce the artefact, then consume it) rather than one command.

VI Triage — Skip or Run? (after Step 5b reset, before the report)

After the local reset lands on a clean base, run these three quick checks to decide the vi-close-pipeline recommendation in the report:

  1. Issue state: gh issue view <id> --json state --jq .state — OPEN = 🔴 (must).
  2. Leftover artifacts: run Station VI's full discovery set — never a single narrow git ls-files grep. It covers: tracked stale per-issue plans and checklists; untracked scratch in knowledge-home or alternate layouts (tasks/, scratch/, repo root, or any other path); leftover stashes (git stash list); and leftover branches/worktrees (git branch, gh pr status). Any hit = 🟡 (recommended); hits from 3+ distinct closed issues = 🟡 even without matching the current id. This station recommends — it never prunes, so an under-broad check here silently hands a dirty folder to the next issue.
  3. Git cleanliness: git status --porcelain — non-empty = 🔴 (must).

Pick the highest signal: 🔴 > 🟡 > 🟢. All three clean = 🟢 (skip, continue to /i-pick-issue). When any check is inconclusive — a stash you cannot attribute, a branch whose owner is unknown, an artifact matching no known issue — it is not 🟢. Classify 🟡 and recommend /vi-close-pipeline; uncertain means recommend VI, never skip it.


Report rules (mandatory)

Two reports from the template. The closing What-now states the build is live with a /present-pr option, then the repo-state choice: clean skips to /i-pick-issue, otherwise run /vi-close-pipeline with the reason. PR and issue links are hyperlinks. The summary is 3 quick lines.

  • Condensed merge summary (no verbose git-ops block): the CI gate, squash-merge SHA, issue-close, local reset, and remote-delete outcomes collapse into 1–2 status rows (#<id> Closed | #<n> Merged (<sha>) | Branch: <branch> → <base>, clean, synced). Never narrate each git command with its output — that detail stays in the transcript, not the report.
  • Manual verification walkthrough lives here: after a successful merge, guide the operator through seeing the change with their own eyes — as many short steps as it takes for clarity, no step cap, each step one quick action in the shape where → what to do → what to see, with → arrows and a direct link when one exists. Plain words, no jargon. Name the real screen / tab / button, never the presentation file. Backend-only with nothing to see → one line saying so plus how it was checked automatically. (Moved here from Station VI: verification belongs at merge-time, right after the work lands.)

    Read the artifact before you write the walkthrough. A manual-verification block may already exist — the PR body's ## How to verify, the CodeRabbit summary, the issue body, or Station IV's report. Read it first, then decide deliberately: reuse it, tighten it, or replace it. When your version differs — a step dropped, a different launch command, a corrected number — say so and why in one line. Never hand the operator a walkthrough that quietly loses a detail the artifact already got right; the PR body is often the better document, and the chat must not contradict it. What the artifact states about how to run the surface wins over your assumption about the default entry point (e.g. the flag that points the dashboard at a store with real rows, without which the new page shows nothing).

Timeout-merge rule: when IN_PROGRESS_STUCK or RATE_LIMITED, the CodeRabbit check may stay PENDING forever. Do NOT wait for it. Merge gate = agent fallback review clean (or its nits triaged) + gh pr checks green (excluding the stuck CodeRabbit context). State this explicitly in the CodeRabbit review status line so the operator knows the merge was NOT on a completed bot review.

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.