
pr-babysitter
Monitors or repairs an open GitHub PR: CI failures, conflicts, review threads, and merge readiness, reporting state changes. Use when asked to "watch this PR", "fix CI", "resolve conflicts", or "address review comments".
- Installs
- 514
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/mblode/agent-skills --skill pr-babysitter- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads pr-babysitter automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
PR Babysitter
- IS: keeping one open PR moving: conflicts, CI across GitHub Actions/Buildkite/Vercel/Fly.io, inbound review comments, and merge readiness, then following the merge through the repo's post-merge watch, as a background monitor or as one-shot fixes.
- IS NOT: opening or editing the PR (
pr-creator), reviewing or fixing the diff itself (tidy), or npm release PRs (autoshipwatches its own release CI; never babysit a release or Version Packages PR it drives).
Mode Selection
| Invocation | Mode |
|---|---|
| "babysit", "watch this PR", "monitor", "keep it green" | Monitor: Phase 1 once, then affected phases on state changes |
| "fix CI", "why is CI red", "loop on CI" | One-shot Phase 3 loop |
| "resolve conflicts", "rebase onto main", "update the branch" | One-shot Phase 2 |
| "address the comments", "reply to the reviewers", "triage review comments" | One-shot Comment Triage Workflow |
| "is it ready", "what is blocking the merge" | One-shot Phase 5 report |
Standing rules, every mode:
-
Monitoring or fixing code does not by itself authorize posting replies. Post, resolve threads, or request reviews only when the user authorized that communication; otherwise prepare replies and report them.
-
Resolve
scripts/fetch-comments.shrelative to this installed SKILL.md.${CLAUDE_SKILL_DIR}below is a Claude Code adapter, not a portable environment variable. -
No setup questions. Auto-detect the PR, the CI platforms, and the defaults (poll every 2 minutes, auto-resolve noise, no auto-merge), then start. Overrides arrive inline: "poll every 5 minutes", "enable auto-merge".
-
Skip closed PRs. Skip drafts (
isDraft) unless asked. A merged PR goes on to the repo's post-merge watch: wait for thewatch/<env>commit statuses on the merge SHA, stop at the firstfailureorerror, and report the result (Post-merge Watch inreferences/monitoring-setup.md). If the base it merged onto (the merge commit's first parent, or for a rebase merge the commit before the PR's rebased commits) has nowatch/*status, report "no post-merge watch". Either way, once the merge is live in production, smoke-test the change there read-only (Production smoke test in the same reference), report that too, and stop. -
Comment triage runs autonomously; the plan file is an audit trail, not an approval gate.
-
Speak only on transitions. A quiet poll says nothing.
-
Reuse the existing watcher for the same PR. A changed fingerprint triggers only the affected phases: a new comment needs triage, not another full verification run. Do not add a model-driven sleep/status loop beside the watcher.
Reference Files
| File | Read when |
|---|---|
references/monitoring-setup.md | Phase 1, a merged PR, and Stopping: watch ladder, Monitor watch script, cron fallback, post-merge watch, state file format, defaults, stop and lifecycle |
references/merge-conflicts.md | Phase 2: mergeStateStatus table, branch update workflow, lockfile and generated-file resolution, abort criteria |
references/ci-platforms.md | Phase 3: gh pr checks fields and exit codes, per-platform log and retry commands, Buildkite auth chain, failure classification |
scripts/fetch-comments.sh | Comment triage: run ${CLAUDE_SKILL_DIR}/scripts/fetch-comments.sh {N} first. One JSON document of every review, thread, and issue comment; --help prints the output shape |
references/github-api.md | Comment triage: script output contract, thread accounting, anchor ladder, awaiting-reply rule, reply and resolve |
references/bot-patterns.md | Comment triage: reviewer detection, severity mapping, merge gates, noise markers, dedup, false positives |
references/fix-plan-template.md | Comment triage: plan file format and the legal ignore reasons |
references/verification-gate.md | Before committing or pushing: permitted check timing, evidence reuse, stray-artifact sweep |
references/git-resilience.md | A git command hangs or fails transiently (fsmonitor wedge, stale index.lock, network blip) |
evals/evals.json | Only when changing this skill; never during a PR task |
Monitor Loop
Phase 1 runs once in the foreground and starts the watch. Compare each event or tick with the state file, then run only the phases whose inputs changed. Recheck required readiness evidence before declaring the PR ready; speak only when something changed.
Copy this checklist to track progress:
PR babysit progress:
- [ ] Phase 1: Initialize (detect PR, pick watch mechanism, snapshot state)
- [ ] Phase 2: Conflict check
- [ ] Phase 3: CI check (diagnose, fix, gate, push)
- [ ] Phase 4: Comment check (triage new comments)
- [ ] Phase 5: Readiness check (report transitions, write state file)
- [ ] After merge: post-merge watch until watch/* passes, fails, or is absent, then a read-only production smoke test
Phase 1: Initialize
gh pr view [N] --json number,url,title,state,isDraft,headRefName,baseRefName,headRefOid,mergeable,mergeStateStatus,reviewDecision. No PR for the branch: say so and stop.gh repo view --json owner,namefor the calls that needowner/repo.- Detect CI platforms from
gh pr checks --json name,link(pattern table inreferences/ci-platforms.md). - Pick the watch mechanism: the first rung of the watch ladder in
references/monitoring-setup.mdthat applies (harness PR subscription, Monitor tool, cron, none). With no rung, do not claim monitor mode: run the matching one-shot mode or say this runtime cannot keep polling. - Snapshot state to
.claude/pr-babysitter/babysit-pr-{N}.md: mechanism and ID, head SHA, mergeability, check states, open and awaiting-reply thread counts, review decision. This folder is never staged. - Confirm in five lines: PR, watch mechanism and ID, detected CI, current state, defaults in effect.
Phase 2: Conflict Check
gh pr view --json mergeable,mergeStateStatus. DIRTY resolves; BEHIND updates; UNKNOWN means GitHub is still computing, recheck next tick; anything else moves on.
git fetch origin {base} && git merge origin/{base}
git push
- Clean merge: push after the required checks, notify.
- Conflicts only in lockfiles, generated files, or changelogs: regenerate per the reference, complete the merge, then push after the required checks.
- Conflicts in source logic, migrations, or API contracts:
git merge --abort, then notify with the files and what each side changed. Human intent decides those.
Follow the user's and repository's branch policy. Default to one merge, preserving existing commits; rebase only when explicitly required and the branch is exclusively owned. Never force-push someone else's branch or stash a shared dirty tree to make an update proceed.
Phase 3: CI Check
gh pr checks --json name,state,bucket,link,workflow.bucketispass,fail,pending,skipping, orcancel;linkis the details URL.- Anything
pending: wait. Diagnosing a half-finished run fixes the wrong thing. - Every
fail: fetch logs with the platform's commands inreferences/ci-platforms.md(GitHub Actions, Buildkite auth chain, Vercel, Fly.io). - Classify per the reference: flaky (re-run once), stale dependency (reinstall and rebuild before touching source), code error (fix),
knip(delete dead code or configure), infrastructure (notify; not fixable from code). - Fix, run the verification gate, commit, push. Flag regressions against the previous state (was passing, now failing).
One-shot loop ("fix CI"): after each push, gh pr checks --watch --fail-fast (exit 0 green, 1 a check failed, 8 still pending). Stop and summarize when checks are green, the failure is infrastructure, or the same check fails twice with the same error after a fix. Two identical failures is the signal to stop pushing, not to try a third variant.
Phase 4: Comment Check
- Count open threads and threads awaiting my reply (newest comment not mine, in any resolution state, minus a reviewer who resolved their own last comment).
- Compare both counts and the newest
updated_atacross review and issue comments against the state file. An edited-in-place bot comment and a reply on a resolved thread both have to register. - Any increase: run the Comment Triage Workflow, then notify "N new review comments on PR #{N}", counting only comments that are not noise. A poll whose new comments are all noise (such as the sticky
<!-- pr-evidence -->comment, edited on every push) is a quiet poll.
Phase 5: Readiness Check
- Ready means all of:
mergeable == MERGEABLE, every required checkpass,reviewDecision == APPROVEDfrom a review whosecommit_idis the head SHA, zero open blocking threads, zero threads awaiting my reply, every merge gate satisfied. - A merge-gate comment reading "Human review required" is a blocker to report with the criteria that forced it, not a finding to fix.
- Ready: notify "PR #{N} is ready to merge." Merge is a one-way door:
gh pr merge --autowith the repo's merge method, and only when the user opted in. - Not ready: name the blockers ("Waiting on: 2 checks pending", "Awaiting your answer: 2 questions from @reviewer", "Approval is stale: reviewed abc1234, head def5678").
- Write the state file for the next tick.
Comment Triage Workflow
Inline from Phase 4 or one-shot. Autonomous: no approval gate, the plan file is the audit trail.
Fetch
Run ${CLAUDE_SKILL_DIR}/scripts/fetch-comments.sh {N}. It pages every thread and every thread's comments, recovers anchors, buckets threads, and computes owedReply against your own login. A non-zero exit prints one sentence on stderr saying why; fix that cause and re-run rather than hand-writing queries.
Check reviewers[] before classifying: every login that spoke must appear in the output with findings, a verdict, or an explicit "no content". A reviewer with reviews but zero comments is a fetch that lost something. anchor.source == "needs-translation" means finish the anchor ladder against the working tree before judging that finding.
Early exit only when open threads, awaiting-reply threads, actionable reviews, and actionable issue comments are all zero.
Classify
- Every inline comment from every author is read. An author absent from the bot table is unknown, not noise; noise needs a positive marker match.
- Classify per comment, not per thread: a human reply inside a bot's thread carries full human weight.
- Author type from content first, then login.
github-actions[bot]is shared by reviewers and noise alike. - Severity from the source's own markers; unknown sources default to Major. Severity orders the queue; it never decides whether a comment is read.
- Human intent: fix request, question, nitpick, or acknowledgement. A question gets an answer, not a code change. Human comments are never auto-ignored: fix unless the reviewer marked it optional.
- Merge-gate verdicts are Phase 5 inputs: record, never fix, never reply, never resolve.
- Deduplicate bots only (same path within 3 lines, keep the highest severity). A multi-location finding is one item.
- Every ignore carries one of the legal reasons from the plan template. "Author unrecognized" and "thread already resolved" are not among them.
Fix
- Write the plan (
references/fix-plan-template.md) to.claude/pr-babysitter/pr-{N}-review-plan.md, print the counts, proceed. - Ignored threads: one-line reply, then resolve.
- Questions: post the answer, leave the thread open. The reviewer resolves it.
- Resolved threads with an unanswered human reply: reply in place, do not unresolve, note it in the report.
- Fixes, one commit per logical group. Apply the verification gate’s check policy and reuse valid evidence; stage only that group's files.
- Reply, then resolve, each fixed thread.
- Re-run the script and report: open threads, threads still awaiting my reply, questions answered but not yet acknowledged, and current CI status. The re-run is the evidence; "addressed everything" is not.
Stopping
"Stop babysitting" or "cancel the monitor": stop the mechanism recorded in the state file per references/monitoring-setup.md (Stopping, Session Lifecycle), then report polls or events handled, fixes applied, conflicts resolved, comments triaged, and current state.
Gotchas
- Filtering threads on
isResolved == false: GitHub collapses resolved threads, so a human reply posted after the resolve is the comment most likely to go unread. comments(first: 20): thread comments arrive oldest first, so a truncated page hides the newest comment, the one that decides whether you owe a reply. The script pages every thread to the end.viewerDidAuthorreturnedfalseon the viewer's own comments. Compareauthor.logintogh api user --jq .login.- A null
linemeans outdated or multi-line, not PR-level. Only a nullpathis PR-level. Recover the anchor before deciding anything. - Triaging a bot's review body: the body is a count. Codex, Devin, Copilot, and Bugbot all put findings inline. Four empty-body human reviews are one review pass with its content in threads, not four reviewers with nothing to say.
- Bots that edit one comment in place (auto-approval assessments, DangerJS) keep the same
id, so a state diff on ids sees nothing. Compareupdated_at. - Counting a review whose
commit_idis not the head SHA as an approval: branch protection with "dismiss stale approvals" drops it on the next push, and the PR reads ready until then. git add -Aafter a fix commits hook artifacts (a rootschema.gql) into the PR. Sweepgit status --porcelainand stage paths.- Resolving a thread without replying first: the reviewer sees a silent resolve and unresolves it.
- A subscription-only watch never sees conflicts: GitHub emits no webhook when the base branch advances into one.
- Cron when Monitor is available wakes the agent on every quiet tick and burns tokens for no signal. Polling under 2 minutes does the same to the GitHub rate limit.
Related Skills
pr-creator: opens or edits the PR; babysitting starts after it existsplanning: writes plans a fresh session executes. The fix plan this skill writes is an audit trail for one PR, not aplanningdeliverabletidy: reviews and fixes the diff itself; this skill applies GitHub review comments. Run it on monitor-authored fixes beyond a trivial patchautoship: npm release pipelines; it watches its own release CI, so never babysit a release PR it drives
FAQ
What does the pr-babysitter skill do?
Monitors or repairs an open GitHub PR: CI failures, conflicts, review threads, and merge readiness, reporting state changes. Use when asked to "watch this PR", "fix CI", "resolve conflicts", or "address review comments".
How do I install pr-babysitter?
Run npx skills add https://github.com/mblode/agent-skills --skill pr-babysitter in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/pr-babysitter/ (personal) or .claude/skills/pr-babysitter/ (project).
Which AI agents can use pr-babysitter?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is pr-babysitter safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains pr-babysitter?
It is published by mblode in mblode/agent-skills. It has 514 recorded installs.
More from mblode/agent-skills
ui-animation
mblode/agent-skills
Builds, reviews, and measures UI motion, including springs, gestures, scroll effects, curve fitting from recordings, and sparse interface sound. Use when asked to "add animation", "match this easing", "reverse engineer this motion", "add a click sound", or find animation opportunities.
multi-tenant-architecture
mblode/agent-skills
Designs tenant isolation, hostname routing, custom-domain lifecycle, and plan limits on Cloudflare or Vercel. Use when asked to "isolate tenant data", "support custom domains", "build a white-label platform", or assess PSL registration. For general module structure use codebase-architecture; for SEO content use seo.
ui-design
mblode/agent-skills
Designs and builds React/Next/Tailwind UI, audits visual and interaction defects, and stress-tests components with worst-case data. Use when asked to "build a landing page", "extract our design system", "add dark mode", "make this responsive", "remove UI slop", "audit this component", "stress-test this component", "break this UI", or "show me the worst case".
typography-audit
mblode/agent-skills
Audits font loading, type scales, measure, spacing, OpenType, and rendered punctuation with 78 scoped rules. Use when asked to "audit typography", "fix the fonts", or "review my type system". For a new visual direction use ui-design Direction; for general UI defects use ui-design Audit.
agent-skills-creator
mblode/agent-skills
Creates and improves portable Agent Skills with a validator, routing scenarios, and evidence-based keep, cut, merge, or retire decisions. Use when asked to "write a skill", "update all skills", "audit my SKILL.md", "remove redundant instructions", or fix skill triggering.
docs-writing
mblode/agent-skills
Writes and audits technical docs with Diataxis type gating, runnable examples, and 51 documentation rules. Use when asked to "review my docs", "write an API reference", or improve a documentation page. For a whole README use readme-creator; for agent instructions use agents-md.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.