# /babysit — Auto-Respond to PR Review Comments > Open-source slash command that watches a PR for review comments and auto-pushes fixes. Inspired by Boris Cherny's /babysit pattern. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: # /babysit — Auto-Respond to PR Review Comments ## Quick Use 1. Save the file below to `.claude/commands/babysit.md`. 2. Restart Claude Code (or `/commands reload`). 3. After opening a PR: ``` /babysit 482 ``` (Or omit the number to use the current branch's open PR.) The command polls the PR every N minutes, reads new review comments, fixes code-change requests automatically, replies to questions, and pushes amendments — until you cancel or the PR merges. > Inspired by Boris Cherny's `/babysit` slash command on howborisusesclaudecode.com — community-written equivalent. --- ## Intro `/babysit` is Boris Cherny's "I'm in a meeting, let Claude handle the PR" pattern. After opening a PR, instead of context-switching every time a reviewer pings, /babysit watches the PR, classifies each new comment, fixes simple code-change requests in place, replies to questions with code references, and pushes the amendments — autonomously. The kicker: it knows what NOT to autonomously fix. Architectural pushback, design questions, security concerns -> escalates. Typo fixes, naming nits, missing tests -> handles itself. Works with: Claude Code 1.x, GitHub CLI (`gh`). --- ## How /babysit Works Save to `.claude/commands/babysit.md`: ```markdown --- description: Watch a PR for review comments and auto-respond/fix argument-hint: [PR number] [--poll ] [--no-push] --- You will monitor a PR and respond to review comments. Loop until merged or cancelled. 1. Identify target PR: - $ARGUMENTS first token if numeric, else use `gh pr view --json number -q .number`. - Stop if not on a branch with an open PR. 2. Poll interval (default 5 minutes): - Read `--poll N` from $ARGUMENTS, else default 5. - Cap minimum at 2 minutes (rate-limit friendly). 3. Each tick: - `gh pr view --json reviews,comments,reviewDecision,merged`. - If `merged: true`, stop. If `reviewDecision: APPROVED` and no unresolved comments, stop. - For each new review/comment since the last tick, classify: | Class | Examples | Action | |---|---|---| | code-fix | "rename foo to bar", "add a null check on line 42", "missing test" | Edit, commit, push | | reply | "Why did you choose X?", "Can you explain Y?" | Post a `gh pr comment` reply with code reference | | escalate | "I think we should rearchitect this", "this has security implications" | Post "Tagging @ — needs human input" + stop the loop | | non-actionable | "Nice!", "LGTM after this", reactions | Skip | 4. After any code-fix: - Re-run the project's pre-commit checks (lint + typecheck). - Commit with message `fix(review): ` (NEVER amend). - Push to the PR branch. - Reply on the comment thread: "Fixed in ." 5. Output a one-line status each tick: `tick N — — next: `. ## Boundaries - Never amend a previously published commit. - Never push to main/master. - Never resolve a review thread without code-fix or human reply. - Hard cap: 24 hours. After that, escalate and stop. - If `--no-push` is passed, only post replies — never commit/push. - Stop the loop AND notify on any escalate-class comment. ``` --- ## Example session ``` You: "/babysit 482" Claude: -> tick 1: 0 new comments, sleep 5min -> tick 2: 1 new comment "rename `tmpUsers` to `activeUsers`" Class: code-fix Edited src/admin/audit.ts, ran lint+typecheck, pushed a3b4c5d Replied: "Fixed in a3b4c5d." -> tick 3: 1 new comment "Why are we storing the full event payload?" Class: reply Posted: "Storing full payload because compliance requires retroactive query support for 90 days; see src/audit/schema.ts:18 comment." -> tick 8: review approved, 0 unresolved -> stopping. ``` Escalation case: ``` -> tick 5: 1 new comment "I think we should split this into two PRs" Class: escalate Posted: "Tagging @williamwang — needs human input on PR scope." Stopping loop. ``` --- ## FAQ **Q: Will it amend my commits?** A: Never. Each fix is a new commit (`fix(review): ...`). Amending published commits loses history. **Q: Will it merge the PR?** A: No — never auto-merges. Stops when approved or cancelled, lets you press merge. **Q: What's the cap?** A: 24 hours per /babysit invocation. Long PRs need re-invocation. **Q: Does it handle non-English review comments?** A: Yes — Claude classifies regardless of language. The reply will match the comment's language. **Q: Is this Boris's actual /babysit?** A: No — community-written equivalent. The pattern is from his public description. --- ## Source & Thanks > Inspired by Boris Cherny's `/babysit` slash command on howborisusesclaudecode.com. Citations: - howborisusesclaudecode.com - Pragmatic Engineer: https://newsletter.pragmaticengineer.com/p/building-claude-code-with-boris-cherny - Get Push To Prod: https://getpushtoprod.substack.com/p/how-the-creator-of-claude-code-actually ## 快速使用 1. 落 `.claude/commands/babysit.md` 2. `/commands reload` 3. 开完 PR 后跑:`/babysit [PR号]` —— 每 5 分钟轮询,自动改 nit / 回问题 / 升级架构问题给人,最多 24h。 ## 边界 - 永不 amend,每次修复是 new commit - 永不自动 merge - 架构 / 安全类评论一律 escalate 给人,不擅自决策 - 24h 硬性封顶 - 中英文评论都能分类 --- Source: https://tokrepo.com/en/workflows/babysit-auto-respond-pr-reviews-9e627ece Author: Skill Factory