pr-babysitter

监控并修复开放的 GitHub Pull Request:跟踪 CI 失败、冲突、评审讨论和合并准备状态,报告状态变更。在被要求“关注此 PR”、“修复 CI”、“解决冲突”或“处理评审意见”时使用。PR 元数据请配合 pr-creator;针对 npm 发布的 PR 请配合 autoship。

仓库最近推送
GitHub Stars
229
Forks
23
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "pr-babysitter":https://skillpi.com/zh/skills/deepskill-9bb8cf9cd65bdfa83f3e8c59bd9581dee339dca800f2dcfff7aaa64c1a34eb47。安装前核对上游来源和版本:https://github.com/mblode/agent-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

监控并修复开放的 GitHub Pull Request:跟踪 CI 失败、冲突、评审讨论和合并准备状态,报告状态变更。在被要求“关注此 PR”、“修复 CI”、“解决冲突”或“处理评审意见”时使用。PR 元数据请配合 pr-creator;针对 npm 发布的 PR 请配合 autoship。

0 下载

介绍来源: third_party · mblode · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
来源文档未说明。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: pr-babysitter
description: "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\". For PR metadata use pr-creator; for npm release PRs use autoship."
compatibility: Requires a Git checkout, authenticated GitHub CLI, and jq. Continuous monitoring also needs a supported scheduler or event subscription.

PR Babysitter

  • IS: keeping one open PR moving: conflicts, CI across GitHub Actions/Buildkite/Vercel/Fly.io, inbound review comments, and merge readiness, as a background monitor or as one-shot fixes.
  • IS NOT: opening or editing the PR (pr-creator), reviewing the diff for bugs (pr-reviewer), applying a local pr-reviewer report (tidy), or npm release PRs (autoship watches 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 phases 2-5 on every event or tick
"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.sh relative 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 or merged PRs. Skip drafts (isDraft) unless asked.

  • Comment triage runs autonomously; the plan file is an audit trail, not an approval gate.

  • Speak only on transitions. A quiet poll says nothing.

Reference Files

File Read when
references/monitoring-setup.md Phase 1: watch ladder detail, Monitor watch script, cron fallback, state file format, defaults
references/merge-conflicts.md Phase 2: mergeStateStatus table, rebase 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, manual GraphQL/REST fallback, 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 any commit: lint, type-check, test, knip, 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. Every event or tick then runs phases 2-5, diffs against the state file, and speaks 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)

Phase 1: Initialize

  1. 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.
  2. gh repo view --json owner,name for the calls that need owner/repo.
  3. Detect CI platforms from gh pr checks --json name,link (dispatch table in Phase 3).
  4. Pick the watch mechanism: first rung that applies.
Rung Available when Behaviour
Harness PR subscription A PR-subscription tool is exposed (cloud sessions: Claude_Code_Remote:subscribe_pr_activity; GitHub MCP server: github:subscribe_pr_activity), or the web session's Auto-fix toggle is on GitHub pushes review comments, CI failures, and check-suite success into the session. GitHub sends nothing when the base branch advances, so pair it with a slow Monitor poll (10 minutes) on mergeStateStatus. If the tool reports a PR Steward already watching, this session gets no events: say the PR is already covered and offer the one-shot modes instead of double-fixing
Monitor tool Monitor is in the tool list Start the watch script from the monitoring reference with persistent: true. Quiet polls never wake the agent; each emitted line runs phases 2-5
Cron CronCreate is in the tool list */2 * * * * running phases 2-5; every tick wakes the agent. Recurring tasks expire after 7 days
None Neither Do not claim monitor mode. Run the matching one-shot mode, or say this runtime cannot keep polling
  1. 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.
  2. 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 rebase origin/{base}
git push --force-with-lease --force-if-includes
  • Clean rebase: push, notify.
  • Conflicts only in lockfiles, generated files, or changelogs: regenerate per the reference, continue the rebase, push.
  • Conflicts in source logic, migrations, or API contracts: git rebase --abort, then notify with the files and what each side changed. Human intent decides those.

Bare --force is never used. A refused lease means someone else pushed: abort and notify rather than overwrite their commits. More than one author on the branch means a rebase rewrites their commits: merge origin/{base} instead.

Phase 3: CI Check

  1. gh pr checks --json name,state,bucket,link,workflow. bucket is pass, fail, pending, skipping, or cancel; link is the details URL.
  2. Anything pending: wait. Diagnosing a half-finished run fixes the wrong thing.
  3. Every fail: fetch logs by platform.
Check name or link Platform Logs
buildkite/ prefix Buildkite bk CLI when bk auth status passes, else REST with BUILDKITE_API_TOKEN, else hand over the link
vercel in name or vercel.com in link Vercel vercel inspect --logs {deployment_url} (build logs; vercel logs is runtime)
fly- prefix or fly.io in link Fly.io flyctl logs --app {app} --no-tail
Anything else GitHub Actions gh run view {run_id} --log-failed
  1. 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).
  2. 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

  1. 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).
  2. Compare both counts and the newest updated_at across 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.
  3. Any increase: notify "N new review comments on PR #{N}" and run the Comment Triage Workflow.

Phase 5: Readiness Check

  1. Ready means all of: mergeable == MERGEABLE, every required check pass, reviewDecision == APPROVED from a review whose commit_id is the head SHA, zero open blocking threads, zero threads awaiting my reply, every merge gate satisfied.
  2. A merge-gate comment reading "Human review required" is a blocker to report with the criteria that forced it, not a finding to fix.
  3. Ready: notify "PR #{N} is ready to merge." Merge is a one-way door: gh pr merge --auto with the repo's merge method, and only when the user opted in.
  4. Not ready: name the blockers ("Waiting on: 2 checks pending", "Awaiting your answer: 2 questions from @reviewer", "Approval is stale: reviewed abc1234, head def5678").
  5. 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; fall back to the manual queries in the API reference only when gh or jq cannot be installed.

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

  1. Write the plan (references/fix-plan-template.md) to .claude/pr-babysitter/pr-{N}-review-plan.md, print the counts, proceed.
  2. Ignored threads: one-line reply, then resolve.
  3. Questions: post the answer, leave the thread open. The reviewer resolves it.
  4. Resolved threads with an unanswered human reply: reply in place, do not unresolve, note it in the report.
  5. Fixes, one commit per logical group. Run the verification gate before each commit and stage only that group's files.
  6. Reply, then resolve, each fixed thread.
  7. 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" / "cancel the monitor": read the mechanism and ID from the state file. Monitor watch: TaskStop. Cron: CronDelete. Harness subscription: the matching unsubscribe tool.
  • PR merged or closed: the watch script emits TERMINAL and exits; cron detects it next tick and self-cancels.
  • Session exit: watches and cron jobs are session-scoped and clean themselves up. Background tasks are not restored on --resume; re-run the skill.

On stop, report: polls or events handled, fixes applied, conflicts resolved, comments triaged, current state.

Gotchas

  • gh pr checks --json name,state,conclusion,detailsUrl errors: conclusion and detailsUrl belong to gh pr view --json statusCheckRollup. The check fields are bucket and link.
  • 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.
  • viewerDidAuthor returned false on the viewer's own comments. Compare author.login to gh api user --jq .login.
  • A null line means outdated or multi-line, not PR-level. Only a null path is 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. Compare updated_at.
  • Counting a review whose commit_id is 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.
  • vercel logs {url} streams runtime logs. A failed build lives in vercel inspect --logs {url}.
  • bk without bk auth status first: keychain tokens expire and a dead token stalls the cycle. Fall through to REST, then the check link.
  • A monorepo type-check failure pointing into a sibling package's dist is usually stale build output. Reinstall and rebuild before editing source.
  • git add -A after a fix commits hook artifacts (a root schema.gql) into the PR. Sweep git status --porcelain and 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 exists
  • planning: writes plans a fresh session executes. The fix plan this skill writes is an audit trail for one PR, not a planning deliverable
  • pr-reviewer: local diff review for bugs; run it on monitor-authored fixes beyond a trivial patch
  • tidy: applies a pr-reviewer report to the working tree; this skill applies GitHub review comments
  • autoship: npm release pipelines; it watches its own release CI, so never babysit a release PR it drives

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 解决开发者高频刚需:自动化监控和修复 GitHub PR 的 CI 失败、冲突、评审讨论及合并准备状态
  • 显著提升日常开发效率,减少人工轮询和手动干预
触发精准90/100

待提升项

  • description写错位置 原报告严重程度:轻微

    顶层 description 字段为空,实际描述内容位于 skill_body 内部

    改进建议:将 description 内容移至顶层 frontmatter 的 description 字段

亮点

  • 触发词覆盖全面且精准,包括多种自然语言变体(如“watch this PR”、“fix CI”等)
  • 边界清晰,明确区分了 babysitter 与其他相关 Skill 的职责
结构规范95/100

待提升项

  • 缺少When to Use显式章节 原报告严重程度:轻微

    未设置独立的 When to Use 章节,但相关内容已在 Mode Selection 中覆盖

    改进建议:可考虑增加显式 When to Use 章节以提升可读性

  • 文档过长 原报告严重程度:轻微

    SKILL.md 文件约 1800 行,超出建议的 500 行限制

    改进建议:可将部分参考内容移至独立文档并通过引用链接,保持主文件简洁

亮点

  • 结构完整,Phase 划分清晰,每个阶段有明确目标和出口条件
  • 包含端到端执行示例、检查清单和详细参考文件指引
执行可靠95/100

亮点

  • 工具链依赖明确(gh CLI、jq、git),参数使用规范
  • 覆盖主要异常场景:rebase 冲突处理、CI 平台日志获取、bot 评论去重、git 操作安全机制
  • 不可逆操作(如 force push)有严格确认机制,防止数据丢失
证据可验 (前四项均值)94/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。