skills/pr-babysitter/SKILL.md
Monitors an open PR, detects it from the current branch, polls for conflicts, CI failures, review comments, and merge readiness, fixes safe issues, and reports only state changes. Monitor mode uses the Monitor tool when available, falling back to CronCreate/CronDelete; without either, run one-shot modes only. Use when asked to "babysit a PR", "watch this PR", "keep a PR green", "fix CI", "why is CI red", "resolve conflicts", "triage review comments", or "address PR comments". For PR creation use pr-creator; for diff review use pr-reviewer; for npm releases use autoship.
npx skillsauth add mblode/agent-skills pr-babysitterInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
pr-creator), reviewing the diff for bugs (use pr-reviewer), or npm release pipelines (use autoship, which watches its own release CI; never babysit a release or Version Packages PR that autoship is driving).| Invocation | Mode | |------------|------| | "babysit", "watch this PR", "monitor", "keep it green" | Monitor: Phase 1 once, then phases 2-5 on every cron tick | | "fix CI", "why is CI red", "CI is broken", "loop on CI" | One-shot Phase 3 loop, no cron | | "resolve conflicts", "fix conflicts" | One-shot Phase 2, no cron | | "triage review comments", "address the comments" | One-shot Comment Triage Workflow, no cron |
Rules for every mode:
| File | Read when |
|------|-----------|
| references/monitoring-setup.md | Monitor start: watch script template, CronCreate fallback, state file format, defaults |
| references/merge-conflicts.md | Phase 2: mergeStateStatus table, rebase workflow, auto-resolvable file types |
| references/ci-platforms.md | Phase 3: per-platform log/retry commands, Buildkite auth fallback, failure classification, stale-dependency and knip handling |
| scripts/fetch-comments.sh | Comment triage: run it first. Normalized JSON of every review, thread, and issue comment |
| references/github-api.md | Comment triage: GraphQL and REST field sets, thread accounting, anchor recovery, awaiting-reply computation, review staleness, reply and resolve |
| references/bot-patterns.md | Comment triage: unlisted-reviewer fallback, bot and human detection, severity mapping, merge-gate verdicts, deduplication, false positives |
| references/fix-plan-template.md | Comment triage: audit-trail plan format |
| references/verification-gate.md | Before any commit/push: lint, type-check, test, knip gate, stray-artifact sweep |
| references/git-resilience.md | Any git command hangs or fails transiently (fsmonitor wedge, stale index.lock, IPC blip) |
Phase 1 runs once in the foreground and starts the watch. With the Monitor tool, the watch script gates on transitions in the background: quiet polls never wake the agent, and each emitted event runs phases 2-5. With the cron fallback, every tick runs phases 2-5 and diffs against the previous tick's state file. Either way, only transitions produce output; a quiet poll says nothing.
Copy this checklist to track progress:
PR babysit progress:
- [ ] Phase 1: Initialize (auto-detect PR, snapshot state, start cron)
- [ ] Phase 2: Conflict check (detect and resolve merge conflicts)
- [ ] Phase 3: CI/CD check (poll checks, diagnose failures, fix and push)
- [ ] Phase 4: Comment check (detect new comments, triage autonomously)
- [ ] Phase 5: Readiness check (evaluate merge readiness, notify user)
Load references/monitoring-setup.md for the watch script template, CronCreate fallback config, and defaults.
gh pr view --json number,url,title,headRefName,baseRefName,mergeable,mergeStateStatus,reviewDecision. If a PR number was passed, use it. No PR for the branch: say so and stop.gh repo view --json owner,namegh pr checks check names (dispatch table in Phase 3)references/monitoring-setup.md (persistent: true); fall back to CronCreate with */2 * * * * running phases 2-5. Capture the watch/job ID..claude/scratchpad/babysit-pr-{N}.md: watch mechanism and ID, HEAD SHA, mergeable status, check statuses, unresolved thread count, review decision.Monitoring PR #{N}: {title}
Polling every 2 minutes | Auto-resolve noise: yes | Auto-merge: no
Detected CI: {platforms}
Watch: {monitor|cron} ({id})
Current state: {mergeable} | {reviewDecision} | {check_summary}
Load references/merge-conflicts.md for the mergeStateStatus table and resolution strategy.
gh pr view --json mergeable,mergeStateStatus
MERGEABLE, up to date → skip to Phase 3CONFLICTING → resolveUNKNOWN → GitHub still computing; recheck next tickgit fetch origin {base_branch} && git rebase origin/{base_branch}
git push --force-with-lease → notifygit rebase --abort → notify with the conflicting files and each side's changeNever push with bare --force. A failed --force-with-lease means someone else pushed: abort and notify, do not overwrite their commits. If git fetch or git rebase hangs, see references/git-resilience.md.
Load references/ci-platforms.md for per-platform commands, the Buildkite auth fallback chain, and the failure-classification decision tree.
gh pr checks --json name,state,conclusion,detailsUrl| Check name / detailsUrl | Platform | Failure logs via |
|-------------------------|----------|------------------|
| buildkite/ prefix | Buildkite | Auth fallback chain: bk CLI, then REST API, then detailsUrl |
| vercel in name or vercel.com in URL | Vercel | vercel logs {deployment_url} |
| fly- prefix or fly.io in URL | Fly.io | flyctl logs --app {app_name} --no-tail |
| Anything else | GitHub Actions | gh run view {run_id} --log-failed |
knip (remove dead code or configure), infrastructure (notify; not fixable from code)references/verification-gate.md) locally before pushingOne-shot loop ("fix CI"): after pushing, run gh pr checks --watch; re-diagnose if still red. Exit when checks go green (report it), the failure is infrastructure, or the same check fails twice with the same error after a fix; then summarize instead of thrashing.
mergeable == MERGEABLE, all required checks passing, reviewDecision == APPROVED from a review whose commit_id is the head SHA, zero open blocking threads, zero threads awaiting my reply, every merge gate satisfiedRuns inline when Phase 4 finds comments, or one-shot when invoked directly. No plan approval; the plan file is an audit trail.
Load references/github-api.md for query templates and references/bot-patterns.md for detection rules.
Run scripts/fetch-comments.sh {N} first: it emits normalized JSON for every review, thread, and issue comment, with recovered anchors, thread buckets, and owedReply already computed. If bash, jq, or gh is unavailable or it exits non-zero, fall back to the queries in the API reference and do these steps by hand.
gh api user --jq .login. Every reply-owed decision compares against this; viewerDidAuthor is unreliablestate, body, user.login, commit_id. Keep the reviewer set: every reviewer must be accounted for in the outputisResolved. Bucket every thread (open, resolved with an unanswered reply, resolved and quiet, PR-level) and keep all the countscomments.hasNextPage is re-fetched. Thread comments come oldest first, so the reply you owe is the one a truncated page hidesline, walk the anchor ladder. A null line means outdated or multi-line, not PR-levelupdated_at, not just id: gate and Danger bots edit one comment in placegithub-actions[bot] is shared; a [bot] suffix and __typename are hints, not verdictsHuman comments are never auto-ignored. Classify as fix unless already resolved or the reviewer marked it optional.
.claude/scratchpad/pr-{N}-review-plan.md per references/fix-plan-template.md (the audit trail)references/verification-gate.md) must pass; sweep stray artifacts (e.g. a root schema.gql from a hook); one commit per logical group, staging only that group's filesOn stop, report a final summary: total polls, fixes applied, conflicts resolved, comments triaged, current state.
isResolved == false: a resolved thread with a reply after the resolve is the comment most likely to be missed, and GitHub collapses it out of sight.line as no location: null means outdated or multi-line. Recover the anchor before deciding anything.viewerDidAuthor to spot your own comments: it returns false even on your own PR. Compare against gh api user --jq .login.commit_id is not the head SHA may be dismissed by branch protection.schema.gql): pollutes the PR diff. Sweep git status --porcelain, stage only the fix's files.references/git-resilience.md). Retry first.github-actions[bot] as always noise: shared identity used by DangerJS, schema checkers, and other reviewers. Classify by content.bk CLI without checking bk auth status first: Keychain tokens expire; a dead token stalls the cycle. Fall back to the REST API or gh pr checks.pr-creator: opens the PR; babysitting starts after it existspr-reviewer: local diff review for bugs; 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 drivesdevelopment
Fans out four concurrent review agents over the current diff, then APPLIES fixes directly to the working tree and verifies the build. Mutates code; it does not produce a report. Covers reuse (duplicate logic, hand-rolled stdlib, reinvented platform features), quality (hacky patterns, React/TypeScript hygiene, over-memoisation, exhaustive-deps, `any`, dead code, `CLAUDE.md`/`AGENTS.md` violations), efficiency (unnecessary work, missed concurrency, hot-path bloat), and test discipline (bug fixes without a repro test, useless tests to delete, missing tests only when they prevent a named failure). Use when the user says "tidy this up", "simplify", "clean up this diff", "polish my changes", "check for duplication", or "any reuse opportunities?", i.e. when the intent is to have the changes made automatically. For a read-only report that lists findings without touching files, use `pr-reviewer` instead. This skill edits code; for the PR's title, description, or commit history, use `pr-creator`.
development
Decides what an interface should do before UI is built or audited: interaction choice, action scope and consequence, reachable states, resilience, and accessibility as task completion. Works from a brief, spec, mockup, intent, or existing UI. Use when asked "is this the right interaction", "design the flow", "what control should this use", "what should this action affect", "which states should this have", "make this resilient", or "what breaks here". For building or styling use ui-design; for built-code audits use ui-audit; for copy wording use copywriting.
development
Builds and stress-tests implementation plans in two modes. Create mode scans code and docs, asks one question at a time with a recommended answer, runs a blindspot pass when the user is new to the area, then writes a plan file. Review mode scores completeness, feasibility, scope, testability, risk, and assumptions, verifies checkable claims, and writes resolutions back until every dimension reaches 5/5. Use when asked to "create a plan", "plan this feature", "I want to build X", "grill me", "think this through", "blindspot pass", "unknown unknowns", "this is new to me", "review my plan", "rubber duck this", "stress test this plan", "is this plan ready", "get this plan to 5/5", "what am I missing", "verify this claim", "prove this plan", "fact-check this plan", or when the user explicitly wants a plan artifact before implementation. For code review use pr-reviewer; for architecture briefs use define-architecture.
tools
Audits the smallest relevant developer-facing surface of a library, CLI, SDK, or npm package across API contracts, errors, CLI behavior, public types, onboarding, and config. Uses candidate-first rule loading, bounded local evidence, and compact root-cause findings. Use when asked to "audit my CLI", "make this CLI agent-friendly", "is this API ergonomic", "review the developer experience", "improve these errors", "simplify first run", or "review my SDK". For end-user UI use ui-audit, for agentic-app trust use ax-audit, for docs prose use docs-writing, for README work use readme-creator, and for repo architecture use define-architecture. Inside a product that also ships a UI, this is the skill for the developer-facing half, so pick it when the complaint is about an import, command, error string, exported type, or config rather than a screen.