skills/engineering/pr-fix-loop/SKILL.md
Iteratively detect and fix everything outstanding on a GitHub PR — CI failures, bot review findings, and human inline comments — then push, wait for CI, and re-scan until nothing actionable remains. Use when asked to "fix the remaining issues on a PR", "address PR feedback", "loop until CI is green", "auto-fix PR comments", "run a final fix pass before merge", or 检查 PR 状态和 comment 自动修复 / 修到没有新 finding 为止. Author-side by default; runs on any PR branch you have push access to, including PRs that already look ready to merge.
npx skillsauth add arctuition/skills pr-fix-loopInstall 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.
Drive a PR to "done" by looping: scan for findings → triage → fix the clear ones → quick-check locally → commit → reply → push → wait for CI → re-scan. Stop when CI is green and no actionable finding remains, or when something needs your call.
A PR that is already green, mergeable, or marked ready to merge can still enter this loop when the user asks for a final fix pass. Do not skip preflight or scans just because the current PR state looks clean; run the same CI/comment/bot scan once, then stop immediately if nothing actionable is found.
This is the author's side of code review: instead of producing findings, it closes them out. Every
gh command the loop needs — repo context, CI status and checks --watch, the GraphQL review-thread
query, the reply API, CI-log fetch, and the per-round commit — lives in
references/gh-loop.md.
Prerequisite: gh installed and authenticated (gh auth status).
addressed in <sha>.gh pr checks --watch.OWNER_REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
ME=$(gh api user --jq .login)
Check push permission (gh api repos/$OWNER_REPO --jq .permissions.push). If false, run in
advise-only mode: do steps 1–2 every pass, print the fixes you would make, never
commit/push/reply. Otherwise gh pr checkout <pr> and continue. Commands: gh-loop.md.
Note who you are relative to the PR: you may be the author, or (as on real review PRs) the
reviewer stepping in to fix — both are fine, replies just post under $ME.
Refresh HEAD_SHA each pass (others may have pushed). Scan exactly these three; ignore
top-level review bodies and issue comments (too discussion-heavy to act on safely):
gh pr checks <pr> --json name,state,bucket,link. Any bucket: fail.*[bot] logins plus connector accounts such as chatgpt-codex-connector, claude,
coderabbitai, and copilot. Do not require a [bot] suffix. Their finding bodies usually
carry a P0–P3 badge.Use the GraphQL reviewThreads query (not REST) so you get isResolved and the full reply chain.
Per the dedup rule (below), drop threads that are resolved or already carry our addressed in <sha>
reply at/under HEAD. Do not drop unresolved bot-like findings because the PR is mergeable, CI is
green, review decision is empty, or a bot check was skipped. Commands:
gh-loop.md.
For every candidate, sort into exactly one bucket. Only bucket ① is ever auto-applied.
When unsure between ① and ②, it is ②. Fixing the wrong thing on a shared PR is worse than asking.
On the first round, before any push:
After the first push, run autonomously — no gate per round — except when a new needs-confirm finding appears in a later round (stop guard below).
Read each target file in full context before editing (the inline comment's line may be stale).
Make the smallest change that genuinely resolves the finding — not a change that merely makes the
comment look addressed. For a CI failure, fix the root cause; don't paper over a failing test.
Slow external CI (e.g. Jenkins) makes blind pushes expensive — catch what you can locally first.
Detect the repo's commands (e.g. package.json scripts, Makefile, turbo/pnpm/nx) and run,
scoped to what you touched where possible:
tsc --noEmit, pnpm typecheck)eslint <changed files>, pnpm lint)If a command can't be discovered, say so and skip it — don't invent one. Only proceed to commit when the checks you could run pass. If a local check fails, fix it before pushing (it counts as the same round, not a new finding).
One commit per round. Stage only the files you changed this round, by path — never git add -A,
., or -a; on a shared branch, sweeping up someone else's work is the worst failure mode. Message summarizes
the findings addressed; include the co-author trailer. Then capture the new sha and reply on each
addressed thread with addressed in <sha>: <one line> — do not resolve the thread.
Commands: gh-loop.md and
reply.
git push # plain push; never force-push a shared branch
gh pr checks <pr> --watch --interval 30 # blocks until all checks finish
Then go to step 1 and re-scan (CI result + any new comments that arrived meanwhile).
End the loop and report when any fires:
link gh
can't fetch). Surface the link and stop for the user to paste the relevant log.No local state file. Every round re-scans from scratch; the markers live on GitHub, so the loop survives interruption and re-invocation:
isResolved, or its last comment is $ME's addressed in <sha> with
<sha> an ancestor of HEAD and no later reply reopening it.bucket: fail at the current HEAD.Each round, print a compact status: round number, what was fixed + pushed (with sha), what's in buckets ② / ③, and the CI verdict you're now waiting on.
On stop, render a summary:
## PR fix loop — <done | stopped: <reason>>
**Rounds**: <n> **CI**: <green | failing: <check>>
**Fixed**: <count> — <one line each, file + sha>
**Needs your call (②)**: <list, or none>
**Skipped (③)**: <list + reason, or none>
**Still open**: <anything left and why>
testing
Analyze committed changes on the current local branch, propose a dependency-ordered stacked PR plan, then after explicit approval create multiple upstream stacked PRs. Use when the user asks to "stack this PR", "create a PR stack", "split this branch into PRs", "split PR", "拆 PR", "split into reviewable PRs", or says a branch/PR is too big to review.
testing
Research what real people have actually been saying about a topic over a recent time window (default last 30 days) across Reddit, Hacker News, X, YouTube, and GitHub — then synthesize an engagement-weighted, cited brief. Use when the user asks: what's new/recent buzz/trending with X, community sentiment on X, what people are saying about X lately, last30days, past week/last N days, 最近大家在聊什么 / 最近 X 有什么新动态 / 时效性调研 / 选型/产品调研. Complements deep-research (fact-checking) by focusing on recency + community signal rather than authoritative sources.
data-ai
Wrap up the work you just did and open a PR for it — branch off main/master if needed, commit only the changes you made, push, open a pull request (following .github/PULL_REQUEST_TEMPLATE.md when present), and open the PR in the browser. Targets the `upstream` remote's default branch as the base when an `upstream` remote exists, otherwise `origin`. Use when the user says "sign off", "signoff", "ship it", "open a PR for this", "commit and PR", or "wrap this up".
development
Produce a single-file HTML "thread recap" artifact that captures what was discussed in an agent / pairing / chat conversation — the questions explored, the decisions made and their tradeoffs, the dead ends we walked into, the open questions left, and the artifacts produced — so a teammate who wasn't in the room can pick up the context. Use this skill whenever the user asks to summarize a conversation/thread/session, mentions sharing a thread with colleagues, says things like "把这个对话总结一下", "share this thread with the team", "write up what we decided", "decision log for this conversation", "document the tradeoffs we made", "recap of our pairing session", or wants to hand off a Claude/ChatGPT/agent transcript as context. Trigger even when "HTML" isn't said — the artifact format is the whole point. Input can be the current session's own conversation context OR a transcript the user pastes in.