agentleFS
gspencergooggspencergoog/skills/skills/pr-reviewer/SKILL.md

pr-reviewer

Skill2 starsChanged 3 months agoApache-2.0View on GitHub

Conducts interactive, high-signal code reviews on external GitHub Pull Requests by inspecting diffs in an isolated temporary clone, launching a local review dashboard with GitHub suggestion block editing, and submitting atomic batched reviews with hybrid out-of-diff routing.

15 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 3 are distinctive, and 10 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 10

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow these steps sequentially when tasked with reviewing a pull request:

    line 21
  2. Very specific:

    If no PR is specified, attempt gh pr view --json number,url in the active workspace.

    line 27
  3. Very specific:

    If the user did not specify --mode deep or --mode fast, use ask_question to prompt:

    line 29
  4. Very specific:

    Run review_engine.py to fetch PR title, author, base/head branches, and head commit SHA:

    line 38
  5. Very specific:

    If the target PR belongs to a different repository or branch, create a dedicated temporary directory (/tmp/pr-review-XXXXXX).

    line 43
  6. Very specific:

    If a local clone of the repository exists on disk, pass --reference <path-to-local-repo> to accelerate cloning:

    line 44
  7. Distinctive:

    Verify that all comments are actionable and free of "looks good" filler.

    line 63
  8. Very specific:

    Write candidate findings to <conversation-scratch-dir>/raw_findings.json.

    line 67
  9. Very specific:

    Run diff_parser.py to validate diff hunks and tag findings:

    line 68
  10. Distinctive:

    Stop calling tools and go idle.

    line 92
  11. Very specific:

    If the task exited with status 0 (saved), proceed to Step 5.

    line 94
  12. Very specific:

    If the task exited with status 1 (aborted), clean up the temporary workspace and stop without contacting GitHub.

    line 95
  13. Very specific:

    Run apply_review.py to submit all approved decisions atomically via GitHub API:

    line 102

“Common” is measured: kept by at least 6 in 10 of the 15 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

PR Reviewer Skill

[!CAUTION] READ-ONLY WORKSPACE & USER APPROVAL ENFORCEMENT

  • You MUST NOT modify repository code in the primary workspace.
  • When reviewing external pull requests, perform all checkout and diff operations in an ephemeral temporary directory (/tmp/pr-review-XXXXXX).
  • You MUST launch the review dashboard and wait for the user to submit or abort before any reviews or comments are posted to GitHub.
  • Never promise future work or unverified assumptions in review comments.

This skill automates the workflow for reviewing external GitHub Pull Requests (reviewing someone else's code), giving the human reviewer complete interactive control via a local web dashboard before posting feedback to GitHub.


Workflow

Follow these steps sequentially when tasked with reviewing a pull request:

Step 1: Ingestion & Analysis Depth Selection

  1. Identify the PR:
    • Determine target PR from user prompt (URL, PR number, or head branch).
    • If no PR is specified, attempt gh pr view --json number,url in the active workspace.
  2. Select Analysis Depth:
    • If the user did not specify --mode deep or --mode fast, use ask_question to prompt:
      • Deep Review (Recommended): Multi-perspective analysis covering correctness, security, API soundness, maintainability, and tests with a self-critique pass.
      • Fast Review: Rapid single-pass scan directly on the diff for quick turnaround.

Step 2: Ephemeral Workspace Setup & Diff Hunk Mapping

  1. Resolve PR Metadata: Run review_engine.py to fetch PR title, author, base/head branches, and head commit SHA:
    python3 scripts/review_engine.py --pr <pr-number-or-url> --output-meta <conversation-scratch-dir>/pr_meta.json
  2. Isolate Review Workspace:
    • If the target PR belongs to a different repository or branch, create a dedicated temporary directory (/tmp/pr-review-XXXXXX).
    • If a local clone of the repository exists on disk, pass --reference <path-to-local-repo> to accelerate cloning:
      git clone --reference <path-to-local-repo> https://github.com/<owner>/<repo>.git "$pr_review_dir"
      cd "$pr_review_dir" && gh pr checkout <pr-number>
  3. Map Diff Hunks:
    • Extract the unified diff: git diff -U0 origin/<base_ref>...HEAD > <conversation-scratch-dir>/pr.diff.
    • Parse valid diff hunks using diff_parser.py:
      python3 scripts/diff_parser.py --diff <conversation-scratch-dir>/pr.diff

Step 3: Review Analysis & Hunk Tagging

  1. Analyze Changes against Review Guidelines:
    • Review code modifications following review_guidelines.md.
    • Inspect related context files in the checkout (imported files, interface definitions, test files).
    • Verify that all comments are actionable and free of "looks good" filler.
  2. Draft Concrete Code Suggestions:
    • For proposed line replacements, formulate GitHub suggestion blocks following suggestion_syntax.md.
  3. Structure & Tag Findings:
    • Write candidate findings to <conversation-scratch-dir>/raw_findings.json.
    • Run diff_parser.py to validate diff hunks and tag findings:
      python3 scripts/diff_parser.py \
        --diff <conversation-scratch-dir>/pr.diff \
        --findings <conversation-scratch-dir>/raw_findings.json \
        --repo-dir "$pr_review_dir" \
        --output <conversation-scratch-dir>/review_findings.json
    • Any comments on lines inside diff hunks are marked is_diff_hunk: true.
    • Any comments on unchanged lines outside diff hunks are marked is_diff_hunk: false.

Step 4: Launch Interactive Review Dashboard

  1. Start Dashboard Server as a Background Task: Launch launch_dashboard.py pointing to the conversation scratch directory:
    python3 scripts/launch_dashboard.py \
      --findings-file <conversation-scratch-dir>/review_findings.json \
      --output-file <conversation-scratch-dir>/review_decisions.json
    Set WaitMsBeforeAsync to 1000 so the server runs in the background.
  2. Wait for Completion: Stop calling tools and go idle. The launcher will open the review UI in the user's browser and block until they click "Submit Review to GitHub" or "Abort Review".
  3. Verify Exit Status:
    • If the task exited with status 0 (saved), proceed to Step 5.
    • If the task exited with status 1 (aborted), clean up the temporary workspace and stop without contacting GitHub.

Step 5: Batch Review Submission & Workspace Cleanup

  1. Submit Batched Review: Run apply_review.py to submit all approved decisions atomically via GitHub API:
    python3 scripts/apply_review.py \
      --decisions-file <conversation-scratch-dir>/review_decisions.json
    • Inline comments (is_diff_hunk: true) are posted directly on their respective lines.
    • Broader context comments (is_diff_hunk: false) are appended under ### Broader Context & Non-Diff Observations in the top-level review body.
  2. Clean Up Workspace: Safely remove the temporary checkout directory:
    python3 scripts/review_engine.py --cleanup "$pr_review_dir"
  3. Report to User: Provide the user with a summary card containing the review verdict, approved comments count, and the URL to the submitted GitHub review.

Bundled Resources

  • review_guidelines.md: Rules for actionable, non-defensive code review feedback.
  • suggestion_syntax.md: GitHub markdown suggestion fence syntax and line range rules.
  • scripts/diff_parser.py: Unified diff parser and diff hunk line validator.
  • scripts/review_engine.py: PR metadata resolver, ephemeral workspace manager, and diff extractor.
  • scripts/launch_dashboard.py: Local HTTP server for the interactive review dashboard.
  • assets/review_dashboard.html: Interactive dark-themed single-page review dashboard.
  • scripts/apply_review.py: Submits batched review payloads to GitHub Reviews API with hybrid comment routing.

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.