From mblode-agent-skills
Monitors an open PR for conflicts, CI failures, review comments, and merge readiness, with auto-fixes and one-shot modes. Use for babysitting a PR, fixing CI, resolving conflicts, or triaging review comments.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mblode-agent-skills:pr-babysitterThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- **IS:** autonomous monitoring of an open PR (conflicts, CI across GitHub Actions/Buildkite/Vercel/Fly.io, review comments, merge readiness) with auto-fixes, plus one-shot CI diagnosis or conflict resolution.
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: CronCreate config, 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 |
references/github-api.md | Comment triage: GraphQL queries to fetch, reply to, resolve threads |
references/bot-patterns.md | Comment triage: bot detection, severity parsing, deduplication, false-positive rules |
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 registers the cron job. Each tick runs phases 2-5, diffing against the previous tick's state file; 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 CronCreate 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)*/2 * * * * running phases 2-5; capture the job ID..claude/scratchpad/babysit-pr-{N}.md: Cron Job 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}
Cron job: {job_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.
references/github-api.mdmergeable == MERGEABLE, all required checks passing, reviewDecision == APPROVED, zero unresolved blocking threadsRuns 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.
reviewThreads query; filter to isResolved == false. Read every thread's inline comments bodies with their path:line. These carry the actual findings from any reviewer (human or bot), often when the review-level body is empty. Never triage on the review body alone, and never skip a reviewer's inline comments because of who posted themgithub-actions[bot] is shared)CHANGES_REQUESTED, Minor for APPROVED plus a questionHuman 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.
git push --force instead of --force-with-lease: silently overwrites a teammate's commits. Failed lease = someone pushed; abort and notify.knip) passes locally: a red push wastes the poll cycle plus a CI run.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 drivesnpx claudepluginhub mblode/agent-skillsAutomatically polls and shepherds open PRs/MRs: triages review comments, fixes CI failures, pushes autofix commits, and keeps pull requests moving without manual intervention. Supports GitHub and GitLab.
Babysits an open GitHub PR until merge-ready by continuously reacting to new review comments and CI failures. Use for monitoring a PR over time.
Resolves GitHub PR issues including review comments, CI failures via triage-dispatch workflow with code edits, replies, and verification.