Introduction¶
After opening a PR, the usual rhythm is: waiting for CI to turn red before digging through Actions logs, going through inline comments left by reviewers one by one, and encountering merge conflicts after the main branch advances. These tasks are independent of each other, but they all require switching back and forth between your IDE and GitHub.
If you want the Agent to follow a fixed workflow to pull status, fix issues, push, and re-check, rather than verbally repeating “check the checks first, then fix the comments” every time, you can bake the workflow into a Skill. Here we introduce babysitting-pr from the awesome-cursor-skills repository: while a PR is still open, it monitors CI failures, review comments, and merge conflicts, and automatically fixes them within the allowed rules to keep the PR as merge-ready as possible.
What Is This¶
babysitting-pr is a reusable SKILL.md instruction for Cursor Agent, belonging to resources/babysitting-pr in the awesome-cursor-skills project. The official description is: Monitor a pull request for CI failures, review comments, and merge conflicts — then fix them automatically. The applicable scenario is when the user already has an open PR and wants the Agent to continuously monitor and fix it to keep the PR in a mergeable state.
Unlike a one-off “help me fix the CI” ad-hoc conversation, this Skill defines a closed loop: fetching data from gh pr view, reproducing and fixing locally based on failure type, handling reviews, resolving conflicts, pushing, then running gh pr checks --watch, with a maximum of three fix-push-check rounds, and clear instructions on when to stop and report to the user.
Core Functionality¶
Based on the official Steps and Loop Behavior, the verified capabilities include:
- Fetch the full PR overview: Use GitHub CLI to read number, title, state, mergeable, reviewDecision, statusCheckRollup, comments, and reviews, and separately check
mergeStateStatusto determine merge conflict status. - CI status and logs: Locate failed items based on
statusCheckRollupandgh pr checks; rungh run view <run-id> --log-failedon failed runs to analyze logs. - Fix by failure type: The Skill provides guidance for lint (e.g.,
npm run lint -- --fix), type checks (npx tsc --noEmit), tests (running the failing suite locally), and builds (npm run build). After fixing, rungit add, commit, andpush. - Review comments: Fetch them via
gh api repos/{owner}/{repo}/pulls/{pr}/comments; for clearly actionable items (spelling, naming, empty checks, style, etc.), fix the code directly; skip items involving design trade-offs or requiring clarification, and explain to the user. - Merge conflicts: Run
git fetch origin mainandgit merge origin/main, read both sides’ diffs to resolve conflicts; ask the user for ambiguous cases, and commit and push after resolution. - Re-check and report: After pushing, use
gh pr checks --watchto wait for CI; if there are still failures, return to the fix step, with a total limit of 3 rounds; finally summarize which checks were fixed, which comments were addressed, whether conflicts were resolved, and whether the PR is still mergeable.
The loop logic can be summarized as: Check PR → Find issues → Fix issues → Push → Re-check → Repeat. It considers the PR merge-ready when all checks pass, there are no pending comments, and no conflicts; or it stops and reports when three rounds are not enough or when fixes require design decisions.
Installation and Activation¶
According to awesome-cursor-skills: Skills are reusable SKILL.md files placed in the personal directory .cursor/skills/ or the project directory, and are automatically discovered by Cursor Agent. The babysitting-pr source files are located at the repository path resources/babysitting-pr (including SKILL.md).
Typical activation method:
- Get the Skill files from
resources/babysitting-prin the official repository (or the entire directory, depending on the actual structure in the repository). - Copy them to the local machine or the project’s
.cursor/skills/directory (the directory name can align with the skill namebabysitting-prfor easier identification). - Open the corresponding repository in Cursor, and tell the Agent that the PR is open and you want to maintain a mergeable state according to babysitting-pr; when the Agent matches this Skill, it will follow the Steps in the document.
Prerequisites: This Skill assumes that GitHub CLI (gh) is installed and authenticated, and that you have push permissions for the target repository. The documentation does not separately explain installation differences for Codex CLI or Claude Code, so we won’t cover them here.
Typical Usage¶
When a PR has been created and you want the Agent to “take over” the pre-merge state, you can have the Agent follow the command sequence in the Skill. The following snippets come from the official documentation, showing key checkpoints (replace {owner}, {repo}, {pr}, <run-id> with actual values).
View PR and conflict-related status:
gh pr view --json number,title,state,mergeable,reviewDecision,statusCheckRollup,comments,reviews
gh pr view --json mergeStateStatus
List CI checks:
gh pr checks
Fetch failed job logs (when fixing CI):
gh run view <run-id> --log-failed
Fetch PR review comments:
gh api repos/{owner}/{repo}/pulls/{pr}/comments
Example of pushing after fixes:
git add -A && git commit -m "fix: resolve CI failures" && git push
Wait and re-check after pushing:
gh pr checks --watch
If everything is ready, the Skill suggests using gh pr ready to mark the PR as ready for review. When CI is still queued/pending, wait for it to complete before analyzing failures to avoid misjudgment.
Applicable Scenarios and Notes¶
Suitable for: You have already opened a PR and are willing to let the Agent repeatedly fix CI under clear rules, implement unambiguous review comments, handle conflicts with main, and summarize the items still blocking the merge.
Limitations and constraints (official Notes):
- Do not force-push to shared PR branches.
- Do not change assertions just to pass tests unless the behavior change is intentional.
- Do not force “resolve” uncertain review comments; skip them and inform the user.
- The fix-push-check loop is limited to 3 times to avoid infinite retries.
- Fixes requiring design decisions should stop and ask the user instead of making decisions unilaterally.
Compared with parallel-ci-triage (dispatching multiple failed jobs in parallel) in the same repository, babysitting-pr focuses more on single-PR end-to-end babysitting: status, comments, conflicts, and re-checking are written into one pipeline, suitable for “I want this one PR to be merge-ready” rather than “just chewing logs in parallel”.
Conclusion¶
babysitting-pr turns “check PR status → fix CI / comments / conflicts → push → re-check” into fixed steps that the Agent can execute, with limits on rounds and boundaries for human intervention.
If you frequently deal with the above chores during the open PR stage, you can place this Skill in .cursor/skills/, point to the current PR in the conversation, and let the Agent maintain a mergeable state according to the document.
Official URL: https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/babysitting-pr