/git-tooling:ci-watchfrom git-tooling
This skill should be used proactively after opening a PR (`gh pr create`) or pushing to a branch with an open PR, and whenever the user asks to "watch CI", "are the checks green yet", "monitor PR checks", "tell me when CI passes", "follow the build", "wait for CI", "ping me when checks finish", "is CI passing", "watch the PR", "watch until merged", or any request to keep an eye on GitHub PR status without manual polling. Works for a single PR in the current repo or many PRs across many repos in one call. Invokes the Monitor tool with ci-watch.py to stream CI pass/fail/pending, review status, and merge transitions as notifications, stopping only when every watched PR is merged or closed.
Ships in git-tooling. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Watch GitHub PR status through to merge without manually polling. This skill invokes the Monitor tool with ci-watch.py, which emits one notification per state transition and exits only when every watched PR is merged, closed, or gone. CI completion and review status are reported as intermediate milestones — a READY flag appears when a PR is mergeable (all checks green, reviews clear, no conflicts) and GitHub affirmatively reports it mergeable: mergeable == MERGEABLE (not merely "not conflicting") and mergeStateStatus is neither blocked nor still being computed. This catches required reviews, ruleset rules, and conversation-resolution gates even when no tracked signal explains them, and avoids a misleading early READY in the window right after a push before GitHub has computed mergeability.
The watcher also reports draft transitions (DRAFTED/UNDRAFTED), flags a PR with more than 100 checks (TRUNC, counts may be partial), and surfaces a one-time WARN if a PR stays unreadable across several polls instead of silently idling. Many PRs (across many repos) are fetched in batched GraphQL requests, and polling backs off automatically when the API errors.
Requirements: python3 (3.8+) and gh (authenticated). The script uses only the Python standard library — no pip install needed. Works on macOS and Linux without bash-version dependencies (the previous bash implementation needed bash 4+ for associative arrays, which broke on stock macOS bash 3.2).
Run ci-watch after every PR you open or push to — not only when the user explicitly asks. The post-push-or-pr-reminder hook fires on each gh pr create / git push to a branch with an open PR; treat that reminder as the trigger to start watching.
gh pr checks <pr> reports zero checks — a PR whose changed paths trigger no workflow at all. Verify that with the command; don't assume it.gh run list / gh run watch loops.Repository:
!`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "(not in a github repo)"`
Open PRs:
!`gh pr list --state open --json number,title,headRefName -q '.[] | "#\(.number) \(.title) (\(.headRefName))"' 2>/dev/null || echo "(none)"`
Current branch:
!`git symbolic-ref --short HEAD 2>/dev/null || echo "(detached)"`
| User intent | Resolution |
|---|---|
| Named a PR number ("watch PR #48") | Pass that number |
| Said "watch this" / "this PR" with no number | Resolve via gh pr list --head "$(git symbolic-ref --short HEAD)" --state open --json number -q '.[].number'. If no PR exists, tell the user and stop. |
| Said "all PRs" or "every open PR" | Pass no PR-number args (script defaults to all open) |
| Several PRs in one repo | Pass all the numbers: ci-watch.py 48 49 50 (or -R owner/repo 48 49) |
| PRs across multiple repos (batch push, nested-repo work) | Pass owner/repo#N tokens: ci-watch.py owner/repoA#12 owner/repoB#4 owner/repoB#5. One Monitor call covers the whole batch — do not start one watcher per repo, and do not watch only one of them. |
owner/repo#N tokens, bare PR numbers, and -R owner/repo mix freely in a single invocation (e.g. ci-watch.py -R owner/repoA 12 13 owner/repoB#4). Bare numbers apply to the -R repo, or the auto-detected repo when no -R is given. This is not specific to any multi-repo layout — it works the same for several PRs in one standalone repo and for PRs spread across several repos.
Monitor(
description: "CI status for PR #N", # or "CI status for N open PRs"
command: "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/ci-watch.py\" <PR#>",
persistent: false,
timeout_ms: <see table below>
)
Always invoke via python3 "${CLAUDE_PLUGIN_ROOT}/scripts/ci-watch.py" — do not call the script directly. This avoids depending on the executable bit being preserved through installation.
Argument forms (mix freely in one call):
... ci-watch.py 48 49... ci-watch.py -R owner/repo 48 49 (the -R repo applies to bare numbers that follow)... ci-watch.py owner/repoA#12 owner/repoB#4 owner/repoB#5A single Monitor call watches the entire set — prefer one watcher over the whole batch rather than one Monitor per repo.
timeout_msThe script exits naturally when all watched PRs reach a terminal state, so timeout_ms is just a safety cap.
| Scenario | timeout_ms | persistent |
|---|---|---|
| CI-only (user said "tell me when CI passes") | 1800000 (30 min) | false |
| Watch until merge (default) | 3600000 (60 min, max allowed) | false |
| Session-length watching ("keep watching") | any | true |
Since the watcher now runs until merge (which may take longer than CI alone), default to 3600000. Set persistent: true if the user explicitly asks for indefinite watching or if merge timing is unpredictable. If the Monitor times out before merge, tell the user and offer to re-invoke.
Each notification line emitted by the script looks like:
| Line | Meaning |
|---|---|
PR #48: P=3,F=0,W=2 | 3 passed, 0 failed, 2 still waiting |
PR #48: P=5,F=0,W=0,READY | All checks green, reviews done, no conflicts — ready to merge |
PR #48: P=4,F=1,W=0,FAIL[build] | A check failed — FAIL[…] names the failing check(s) inline (deduped, capped at 5 with a trailing +N overflow marker, e.g. FAIL[build,lint,+2]). Only appears when F>0. Surface to user |
PR #48: P=2,F=0,W=3,CR | Changes requested by a reviewer |
PR #48: P=2,F=0,W=3,U=4 | 4 unresolved review threads |
PR #48: P=5,F=0,W=0,RR=1 | All checks green but 1 requested reviewer (e.g. Copilot) hasn't posted yet — keep watching |
PR #48: P=5,F=0,W=0,BLOCKED | GitHub reports the merge blocked for a reason the counts don't show — a required review/ruleset (Copilot/CODEOWNERS), a required check, or an unresolved/conversation-resolution gate. Investigate before merging |
PR #48: P=5,F=0,W=0,U=3,DRAFT(by github-actions) | The PR was converted back to draft — usually our claude-pr-review reusable's draft_on_blocking, which drafts a PR when a review posts blocking comments so re-reviews pause until the author resolves them and marks it ready again. by <login> names whoever drafted it (github-actions ⇒ the review bot; a human login ⇒ a manual draft). A U=N/CR on the same line is usually the root cause — those blocking threads are what tripped the draft. DRAFT alone = drafted but the actor wasn't in the timeline. READY never appears while drafted. |
PR #48: P=3,F=0,W=0,CONFLICT | Merge conflict |
PR #48: DRAFTED,P=5,F=0,W=0,DRAFT(by github-actions) | The PR just flipped to draft this poll — DRAFTED is a transition marker prepended to the line (the DRAFT(by …) token still shows current state) |
PR #48: UNDRAFTED,P=5,F=0,W=0,READY | The PR just flipped back to ready-for-review — UNDRAFTED is the transition marker; auto-reviews resume |
PR #48: P=5,F=0,W=0,TRUNC | The head commit has >100 checks; the P/F/W counts cover only the first page and may be incomplete. READY is suppressed while truncated. Inspect with gh pr checks <pr> |
PR #48: WARN unreadable after 3 consecutive API errors; still retrying | The PR couldn't be read for several polls (rate limit / outage). The watcher keeps retrying with exponential backoff — emitted once per error streak, not every poll |
PR #48: MERGED — pull latest main and prune local branch feat-x (git checkout main && git pull --prune && git branch -d feat-x) | PR merged; line carries a copy-pasteable post-merge cleanup suggestion using the PR's real base/head branch names |
PR #48: CLOSED / PR #48: GONE | PR finished without merging |
ci-watch: all watched PRs reached a terminal state | Final line, script exits cleanly |
When watching more than one repo, each line is prefixed with owner/repo#N: instead of PR #N: (e.g. owner/repoB#4: P=5,F=0,W=0,READY) so PRs that share a number across repos stay distinct. Single-repo watches keep the familiar PR #N: form.
How to react:
READY — all checks passed, reviews complete, no conflicts. Tell the user the PR is ready to merge. Ask if they want to merge now. The watcher keeps running — it will report MERGED once the merge happens.F>0) — surface immediately. The failing check name(s) are already inline in the FAIL[…] token, so relay those directly. Run gh pr checks <pr> -R <owner/repo> only when you need the full check list or a link to the failing run's logs.CR or U=N — point the user at reviewer feedback before merging.RR=N — N reviewers (typically Copilot's auto-review) still owe a verdict. Watcher keeps polling until they post.BLOCKED — GitHub's authoritative merge state is BLOCKED but the tracked counts (F/CR/U/RR) don't explain why — e.g. a ruleset requiring a Copilot/CODEOWNERS review, a required status check, or a conversation-resolution gate. Run gh pr view <pr> --json mergeStateStatus,reviewDecision and inspect the ruleset/branch protection; resolve the gate before merging. The READY flag will not appear while the PR is blocked.DRAFT(by …) — the PR was flipped back to draft, pausing auto-reviews. When the actor is github-actions, this is almost certainly the claude-pr-review reusable's draft_on_blocking reacting to blocking review comments — so the work isn't done: read the blocking threads (gh pr view <pr> --comments, or the U=N count on the same line), fix them, push, then return the PR to review with gh pr ready <pr> so reviews resume. A human login means someone drafted it deliberately — confirm with the user before marking it ready again. The watcher keeps polling, so it'll report READY/MERGED once it's back in review and clear.DRAFTED / UNDRAFTED — the PR's draft state just flipped this poll. DRAFTED = converted to draft (auto-reviews pause; usually draft_on_blocking — see the DRAFT(by …) token on the same line). UNDRAFTED = returned to ready-for-review (reviews resume). These are transition markers, distinct from the steady-state DRAFT(by …) token.TRUNC — the head commit has >100 checks, so the P/F/W counts are partial and READY is withheld. Use gh pr checks <pr> -R <owner/repo> for the authoritative list.WARN unreadable … — the PR has been unreadable for several polls (rate limit, network, or a token-scope problem). The watcher keeps retrying with backoff; if it persists, check gh auth status and rate limits (gh api rate_limit).CONFLICT — offer to rebase against the base branch.MERGED — the PR was merged. Report success. The line includes a brief cleanup suggestion (pull the latest base branch, prune the now-stale local feature branch) with the PR's actual branch names. If you're working in that repo and the local branch exists, offer to run it; otherwise just relay it. The watcher exits once all watched PRs reach this (or CLOSED/GONE).CLOSED / GONE — PR was closed without merging or deleted from the API.If the user changes their mind mid-watch, call TaskStop to cancel early.
GIT_TOOLING_CI_POLL_SECONDS env var if the user explicitly wants faster/slower polling (rare — respect GitHub rate limits).P=0,F=0,W=0 and only adds READY once GitHub confirms mergeable == MERGEABLE).null rollup nodes — common with fine-grained PATs), the script recovers the P/F/W counts and the FAIL[…] names from the Actions API (workflow run conclusions) for that commit instead of going silent on the PR. The Actions-API fallback paginates, so a commit with many reruns isn't truncated. Other PR-level signals (U, CR, RR, BLOCKED, merge state) are unaffected.FAIL[…] failing-check names work on both the GraphQL statusCheckRollup path and the Actions-API fallback. On the rollup path they're the check/context names; on the fallback path they're the failing workflow names (the only check signal that path can see). Names are part of the emitted line, so a change in which checks fail is itself a transition that re-notifies.action_required) and start-up failures are counted as pending/failing rather than ignored, so they can't let a premature READY through.WARN per PR after 3 consecutive failures, so a rate-limit or outage is neither hammered nor silently swallowed. A fully-READY PR keeps polling at the normal interval — it's still waiting on a human to merge, not something to ease off watching.gh pr checks <pr> or gh pr view <pr> --json statusCheckRollup.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jedwards1230/claude-plugins --plugin git-tooling2 skills in this plugin
Other plugins' skills for the same job