plugins/pr-sweep/skills/pr-sweep/SKILL.md
--- name: pr-sweep description: Use when you want to sweep all open pull requests across all repos, triage their status, run code reviews on unreviewed PRs, merge what's ready, fix quick blockers, and produce a full status report. Trigger when the user says "check my PRs", "close out open PRs", "what's the status of my PRs", "sweep my PRs", "PR sweep", "pull request sweep", or wants a cross-repo PR status report. Future: pairs with the loop skill for ongoing automated PR management. --- # Pull
npx skillsauth add harnessprotocol/harness-kit plugins/pr-sweep/skills/pr-sweepInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A cross-repo PR sweep: discover → enrich → triage → review → act → report.
Announce at start: "I'm using the pr-sweep skill to sweep all open PRs."
gh search prs \
--author @me \
--state open \
--json number,title,url,isDraft,repository,headRefName,baseRefName,reviewDecision \
--limit 100
Parse the result into a working list. Skip drafts immediately — they're not ready for action.
If you have more than 20 non-draft PRs, report the count and ask the user if they want to proceed or filter by repo.
For each non-draft PR, fetch CI and merge state in parallel (dispatch subagents or batch calls):
# CI status
gh pr checks <number> --repo <owner/repo> --json name,state,conclusion
# Merge state (up-to-date, behind, conflicting, etc.)
gh pr view <number> --repo <owner/repo> --json mergeStateStatus,mergeable
Build a status object per PR:
{
repo, number, title, url,
ciStatus: passing | failing | pending | none,
mergeState: clean | behind | dirty | blocked,
reviewDecision: APPROVED | CHANGES_REQUESTED | REVIEW_REQUIRED | null
}
Classify each PR into one category (in priority order — first match wins):
| Category | Condition |
|----------|-----------|
| MERGE_READY | CI passing, review approved or not required, merge state clean |
| PENDING_CI | CI still running, everything else clean |
| NEEDS_REVIEW | No reviews yet (reviewDecision null or REVIEW_REQUIRED) |
| BEHIND_BASE | Merge state is behind |
| CI_FAILING | CI has failed conclusions |
| CHANGES_REQUESTED | Reviewer has requested changes |
| CONFLICTING | Merge state is dirty (merge conflicts) |
| BLOCKED | Anything else preventing merge |
Show the triage table to the user and wait for confirmation before taking any action:
PR Triage
─────────────────────────────────────────────────────────────
MERGE_READY owner/repo #42 feat: add caching layer
NEEDS_REVIEW owner/repo #38 fix: auth token refresh
BEHIND_BASE other/repo #11 refactor: split service
CI_FAILING other/repo #9 feat: new export format
CHANGES_REQUESTED repo #7 fix: race condition
─────────────────────────────────────────────────────────────
Plan: merge 1, review 1, rebase 1, attempt CI fix 1, flag 1.
Proceed?
Wait for the user to confirm before proceeding to Step 4. This is important — the sweep can merge multiple PRs and rebase branches across repos, so the user should know what's coming.
For each NEEDS_REVIEW PR, invoke the review skill to review the changes.
If there are multiple NEEDS_REVIEW PRs: dispatch code review subagents in parallel — one per PR — then collect all results before proceeding to Step 5. This is the most expensive step; parallelizing keeps total time reasonable.
The review covers:
## Code Review, ## Standards, or ## Gotchas sectionsEach review produces:
[owner/repo #N] Code Review
MUST FIX: <issue> — file:line
SUGGESTION: <issue>
CLEAN — no blocking issues
After review, re-classify:
MERGE_READY (if CI also passing)BLOCKED (with review notes)Work through categories in this order:
gh pr merge <number> --repo <owner/repo> --squash --delete-branch
gh pr checkout <number> --repo <owner/repo>
BASE=$(gh pr view <number> --repo <owner/repo> --json baseRefName --jq '.baseRefName')
git fetch origin $BASE
git rebase origin/$BASE
git push --force-with-lease
Then re-check CI. If CI passes and no other blockers → merge. If CI fails → reclassify as CI_FAILING.
gh run view --log-failed --repo <owner/repo>Poll using --watch with a timeout, then check the result:
gh pr checks <number> --repo <owner/repo> --watch --fail-fast
If still pending or if the command times out, leave as-is and flag in the report.
These require human judgment. Note them clearly in the report — no auto-action.
After all actions complete, produce a full report:
PR Sweep Complete
══════════════════════════════════════════════════════════════
MERGED (2)
✓ owner/repo #42 feat: add caching layer
✓ owner/repo #38 fix: auth token refresh — reviewed, no blockers
REBASED (1)
↺ other/repo #11 refactor: split service — rebased on main, CI running
FIXED & MERGED (1)
✓ other/repo #9 feat: new export format — lint fix applied, merged
NEEDS YOUR ATTENTION (2)
✗ repo #7 fix: race condition — CHANGES_REQUESTED by @alice
Action needed: address review feedback
✗ repo #5 feat: dashboard — CI failing (complex: flaky integration test)
Action needed: investigate test flakiness before merging
CODE REVIEW FINDINGS
repo #38 — SUGGESTION: consider extracting token refresh logic to a helper
══════════════════════════════════════════════════════════════
Merged: 3 | Pending: 1 | Needs attention: 2
Surface suggestions from code reviews in the report even if they weren't blocking — they may inform follow-up work.
Never:
Always:
--delete-branch)This skill is designed to work with /loop for ongoing PR babysitting:
/loop 30m /pr-sweep
This is not yet recommended due to token costs, but the skill is designed to be idempotent — running it multiple times is safe. Already-merged PRs won't appear in the next sweep.
tools
Harness Kit documentation — installation, plugin catalog, creating plugins, cross-harness setup, architecture, and FAQ. Use when working with or configuring harness-kit plugins, understanding the plugin/skill system, installing slash commands, setting up AI coding tool configuration, answering questions about the plugin marketplace, writing SKILL.md files, using harness.yaml, or integrating with Copilot, Cursor, or Codex. Do NOT use for general Claude Code questions unrelated to harness-kit.
development
Use when user invokes /stats or asks about Claude Code usage, token consumption, session history, model distribution, or activity patterns. Generates an interactive HTML dashboard with charts and tables, auto-opens in browser. Also triggers on "how much have I used Claude", "show my usage", "token usage", "session stats", "usage report", "usage dashboard". Do NOT use for API billing or cost estimation — token counts are not costs.
development
Use when user invokes /review to review code changes. Also triggers on "review my code", "check this PR", "look at my changes". Accepts a PR number (e.g. /review 123), a path filter (e.g. /review src/auth/), or no argument (reviews current branch vs base). Produces structured per-file review with severity labels, cross-file analysis, and an overall verdict. Do NOT use for explaining what code does — use /explain instead.
testing
Use when user invokes /research command with any source — URL, GitHub repo, YouTube video, podcast, Reddit post, academic paper, documentation page, product site, local file, or empty. Processes and indexes research materials with raw source preservation and topic-level synthesis coalescing. Do NOT use for quick factual questions — use /explain instead.