agentleFS
molonmolon/hunkwise/.claude/skills/copilot-review-loop/SKILL.md

copilot-review-loop

Skill87 starsChanged 8 months agoMITView on GitHub

This skill should be used when the user asks to "handle copilot review", "run copilot review loop", "fix copilot issues", "process copilot feedback", "resolve copilot comments", "request copilot review", "address copilot review comments", or says "Copilot 又有新的问题" / "帮我处理 Copilot Review" / "跑一下 Copilot Review". Automatically detects the current PR stage (never reviewed, in-progress, has comments, or clean) and runs the full fix-request-wait loop until Copilot raises no new issues.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. xpepper/pr-review-agent-skill★ 6same name
    2. Hermione-Granger-1176/artifacts★ 2same name
    3. sourcehawk/feature-dev-workflow★ 2same name
    4. moreh-dev/runes★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use GraphQL (NOT REST — REST in_reply_to_id misses intra-thread replies).

    line 47
  2. Distinctive:

    Read the full comment body

    line 59
  3. Distinctive:

    Read the relevant file/function in the codebase

    line 60
  4. Distinctive:

    After evaluating a comment, identify the class of problem it reveals.

    line 75
  5. Distinctive:

    Follow the data flow: if a value is mishandled in one function, trace all callers and consumers of that value

    line 78
  6. Very specific:

    Verify cross-component consistency: if two modules must agree on the same logic (e.g., both computing isDeleted), verify both sides match

    line 79
  7. Distinctive:

    Audit related docs and comments: if one comment is stale due to a code change, check all comments describing the same behavior

    line 80
  8. Very specific:

    Follow test-driven development.

    line 88
  9. Distinctive:

    Always run unit tests after fixing.

    line 98
  10. Distinctive:

    Never commit if tests fail.

    line 104
  11. Very specific:

    Commit with a descriptive message.

    line 108
  12. Very specific:

    Add copilot-pull-request-reviewer[bot] to requested reviewers via gh api.

    line 122
  13. Distinctive:

    After review completes -> back to Step 1.

    line 130
  14. Distinctive:

    Poll timeout: If polling times out (20 attempts), re-request review and restart the poll — do not stop.

    line 137
  15. Distinctive:

    Commit/push failures: Check git status, resolve conflicts or issues, then retry.

    line 139

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Copilot Review Loop

Autonomously run the fix -> request -> wait -> check cycle on a PR until Copilot raises no new issues.

For all gh api command snippets, consult references/gh-commands.md.

Stage Detection (Always Start Here)

Determine the current PR state before taking any action. Check pending reviewers, review history, and unhandled threads.

Decision table:

StateAction
Copilot in requested_reviewersCurrently reviewing -> skip to Wait for Review
Not pending + no reviews everNever reviewed -> Request & Wait
Not pending + reviews exist + 0 unhandledAll clean -> Done
Not pending + reviews exist + unhandled > 0Has open issues -> enter Fix Loop

The Loop

LOOP:
  Step 1 — Find unhandled threads (if none -> Request & Wait)
  Step 2 — Evaluate & proactive scan
  Step 3 — Implement fixes
  Step 4 — Run tests
  Step 5 — Commit and push
  Step 6 — Reply to each comment thread
  Step 7 — Resolve all handled threads

Request & Wait:
  Step 8 — Request Copilot review
  Step 9 — Poll requested_reviewers until Copilot finishes
  -> back to Step 1

  Step 1 finds 0 unhandled -> DONE

Step 1: Find Unhandled Threads

Use GraphQL (NOT REST — REST in_reply_to_id misses intra-thread replies).

"Unhandled" = not resolved AND only 1 comment (no reply yet).

See references/gh-commands.md for the query. UNHANDLED: 0 -> proceed to Request & Wait.

Step 2: Evaluate & Proactive Scan

Evaluate each comment

For each unhandled comment, before touching code:

  1. Read the full comment body
  2. Read the relevant file/function in the codebase
  3. Assess: is the suggestion technically correct for this codebase?
  4. Decide: fix, push back, or note as already addressed

Evaluation criteria (be skeptical):

  • Does the suggestion respect the codebase's architectural constraints and intentional design decisions?
  • Could it break existing tests or observable behavior?
  • Does the reviewer have full context? (e.g., intentional trade-offs, async queue semantics, platform-specific behavior)
  • Is this an actual bug, or a misunderstanding of intent?

Push back with technical reasoning when the suggestion is wrong. Do not implement blindly.

Proactive similar-issue scan

After evaluating a comment, identify the class of problem it reveals. Then use understanding of the codebase architecture to find all similar issues — not just the one flagged:

  • Trace the root assumption: identify what incorrect assumption caused the bug, then locate every other place that assumption appears
  • Follow the data flow: if a value is mishandled in one function, trace all callers and consumers of that value
  • Verify cross-component consistency: if two modules must agree on the same logic (e.g., both computing isDeleted), verify both sides match
  • Audit related docs and comments: if one comment is stale due to a code change, check all comments describing the same behavior

This requires deep comprehension of the code, not mechanical grep. Read the relevant modules, understand the invariants, then verify they hold everywhere.

Fix all instances proactively. Group same-class fixes in one commit.

Step 3: Implement Fixes (TDD)

Follow test-driven development. Invoke the superpowers:test-driven-development skill for the full TDD workflow:

  1. Write or update tests first — add integration/unit tests that cover the expected behavior before implementing the fix. Run them to confirm they fail for the right reason.
  2. Implement the fix — make minimal, targeted changes per comment.
  3. Run tests — verify the new tests pass and no existing tests break.

Group same-class fixes together; do not batch unrelated fixes.

Step 4: Run Tests

Always run unit tests after fixing. Run integration tests when:

  • The fix changes observable behavior (not just comments/docs)
  • The fix touches state management, file watching, or command logic
  • Any doubt about whether it could break an integration scenario

Never commit if tests fail.

Step 5: Commit and Push

Commit with a descriptive message. Include Co-Authored-By with the current model name. Push immediately.

Step 6: Reply to Each Comment Thread

Reply inline using comments/{id}/replies (NOT top-level PR comment). Include the commit SHA and a brief description. For pushed-back comments, explain why no change was made.

Step 7: Resolve All Handled Threads

Resolve all unresolved threads via GraphQL mutation. Only resolve threads that have been addressed.

Request & Wait

Step 8: Request Copilot Review

Add copilot-pull-request-reviewer[bot] to requested reviewers via gh api.

Step 9: Poll for Completion

CRITICAL: Poll the requested_reviewers endpoint until Copilot is no longer listed. Do NOT use review count — GitHub sometimes updates an existing review instead of creating a new one, causing count-based polling to hang indefinitely.

Log each poll attempt with timestamp and status. Timeout after 20 attempts (~10 minutes). See references/gh-commands.md for the poll script.

After review completes -> back to Step 1. If 0 unhandled -> DONE.

Error Handling & Resilience

The loop must never stop due to transient errors. Apply these rules:

  • gh api failures: Retry up to 3 times with 10-second intervals before giving up on a single API call.
  • Poll timeout: If polling times out (20 attempts), re-request review and restart the poll — do not stop.
  • Test failures: Diagnose and fix, then re-run. Never abandon the loop due to a failing test.
  • Commit/push failures: Check git status, resolve conflicts or issues, then retry.
  • Any unexpected error: Log the error, attempt recovery, and continue the loop. Only stop if the same error persists after 3 retries or if the error is clearly unrecoverable (e.g., repo deleted, auth expired).

The goal is autonomous completion — the user should be able to walk away and find the loop finished.

Key Rules

  • TDD first — write or update tests before implementing fixes; confirm they fail, then implement
  • Evaluate before implementing — read the code first; push back with reasoning when the reviewer is wrong
  • Scan by understanding, not grep — trace assumptions and data flow to find the same class of bug across the codebase
  • Tests must pass — never commit broken code; run integration tests for behavioral changes
  • Reply in thread — use comments/{id}/replies, never top-level PR comments
  • Resolve after replying — only resolve threads already addressed
  • GraphQL for thread detection — REST misses intra-thread replies
  • Poll requested_reviewers, not review count — prevents stuck loops
  • Never stop on transient errors — retry API calls, re-request reviews, recover and continue

References

  • references/gh-commands.md — All gh api command snippets: check reviewers, find threads, poll completion, reply, resolve

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.