brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
pr-babysitterMonitors 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".
Independent GitHub snapshot · Automated classification · Original documentation governs
pr-creator), reviewing or fixing the diff itself (tidy), or npm release PRs (autoship watches its own release CI; never babysit a release or Version Packages PR it drives).| 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 PRs. Skip drafts (isDraft) unless asked. A merged PR goes on to the repo's post-merge watch: wait for the watch/<env> commit statuses on the merge SHA, stop at the first failure or error, and report the result (Post-merge Watch in references/monitoring-setup.md). If the base it merged onto (the merge commit's first parent, or for a rebase merge the commit before the PR's rebased commits) has no watch/* status, report "no post-merge watch". Either way, once the merge is live in production, smoke-test the change there read-only (Production smoke test in the same reference), report that too, and stop.
Comment triage runs autonomously; the plan file is an audit trail, not an approval gate.
Speak only on transitions. A quiet poll says nothing.
| File | Read when |
|---|---|
references/monitoring-setup.md | Phase 1, a merged PR, and Stopping: watch ladder, Monitor watch script, cron fallback, post-merge watch, state file format, defaults, stop and lifecycle |
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, 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 |
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)
- [ ] After merge: post-merge watch until watch/* passes, fails, or is absent, then a read-only production smoke test
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.gh repo view --json owner,name for the calls that need owner/repo.gh pr checks --json name,link (pattern table in references/ci-platforms.md).references/monitoring-setup.md that applies (harness PR subscription, Monitor tool, cron, none). With no rung, do not claim monitor mode: run the matching one-shot mode or say this runtime cannot keep polling..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.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
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.
gh pr checks --json name,state,bucket,link,workflow. bucket is pass, fail, pending, skipping, or cancel; link is the details URL.pending: wait. Diagnosing a half-finished run fixes the wrong thing.fail: fetch logs with the platform's commands in references/ci-platforms.md (GitHub Actions, Buildkite auth chain, Vercel, Fly.io).knip (delete dead code or configure), infrastructure (notify; not fixable from code).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.
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.<!-- pr-evidence --> comment, edited on every push) is a quiet poll.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.gh pr merge --auto with the repo's merge method, and only when the user opted in.Inline from Phase 4 or one-shot. Autonomous: no approval gate, the plan file is the audit trail.
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; fix that cause and re-run rather than hand-writing queries.
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.
github-actions[bot] is shared by reviewers and noise alike.references/fix-plan-template.md) to .claude/pr-babysitter/pr-{N}-review-plan.md, print the counts, proceed."Stop babysitting" or "cancel the monitor": stop the mechanism recorded in the state file per references/monitoring-setup.md (Stopping, Session Lifecycle), then report polls or events handled, fixes applied, conflicts resolved, comments triaged, and current state.
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.line means outdated or multi-line, not PR-level. Only a null path is PR-level. Recover the anchor before deciding anything.id, so a state diff on ids sees nothing. Compare updated_at.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.git add -A after a fix commits hook artifacts (a root schema.gql) into the PR. Sweep git status --porcelain and stage paths.pr-creator: opens or edits the PR; babysitting starts after it existsplanning: writes plans a fresh session executes. The fix plan this skill writes is an audit trail for one PR, not a planning deliverabletidy: reviews and fixes the diff itself; this skill applies GitHub review comments. 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 drives