From claude-commands
Drives all open PRs toward merge-readiness by auditing 7 gates (CI, conflicts, reviews, comments, evidence, skeptic), fixing failures, and triggering missing checks.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-commands:babysitThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematically drive all open PRs toward 7-green merge-readiness. For each PR:
Systematically drive all open PRs toward 7-green merge-readiness. For each PR:
/skeptic and /smoke| # | Gate | Check |
|---|---|---|
| 1 | CI green | All GitHub Actions checks pass (no FAILURE conclusions) |
| 2 | No conflicts | mergeable == "MERGEABLE" |
| 3 | CR APPROVED | CodeRabbit latest review state == "APPROVED" |
| 4 | Bugbot clean | cursor[bot] zero error-severity comments |
| 5 | Comments resolved | Zero unresolved non-nit inline review comments |
| 6 | Evidence pass | Evidence bundle exists or N/A justified |
| 7 | Skeptic PASS | github-actions[bot] posted VERDICT: PASS |
gh pr list --state open --json number,title,headRefName,headRefOid,mergeable \
--jq '.[] | "\(.number)|\(.title)|\(.headRefName)|\(.headRefOid[:12])|\(.mergeable)"'
For each open PR, check all 7 gates:
# Gate 1: CI status
gh pr view <NUM> --json statusCheckRollup \
--jq '[.statusCheckRollup[] | select(.conclusion == "FAILURE")] | length'
# Gate 2: Mergeable
gh pr view <NUM> --json mergeable --jq '.mergeable'
# Gate 3: CodeRabbit review
gh api repos/$GITHUB_REPOSITORY/pulls/<NUM>/reviews \
--jq '[.[] | select(.user.login=="coderabbitai[bot]")] | last | .state'
# Gate 4: Bugbot errors
gh api repos/$GITHUB_REPOSITORY/pulls/<NUM>/comments \
--jq '[.[] | select(.user.login=="cursor[bot]" and (.body | test("error";"i")))] | length'
# Gate 5: Unresolved comments
gh api graphql -f query='
query($owner:String!, $name:String!, $pr:Int!) {
repository(owner:$owner, name:$name) {
pullRequest(number:$pr) {
reviewThreads(first:100) {
nodes { isResolved }
}
}
}
}
' -f owner=jleechanorg -f name=your-project.com -F pr=<NUM> \
--jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved==false)] | length'
# Gate 6: Evidence in PR body
gh pr view <NUM> --json body --jq '.body' | grep -i -E "evidence|gist|video|mp4|N/A"
# Gate 7: Skeptic verdict
gh api repos/$GITHUB_REPOSITORY/issues/<NUM>/comments \
--jq '[.[] | select(.user.login=="github-actions[bot]" and (.body | test("VERDICT: PASS";"i")))] | length'
Group PRs into:
/skeptic and /smokeFor each RED PR, use subagents (Agent tool, subagent_type: copilot-fixpr) to:
Common fixes:
origin/main@coderabbitai trigger → comment on PRFor each YELLOW PR:
@coderabbitai all good?For PRs at 6/7 gates (only Skeptic missing):
# Trigger Green Gate workflow if no recent run
gh workflow run green-gate.yml --ref <branch> -f pr_number=<NUM>
# Trigger smoke tests via PR comment
gh pr comment <NUM> --body "/smoke"
Skeptic-cron runs every 30 min automatically. Once it posts VERDICT: PASS, the PR is 7-green.
Print a summary table:
PR #<N> — age: <Xh Ym> — status: <red|yellow|green|7-green>
Gates: 1=✓ 2=✓ 3=✓ 4=✓ 5=✓ 6=✓ 7=✗ (Skeptic pending)
Action: /smoke triggered, waiting for Skeptic-cron
Agent type: copilot-fixpr for fixing, general-purpose for auditing/triggering
After Phase 7, if any PRs are still open, do not exit. Schedule a wakeup to re-check:
# In /loop mode (Claude Code interactive) — fires only when REPL is idle, never interrupts work
ScheduleWakeup(
delaySeconds=180, # 3 min — within 5-min cache window, catches Design Doc bot commits
prompt="<<autonomous-loop-dynamic>>",
reason="babysit hold: re-checking stale Skeptic verdicts after Design Doc bot commits"
)
On each wakeup iteration, run a lightweight stale-verdict sweep (not a full audit):
# Check each open PR for stale Skeptic SHA
for pr in $(gh pr list --repo $GITHUB_REPOSITORY --state open --json number --jq '.[].number'); do
head=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json headRefOid --jq '.headRefOid[0:8]')
verdict=$(gh api --paginate repos/$GITHUB_REPOSITORY/issues/${pr}/comments | python3 -c "
import sys,json,re
# gh api --paginate emits one JSON array per page; merge all pages before parsing
raw=sys.stdin.read().strip()
c=json.loads('['+raw[1:-1].replace(']\n[',',')+']') if raw.startswith('[') else json.loads(raw)
b=[x for x in c if x.get('user',{}).get('login')=='github-actions[bot]' and 'VERDICT: PASS' in x.get('body','')]
m=re.search(r'skeptic-head-sha-([a-f0-9]+)',b[-1]['body']) if b else None
print(m.group(1)[:8] if m else 'none')")
# Also check: don't re-dispatch if CI is still pending/failing (Skeptic will fail at Gate 1)
ci_failures=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json statusCheckRollup \
--jq '[.statusCheckRollup[] | select((.conclusion == "FAILURE" or .conclusion == "ERROR" or .conclusion == "TIMED_OUT") and .name != "Green Gate")] | length')
ci_pending=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json statusCheckRollup \
--jq '[.statusCheckRollup[] | select(.status == "IN_PROGRESS" or .status == "QUEUED")] | length')
if [[ "$verdict" != "$head" && "$ci_failures" == "0" && "$ci_pending" == "0" ]]; then
gh workflow run "Skeptic Self-Verify" --repo $GITHUB_REPOSITORY -f pr_number=$pr
echo "Re-dispatched Skeptic for #$pr (verdict=$verdict head=$head)"
elif [[ "$ci_failures" != "0" || "$ci_pending" != "0" ]]; then
echo "Skipping Skeptic dispatch for #$pr — CI not settled (failures=$ci_failures pending=$ci_pending)"
fi
done
Exit condition: Stop scheduling wakeups when gh pr list --repo $GITHUB_REPOSITORY --state open --json number --jq 'length' returns 0 (all merged).
CronCreate alternative (non-interactive / cron-based sessions):
# Guard: create at most ONE cron job per babysit session. Check CronList first.
jobs = CronList()
babysit_jobs = [j for j in jobs if "babysit" in j.get("prompt", "").lower()]
if not babysit_jobs:
job_id = CronCreate(
cron="*/5 * * * *", # every 5 minutes
# Sweep-only prompt — do NOT use "/babysit" here (that runs full 7-phase audit).
# This fires the Phase 8 stale-verdict sweep: compare HEAD SHA to last VERDICT: PASS
# SHA for each open PR; re-dispatch Skeptic Self-Verify only when stale and CI settled.
prompt="Run /babysit Phase 8 stale-verdict sweep only: for each open PR in $GITHUB_REPOSITORY, compare HEAD SHA to last VERDICT: PASS SHA; re-dispatch Skeptic Self-Verify if stale and CI settled. Skip full Phase 1-7 audit.",
recurring=True
)
Use CronCreate only when NOT in an interactive /loop session. Delete the job with CronDelete once all PRs merge. The guard above prevents duplicate cron jobs from accumulating across repeated babysit invocations.
Key rule: never sleep-poll inline. The wakeup fires while the REPL is idle — it cannot interrupt a user conversation or an in-progress tool call. This is safe to leave running.
When babysitting active testing or evidence generation:
/tmp/.../iteration_XXX. Confirm .jsonl files are non-empty.docs/evidence/pr-<number>/ (e.g., docs/evidence/pr-6851/)..jsonl files, missing checksums, server timeout errors, or EvidenceSignatureGuard rejections), immediately invoke the /testing-gap-close skill to harden the server lifecycle and resolve the failure.lsof -ti :<port> | xargs kill for the bound port, (3) kill -- -$(ps -o pgid= -p <pid>) for the process group. Only fall back to pkill -9 -f gunicorn as a last resort when all scoped methods fail.gh pr merge — only skeptic-cron mergessleep inline to wait for bots — use ScheduleWakeup insteadnpx claudepluginhub jleechanorg/claude-commands --plugin claude-commandsAutomatically 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.
Monitors pull requests through to merge by automatically handling CI failures, review comments, and thread resolution until all checks pass. Invoke after PR creation or via /pr-shepherd.
Iterates on a PR until CI passes. Automatically fixes CI failures, addresses categorized review feedback, and pushes fixes until all checks are green.