選項

觀察一個拉取請求或審查週期,直到它準備好合併。當被要求照看、監控或持續檢查 PR 評論、審查意見和 CI 結果,直到所有可操作的問題都得到解決時,使用此功能。

...展開全部
16
更新時間 2026-08-26

關於 babysit

持續監控一個拉取請求(Pull Request)或程式碼審查週期,直到其真正具備合併條件。在存在未解決的評論或審查執行緒時,它會持續進行檢查,而不是在單次掃描後停止。該工作流會識別 PR 編號、分支以及基礎分支,確認 PR 並非草稿狀態,並檢查可合併性、狀態檢查(checks)、審查意見、評論以及審查執行緒。掛起的狀態檢查會被持續監控直至完成,輪詢間隔通常設定為 30 到 60 秒,除非使用者指定了其他頻率。系統會讀取新評論和未解決的審查執行緒,並將機器人生成的摘要視為有用的但需透過程式碼驗證的可操作發現。

針對真實問題修復的程式碼會被提交到獨立的提交(commit)中,執行相關的測試或構建,推送更改後,流程會返回以重新檢查狀態。只有在驗證程式碼或生成的工件(artifact)確實解決了相關評論後,才會解決陳舊的審查執行緒。僅當狀態檢查透過或被有意跳過、審查意見可接受、沒有剩餘的可操作評論且沒有未解決的審查執行緒時,該過程才會停止。

該技能提供了具體的 GitHub CLI 和 GraphQL 配方。使用帶有 JSON 欄位列表的 gh pr view 命令可獲得粗略狀態,包括狀態、草稿狀態、可合併性、mergeStateStatusreviewDecisionheadRefOid 以及 statusCheckRollup。在發起 GraphQL 查詢之前,使用 gh repo viewjq 解析倉庫所有者和名稱。使用包含 pageInfo 用於分頁的 reviewThreads GraphQL 查詢獲取未解決的審查執行緒,文件中記錄了使用 endCursorhasNextPage 為真時分頁遍歷結果,並使用 jq 過濾出未解決的執行緒。resolveReviewThread 突變僅在驗證修復措施後才會解決執行緒。操作規則包括在長時間的狀態檢查期間保持監控程式執行,確認機器人報告的問題是針對陳舊程式碼還是當前程式碼,在解決之前驗證原始碼和生成工件是否一致,進行全新的最終掃描,並報告具體證據,如最新的提交 SHA、檢查結果、未解決執行緒數量、執行的測試以及任何未處理的本地髒檔案。

常見問題解答

該技能在何時停止監控 PR?

僅當狀態檢查透過或被有意跳過、審查意見可接受、沒有剩餘的可操作評論且沒有未解決的審查執行緒時,它才會停止。如果仍有開放的執行緒,它不會在單次狀態檢查透過後停止。

它多久輪詢一次狀態?

通常以 30 到 60 秒的實際間隔進行輪詢,除非使用者要求不同的頻率。在長時間的狀態檢查仍在掛起時,會保持監控程式執行。

如何查詢未解決的審查執行緒?

使用包含 pageInfo 的 GraphQL reviewThreads 查詢,利用前一個 endCursorhasNextPage 為真時分頁遍歷結果,然後使用 jq 過濾出 isResolved 為假的執行緒。

在何時解決陳舊的審查執行緒是安全的?

僅在驗證程式碼或生成的工件現在確實解決了相關評論後,才使用 resolveReviewThread 突變進行解決。對於分散式生成的檔案,必須首先確認原始碼和生成工件是一致的。

最後應該報告什麼?

具體證據:最新的提交 SHA、檢查名稱和結果、未解決執行緒數量、執行的測試,以及經過對 PR 狀態、執行緒、最近評論和 git 狀態進行一次全新掃描後,遺留的任何未處理的本地髒檔案。

在 GitHub 上查看

Stay with the PR until it is actually clean. Do not stop after one check pass if comments or review threads are still unresolved.

Workflow

  1. Identify the PR number, branch, and base branch.
  2. Confirm the PR is not draft and inspect mergeability, checks, review decision, comments, and review threads.
  3. Watch pending checks until they finish. Poll at a practical interval, usually 30-60 seconds unless the user asks for a different cadence.
  4. Read new comments and unresolved review threads. Treat bot summaries as useful, but verify actionable findings against the code.
  5. Fix real issues in focused commits, run relevant tests/builds, push, and return to step 2.
  6. Resolve stale review threads only after verifying the code or generated artifact now addresses the comment.
  7. Stop only when checks are passing or intentionally skipped, review decision is acceptable, no actionable comments remain, and no unresolved review threads remain.

GitHub CLI Checks

Use gh pr view for the coarse status:

gh pr view <number> --json \  number,state,isDraft,mergeable,mergeStateStatus,reviewDecision,headRefOid,statusCheckRollup,url

Resolve the repository owner/name before using GraphQL:

repo_json=$(gh repo view --json owner,name)owner=$(jq -r '.owner.login // .owner.name' <<<"$repo_json")repo=$(jq -r '.name' <<<"$repo_json")

Use GraphQL for unresolved review threads. Include pageInfo; omit cursor on the first page, then pass the previous endCursor with -f cursor="$cursor" while hasNextPage is true.

gh api graphql \  -f query='query($owner:String!,$repo:String!,$number:Int!,$cursor:String){repository(owner:$owner,name:$repo){pullRequest(number:$number){reviewThreads(first:100,after:$cursor){pageInfo{hasNextPage endCursor}nodes{id,isResolved,isOutdated,path,line,comments(last:1){nodes{author{login},body,createdAt,url}}}}}}}' \  -f owner="$owner" -f repo="$repo" -F number=<number>

Use this loop when a PR may have many review threads:

thread_query='query($owner:String!,$repo:String!,$number:Int!,$cursor:String){repository(owner:$owner,name:$repo){pullRequest(number:$number){reviewThreads(first:100,after:$cursor){pageInfo{hasNextPage endCursor}nodes{id,isResolved,isOutdated,path,line,comments(last:1){nodes{author{login},body,createdAt,url}}}}}}}'cursor_args=()while :; do  page=$(gh api graphql -f query="$thread_query" -f owner="$owner" -f repo="$repo" -F number=<number> "${cursor_args[@]}")  printf '%s' "$page" | jq -r '.data.repository.pullRequest.reviewThreads.nodes[]    | select(.isResolved==false)    | [.id,.path,(.line//""),(.isOutdated|tostring),(.comments.nodes[-1].author.login//""),(.comments.nodes[-1].body|gsub("";" ")|.[0:240])]    | @tsv'  jq -e '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage' >/dev/null <<<"$page" || break  cursor=$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.endCursor' <<<"$page")  cursor_args=(-f cursor="$cursor")done

Filter unresolved threads with jq:

jq -r '.data.repository.pullRequest.reviewThreads.nodes[]  | select(.isResolved==false)  | [.id,.path,(.line//""),(.isOutdated|tostring),(.comments.nodes[-1].author.login//""),(.comments.nodes[-1].body|gsub("";" ")|.[0:240])]  | @tsv'

Resolve a stale thread only when the fix is verified:

gh api graphql \  -f query='mutation($threadId:ID!){resolveReviewThread(input:{threadId:$threadId}){thread{id,isResolved}}}' \  -f threadId=<thread-id>

Operating Rules

  • Keep the watcher running while long checks are pending.
  • If a generated file is part of the distribution, verify the source and generated artifact agree before resolving comments.
  • If a bot reports an issue against stale code, confirm whether the thread is outdated or addressed in the latest head.
  • Before final reporting, do one fresh sweep of PR status, unresolved threads, recent comments, and local git status.
  • Report concrete evidence: latest commit SHA, check names and results, unresolved thread count, tests run, and any dirty local files left untouched.

所有檔案

0 個檔案

安裝 babysit

將技能檔案下載並解壓至你的 .claude/skills/ 目錄。

下載 ZIP

複製儲存庫並將技能檔案複製到您的專案中。

git clone https://github.com/thedotmack/claude-mem/blob/main/plugin/skills/babysit/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

複製 複製
快速設定: 將技能資料夾複製到 .claude/skills/,Claude 將自動檢測並使用該技能

相關技能

code-simplify
更新時間 2026-07-02
requesting-code-review
更新時間 2026-06-29
Git Commit Helper
更新時間 2026-06-29
commit-standards
更新時間 2026-06-29
OR