一键导入
babysit-pr
Autonomously monitor and fix PR CI failures. Trigger on 'CI is red', 'fix CI', 'babysit this PR'.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Autonomously monitor and fix PR CI failures. Trigger on 'CI is red', 'fix CI', 'babysit this PR'.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Evidence-gated completion check. Use before committing, creating PRs, or claiming work is done. Pairs with verification-spec at task start.
Systematic knowledge extraction from open-source projects. Use when: user shares a repo/link to study, says 偷师/steal/学习/研究, or wants to analyze another project's patterns for adoption.
Launch a real interactive claude CLI session in a target directory (typically a worktree) with a pre-seeded prompt. Use when the current session cannot absorb the task context — e.g., N parallel worktree jobs that would blow the context window, or when you need the user to watch progress in a visible terminal. Each spawned session runs independently in its own Windows Terminal tab.
FileNotFound recovery protocol. Before reporting a missing-file error, suggest near-misses by basename similarity (difflib threshold 0.4) so typos and stale paths fail loudly with actionable hints.
Paste-by-reference guard for Edit calls. When new_string would echo >30 lines of existing file content, use {{file:path:start:end}} reference instead and expand before submission.
File-IO protocol for parent ↔ subagent communication. Parent writes input.txt + context.json, subagent appends to output.txt with [ROUND END] sentinels. Used with Monitor tool for live observation.
| name | babysit-pr |
| description | Autonomously monitor and fix PR CI failures. Trigger on 'CI is red', 'fix CI', 'babysit this PR'. |
| origin | Orchestrator — earned through direct practice (see commit history) |
| source_version | 2026-04-18 |
You are babysitting a pull request. Your job is to watch CI checks, and if any fail, diagnose and fix them.
The user provides a PR number or URL. Extract:
Repeat up to 5 rounds:
gh pr checks <PR_NUMBER> --json name,state,conclusion
If all checks pass → report success and STOP. If any check is "in_progress" → wait 60 seconds and re-check (max 3 waits). If any check failed → proceed to step 2.
gh run view <RUN_ID> --log-failed
Extract the error message, failing test name, and relevant context.
Read the failing file(s). Understand why the test/lint/build failed. Apply the Surgical Changes principle: fix ONLY the failure, don't clean up adjacent code.
Make the minimal fix. Commit with message:
fix(ci): <what was fixed>
babysit-pr round N/5
Push to the PR branch:
git push
Wait 60 seconds for CI to restart, then go back to step 1.
These thoughts mean you're about to violate the babysit protocol:
| Rationalization | Reality | Correct Behavior |
|---|---|---|
| "This test is flaky, I'll just re-run" | Flaky tests have root causes. Re-running without diagnosis is coin-flipping. | Read the failure log. If truly flaky (timing, network), report it as infra. Don't retry blindly. |
| "I'll fix the test to match the new behavior" | You're making the test pass, not making the code correct. Tests define expected behavior — code should conform. | Fix the code, not the test. Unless the test expectation is genuinely wrong. |
| "This is just a lint warning" | Lint rules exist because someone shipped a bug that rule would have caught. | Fix the lint issue. Don't disable the rule. |
| "Let me also clean up this file while I'm here" | Babysit scope is CI fixes ONLY. Mixing cleanup with fixes makes rollback impossible. | Fix the failure. Nothing else. |
| "The CI config is wrong, let me fix it" | Modifying CI config to make tests pass is cheating, not fixing. | Report CI config issues to the user. Don't touch workflows. |
| "Round 5 will definitely work" | If 4 rounds failed, your mental model is wrong. Round 5 with the same model will also fail. | Stop at round 5. Escalate with a diagnostic report. |
| Thought | Reality | Correct Behavior |
|---|---|---|
| "The test is flaky, I'll skip it" | You don't know that without evidence. Flaky = same code passes sometimes. | Run the test 2x. If it fails both times, it's real. Only skip with gh run rerun evidence of prior flaky history. |
| "I'll just disable the lint rule" | Disabling rules is modifying CI config — explicitly forbidden above. | Fix the code to satisfy the linter. |
| "This CI failure looks like infra" | Infra failures are timeouts/runner issues, NOT code errors with clear stack traces. | If there's a stack trace pointing to code, it's a code bug. Diagnose it. |
| "Let me refactor this while I'm here" | Surgical changes: fix ONLY the failure. Adjacent cleanup is scope creep. | Fix the one failing line. Commit. Move on. |
| "5 rounds isn't enough, I need more" | 5 rounds is the hard limit. If you can't fix it in 5, the problem is your diagnosis, not the round count. | Report remaining failures honestly. Don't request more rounds. |
| "I'll batch these 3 fixes into one commit" | Each fix = separate commit. Batching defeats bisectability. | One fix, one commit, one push. |