Skip to content
Agentmart
Submit a tool

babysit-pr

Monitor and fix automated review comments (Copilot, SonarCloud) and CI failures on the current branch's PR.

Skill by thrawn01

IndexedMIT★ 11
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/thrawn01-babysit-pr

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Monitor and fix automated review comments (Copilot, SonarCloud) and CI failures on the current branch's PR. Gets the PR into a human-reviewable state autonomously. Use when the user says 'babysit this PR', 'fix CI', 'handle the automated reviews', or 'get this PR green'.

Use cases: devops

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Shell scripts

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/babysit-pr

What's inside

Skill name
babysit-pr
Description
Monitor and fix automated review comments (Copilot, SonarCloud) and CI failures on the current branch's PR. Gets the PR into a human-reviewable state autonomously. Use when the user says 'babysit this PR', 'fix CI', 'handle the automated reviews', or 'get this PR green'.
License
MIT
Instructions
195 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts
  • Instructions call the network

Agent Skills spec issues

  • allowed-tools: must be a space-separated string

Files (3)

  • SKILL.md
  • fetch-failed-logs.sh · scripts/
  • pr-status.sh · scripts/

SKILL.md (first lines)

# Babysit PR

You are an autonomous PR agent. Your goal is to get the current branch's PR into a human-reviewable state by fixing CI failures and addressing automated review comments (Copilot and SonarCloud). Do not stop until either the PR is fully green with no unresolved bot review threads, or you hit a problem requiring human input.

## Assess PR Status

Run the status script to get a snapshot of CI checks and bot review threads:

```bash
${CLAUDE_SKILL_DIR}/scripts/pr-status.sh $ARGUMENTS
```

Fallback: `~/.claude/skills/babysit-pr/scripts/pr-status.sh $ARGUMENTS`

The script accepts an optional PR number argument. If `$ARGUMENTS` is empty, it auto-detects from the current branch.

Parse the JSON output and determine the current state:

- **All checks passed + no unresolved bot threads** → Skip to Final Check
- **Checks still pending/in-progress** → Start polling CI, but also immediately fix any Copilot or SonarCloud reviews that have already been posted — do not wait for CI to finish before addressing bot comments
- **Checks failed** → Go to Fix CI Failures
- **Checks passed but unresolved bot threads** → Go to Resolve SonarCloud / Resolve Copilot

## Poll CI

Use the `/loop` skill (a built-in Claude Code skill that runs a prompt on a recurring interval) to poll for CI completion. Invoke it as `/loop 5m` with the polling logic below. On each iteration, run `pr-status.sh` and check:

- If checks are still pending, report which checks are running and wait for the next iteration.
- If a check has failed, stop the loop and proceed to Fix CI Failures.
- If all checks have passed, stop the loop and proceed to Resolve SonarCloud / Resolve Copilot (if any unresolved threads remain).

**Stale review detection**: After each push, record the UTC time. The `pr-status.sh` output includes `copilot.latest_review_at` — only act on Copilot reviews where this timestamp is newer than your last push time. Copilot and SonarCloud re-analyze after each push, so acting on stale comments from a previous push wastes effort. If the review is current (posted after the latest push), address it immediately — do not wait for CI to finish first.

## Fix CI Failures

For each failed check from the status output:

### Fetch the logs

```bash
${CLAUDE_SKILL_DIR}/scripts/fetch-failed-logs.sh "<check-name>" "<check-link>"
```

Fallback: `~/.claude/skills/babysit-pr/scripts/fetch-failed-logs.sh`

### Triage: flaky vs stale branch vs real failure

Before attempting a fix, determine the failure type:

1. **Flaky test**: Compare the failing test against files changed in this PR (`git diff --name-only origin/master...HEAD`). If the failing test is unrelated to any changed file, it is likely flaky.
   - Retry the failed job:
     - **GitHub Actions**: Extract the run ID from the check `link` field (e.g., `runs/12345`) and run `gh run rerun <run-id> --failed`
     - **Buildkite**: Parse org, pipeline, and build number from the check `link` field (URL format: `buildkite.com/<org>/<pipeline>/builds/<build>`). Then fetch the build to get the failed job UUID:
       ```bash
       source ~/env.source
       # Get failed job ID from build
       JOB_ID=$(curl -sH "Authorization: Bearer $BUILDKITE_API_TOKEN" \
         "https://api.buildkite.com/v2/organizations/<org>/pipelines/<pipeline>/builds/<build>" \
         | jq -r '.jobs[] | select(.state == "failed") | .id' | head -1)
       # Retry it
       curl -s -X PUT -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
         "https://api.buildkite.com/v2/organizations/<org>/pipelines/<pipeline>/builds/<build>/jobs/$JOB_ID/retry"
       ```
   - Return to Poll CI to wait for the retry result.

2. **Stale branch**: If the failure seems unrelated to PR changes, check how far behind master the branch is:
   ```bash
   git fetch origin master && git rev-list --count HEAD..origin/master
   ```
   If more than 50 commits behind, rebase on master:
   ```bash
   git rebase origin/master
   ```
   If the rebase has conflicts, abort it (`git rebase --abort`) and stop — report the conflicts to the user. Do not attempt to auto-resolve rebase conflicts from a stale branch update.
   If the rebase succeeds cleanly, force-push with lease (`git push --force-with-lease`) and return to Poll CI. Note: this is the **only** case where force-push is permitted — never force-push in any other situation.

3. **Real failure**: The failure is related to files changed in this PR. Proceed to fix it.

### Fix the failure

- Analyze the log output to identify the root cause (failed assertion, compile error, lint violation, etc.)
- Fix the code
- **Always verify locally before pushing**: identify an appropriate local command to run based on the failure type and the project structure. Run it and confirm it passes.
- If the same failure recurs after a fix attempt, stop and explain the blocker to the user rather than looping.

### Commit and push

1. Stage only the files you changed
2. Commit with a clear message describing the fix (no Co-Authored-By, no Claude attribution)
3. Push the branch
4. Record the push time (UTC) — needed for stale review detection
5. Return to Poll CI

## Resolve SonarCloud Issues

Handle SonarCloud before Copilot — Sonar fixes often require code changes that Copilot would then re-review.

SonarCloud feedback appears in two places. Fetch both:

**Quality gate comment** (overall pass/fail):
```bash
gh api "repos/<owner>/<repo>/issues/<pr>/comments" \
  --jq '.[] | select(.user.login == "sonarqubecloud[bot]") | .body'
```

**Inline code comments** (specific file/line issues):
```bash
gh api "repos/<owner>/<repo>/pulls/<pr>/comments" \
  --jq '.[] | select(.user.login == "sonarqubecloud[bot]") | {path, line, body}'
```

Derive `<owner>/<repo>` from `gh repo view --json owner,name`.

For each issue:
- **Duplicated code** → Determine if the duplication is intentional:
  - **Test files**: Duplicated code in tests is expected (tests follow explicit patterns and avoid DRY).
  - **New version / legacy copy**: If the duplicated code exists because a new version was created as a clean copy of legacy code (to avoid modifying the legacy path), the duplication is intentional.
  - If the duplication is intentional, add the `skip-sonar-scan` label to the PR and move on:
    ```bash

From thrawn01/claude-dotfiles, MIT.

More from thrawn01/claude-dotfiles

Signals

Stars
11
Forks
0
Open issues
0
Last commit (this folder)
May 29, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from thrawn01

Cite this page

babysit-pr skill. Agent Mart. https://agentmart.dev/skills/thrawn01-babysit-pr (last updated 2026-10-24)