agentleFS
TanayK07TanayK07/pr-proof/skills/pr-validation/SKILL.md

pr-validation

Skill3 starsChanged 2 months agoApache-2.0View on GitHub

Use when a PR has review comments that need to be triaged, validated, and addressed end-to-end. Creates an isolated worktree, analyzes every comment in parallel with deep research (web, official docs, codebase patterns), presents actionable verdicts for approval, then applies approved changes and replies to each comment. Use when asked to "handle PR comments", "address review feedback", "respond to PR review", "validate and fix PR comments", "triage PR feedback", or given a PR URL/number with review comments to process.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. openlit/openlit★ 3.1ksame 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 repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Core principle: No changes without evidence.

    line 22
  2. Very specific:

    Create an isolated worktree, then check out the PR branch inside it.

    line 65
  3. Distinctive:

    Read these if they exist (don't fail if missing):

    line 76
  4. Distinctive:

    Present the full report using AskUserQuestion: Wait for approval before ANY action.

    line 300
  5. Distinctive:

    Run the project's test suite after changes.

    line 327
  6. Distinctive:

    Commit changes with a clear message referencing the review (e.g., "Address PR review feedback")

    line 348

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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 Validation

Overview

End-to-end PR review comment handler. Isolates work in a worktree, analyzes every comment in parallel using deep research (web, docs, codebase), produces evidence-based verdicts with actionables, and — after your approval — applies fixes and replies to each comment in a natural, human tone.

Core principle: No changes without evidence. No replies without your sign-off.

When to Use

  • PR has review comments you need to address
  • Want to validate reviewer claims before blindly implementing
  • Need to respond to comments with evidence, not gut feelings
  • Want parallel analysis to handle many comments efficiently
  • Asked to "handle PR feedback", "address review", "respond to comments"

When NOT to use:

  • Writing a PR review yourself (use pr-review)
  • Simple typo/formatting-only feedback (just fix it)
  • PR has no review comments yet

Quick Reference

PhaseWhat HappensTools Used
0: SetupWorktree + PR contextgit worktree, gh api
1: FetchComments, diff, threadsgh api (REST + GraphQL)
2: AnalyzeParallel agents per file-groupAgent, Grep, Read, WebSearch (+ docs MCP if available)
3: ReportActionable verdicts presentedAskUserQuestion
4: ExecuteApply fixes + reply to commentsEdit, gh api

Phase 0: Setup

Identify the PR

Accept PR number, URL, or auto-detect from current branch:

# Auto-detect from current branch
gh pr view --json number,baseRefName,headRefName,url,title,body,author

# Or from explicit input
gh pr view <NUMBER_OR_URL> --json number,baseRefName,headRefName,url,title,body,author

Create Isolated Worktree

Create an isolated worktree, then check out the PR branch inside it. This keeps your working directory clean. If the superpowers:using-git-worktrees skill is available, use it; otherwise run git worktree add ../pr-<NUMBER>-validation and cd into it.

# After worktree is created, fetch and checkout the PR branch
gh pr checkout <PR_NUMBER>

Gather Project Context

Read these if they exist (don't fail if missing):

  • CLAUDE.md / AGENTS.md — project conventions and rules
  • README.md — project overview
  • ARCHITECTURE.md / CONTRIBUTING.md — structural decisions, contribution norms

Store key conventions (naming, patterns, test expectations) as context for agents.


Phase 1: Fetch All Comments

Get Review Threads (GraphQL — best source)

This is the primary method. It gives you thread grouping, resolved status, and outdated markers:

gh api graphql -F owner="{owner}" -F repo="{repo}" -F pr={number} -f query='
  query($owner: String!, $repo: String!, $pr: Int!) {
    repository(owner: $owner, name: $repo) {
      pullRequest(number: $pr) {
        reviewThreads(first: 100) {
          nodes {
            isResolved
            isOutdated
            path
            line
            comments(first: 50) {
              nodes {
                id
                databaseId
                author { login }
                body
                createdAt
              }
            }
          }
        }
      }
    }
  }
'

Get Inline Review Comments (REST — for reply IDs)

You need databaseId from REST to reply via the REST API:

gh api repos/{owner}/{repo}/pulls/{pr_number}/comments --paginate \
  --jq '.[] | {id, in_reply_to_id, path, line, body, user: .user.login}'

Get Top-Level PR Comments

gh api repos/{owner}/{repo}/issues/{pr_number}/comments --paginate \
  --jq '.[] | {id, body, user: .user.login}'

Get the Diff

gh pr diff {pr_number}

Filter and Group

  1. Skip resolved threads and outdated threads (mention count in report header)
  2. Group remaining comments by file path
  3. Build a map: file_path -> [comments] with full thread context

Phase 2: Parallel Comment Analysis

Dispatch Strategy

digraph dispatch {
  "Comments grouped by file" -> "1-3 comments on file?" [label=""];
  "Comments grouped by file" -> "4+ comments on file?" [label=""];
  "1-3 comments on file?" -> "One agent per file-group" [label="yes"];
  "4+ comments on file?" -> "Split into sub-groups of 2-3" [label="yes"];
  "One agent per file-group" -> "Dispatch all agents in parallel";
  "Split into sub-groups of 2-3" -> "Dispatch all agents in parallel";
}

Dispatch one Agent per file-group, all in a single message so they run simultaneously. (If the superpowers:dispatching-parallel-agents skill is available, follow it.)

Agent Briefing Template

Each agent receives this context and instructions:

You are analyzing PR review comments on [{file_path}] for PR #{number}.

## Context
- PR title: {title}
- PR description: {body}
- Base branch: {base}
- Project conventions: {conventions_summary}

## The Diff (this file only)
{diff_hunk_for_this_file}

## Comments to Analyze
{numbered_list_of_comments_with_thread_context}

## Your Task

For EACH comment, do ALL of the following:

### 1. Read the Code
- Read the FULL file, not just the diff hunk
- Read 2-3 related files (callers, interfaces, tests, sibling implementations)
- Understand actual runtime behavior

### 2. Check Codebase Patterns
- Grep for how similar things are done elsewhere in the codebase
- Check if the reviewer's suggestion matches or contradicts existing patterns
- Count occurrences — if 10 files do it one way, that's the convention

### 3. Research (if the comment makes a technical claim)
- Use WebSearch for authoritative sources (official docs, specs, RFCs, OWASP)
- If a docs tool such as the Context7 MCP server is available, use it to check framework/library documentation
- "Best practice" without a source is opinion, not evidence

### 4. Validate the Claim
Ask:
- Is it factually accurate? Trace the execution path.
- Does the principle actually apply at this scale/context?
- Is this premature abstraction disguised as a principle?
- Check the false positive patterns table.

### 5. Produce Per-Comment Output

For each comment, return EXACTLY this structure:

COMMENT: <first line of comment text>
FILE: <path:line>
CATEGORY: CORRECTNESS | SOLID | PATTERN | PERFORMANCE | SECURITY | CONVENTION | ARCHITECTURE | BEST-PRACTICE | NITPICK | QUESTION
REVIEWER_CLAIM: <one-line summary>
INVESTIGATION: <what you found — code behavior, patterns, research results>
EVIDENCE_FOR: <evidence supporting the reviewer, with sources>
EVIDENCE_AGAINST: <evidence contradicting the reviewer, with sources>
VERDICT: VALID | INVALID | PARTIALLY_VALID | STYLE_PREFERENCE | GOOD_QUESTION
ACTIONABLE: YES | NO | OPTIONAL
PRIORITY: CRITICAL | HIGH | MEDIUM | LOW | SKIP
RECOMMENDED_CHANGE: <specific code change, or "none">
DRAFT_REPLY: <human-like reply to post on GitHub — see reply guidelines below>

False Positive Patterns (include in agent briefing)

False PositiveReality
"Violates SRP" on a cohesive classSRP = one reason to change, not one method
"Use dependency injection" everywhereDI adds complexity; only when you test or swap
"Extract to helper" for 3 linesThree lines don't need abstraction
"Add error handling" for impossible errorsInternal code with type guarantees is fine
"This is O(n^2)" on n < 100Complexity irrelevant at small scale
"Magic number" for self-evident valuestimeout: 30 is clearer than DEFAULT_TIMEOUT_SECONDS
"Not thread-safe" in single-threaded codeCheck actual threading model first
"Missing tests" for trivial gettersTesting config/getters isn't valuable

Phase 3: Build Report and Present

Collect all agent results. Build this report:

# PR Validation Report

**PR:** #{number} — {title}
**Reviewer(s):** {usernames}
**Comments analyzed:** {count} ({skipped_resolved} resolved, {skipped_outdated} outdated — skipped)

## Summary
| Verdict | Count |
|---------|-------|
| VALID (actionable) | X |
| VALID (optional) | X |
| PARTIALLY_VALID | X |
| INVALID | X |
| STYLE_PREFERENCE | X |
| GOOD_QUESTION | X |

---

## Comment 1: "{first line}"
**File:** `path/to/file.ext:42`
**Category:** CORRECTNESS
**Reviewer claims:** {one-line summary}

### Investigation
{what you found}

### Evidence
- **FOR:** {sources supporting the claim}
- **AGAINST:** {sources contradicting the claim}

### Verdict: VALID | Actionable: YES | Priority: HIGH

### Recommended Change
{specific code change}

### Draft Reply
> {the reply that will be posted}

---
(repeat for each comment)
---

## Action Plan
1. [ ] {actionable items in priority order}

## Reply-Only Comments (no code change)
- Comment X: "{draft reply}"
- Comment Y: "{draft reply}"

Present the full report using AskUserQuestion. Wait for approval before ANY action.

The user can:

  • Approve all
  • Approve selectively (e.g., "skip comment 3, do the rest")
  • Modify a draft reply
  • Reject and re-investigate specific comments

Phase 4: Execute (After Approval Only)

digraph execute {
  "User approves" -> "Apply code changes";
  "Apply code changes" -> "Run tests";
  "Run tests" -> "Tests pass?" [label=""];
  "Tests pass?" -> "Reply to comments" [label="yes"];
  "Tests pass?" -> "Report failure, ask user" [label="no"];
  "Reply to comments" -> "Commit + push" [label=""];
  "Commit + push" -> "Done";
}

Apply Approved Code Changes

Implement in priority order: CRITICAL > HIGH > MEDIUM > LOW. Run the project's test suite after changes. If tests fail, stop and report.

Reply to Comments

Use thread replies (not top-level comments):

# Reply to an inline review comment
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments/{comment_id}/replies \
  -f body="<reply>"

# Reply to a top-level issue comment
gh api repos/{owner}/{repo}/issues/{pr_number}/comments \
  -f body="<reply>"

Rate limiting: GitHub throttles content creation. Add a 1-second pause between replies if posting more than 5. This avoids secondary rate limiting.

Commit and Push

  • Commit changes with a clear message referencing the review (e.g., "Address PR review feedback")
  • Ask user before pushing — never auto-push

Human-Like Reply Guidelines

These rules govern EVERY draft reply. Replies that sound robotic or templated undermine the entire workflow.

Tone Rules

DoDon't
Match the reviewer's formality levelUse corporate-speak regardless of context
"Good catch" / "Fair point" / "Yeah, fixed""Thank you for your insightful observation"
Lead with evidence when disagreeingLead with "I respectfully disagree"
Keep it concise — 1-3 sentences typicalWrite paragraphs for simple fixes
Use "we" when agreeing on directionUse "I" defensively
Reference specific code or docsMake vague claims about "best practices"
Acknowledge when you're wrong plainlyOver-apologize or be performatively humble

Reply Templates (adapt, don't copy verbatim)

Agreeing (simple fix):

Fixed — good catch.

Agreeing (with context):

Yeah, you're right. Changed to {X} — the previous approach would've broken when {Y}.

Partially agreeing:

Fair point about {X}. I've updated that part, but kept {Y} as-is because {reason/evidence}.

Disagreeing with evidence:

Looked into this — {X} actually handles that case because {evidence}. The {docs/spec/codebase pattern} confirms {Y}. Happy to discuss if you see something I'm missing.

Answering a question:

{Direct answer}. {One sentence of context if helpful}.

Style preference (not changing):

I see the appeal, but this matches the pattern used in {file1}, {file2}, etc. — kept it consistent.

Anti-Patterns in Replies

  • "Thank you for your thorough review" — sycophantic
  • "Great suggestion!" on every comment — hollow
  • "I've carefully considered..." — filler
  • "As per our discussion..." — nobody said that
  • Repeating the reviewer's comment back to them — wastes their time
  • "I respectfully disagree" — just disagree with evidence

Red Flags — STOP and Re-investigate

  • Marking all comments VALID without any pushback — you're rubber-stamping
  • Marking all comments INVALID — you're being defensive
  • Can't find authoritative sources for a verdict — research deeper
  • Using "codebase convention" to dismiss a real bug — convention doesn't override correctness
  • Implementing changes before the full report is presented — never
  • Draft replies all sound the same — they should vary naturally
  • Skipping web/doc research because "I already know" — verify anyway

Common Mistakes

MistakeFix
Replying to reply IDs instead of root comment IDsREST reply endpoint requires top-level comment id, not in_reply_to_id
Skipping resolved threads without mentioning themAlways report: "X resolved, Y outdated — skipped"
Not reading full files (only diff hunks)Diff context is insufficient — read the whole file
Treating all SOLID citations as gospelCheck if the principle applies at this scale
Ignoring codebase conventionsGrep for patterns — consistency often wins
Generic replies across all commentsEach reply should reflect that specific investigation
Pushing without askingAlways confirm before push
Dispatching agents without project conventionsInclude CLAUDE.md/convention summary in every agent brief
Not running tests after applying changesTests are mandatory before replying "Fixed"

Integration Points

  • Optional: superpowers:using-git-worktrees — for isolation (falls back to git worktree add)
  • Optional: superpowers:dispatching-parallel-agents — for parallel comment analysis
  • Optional: superpowers:finishing-a-development-branch — after all changes applied
  • Replaces: pr-comment-validation — this skill is the end-to-end version

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.