โ† Back to list
SmartOzzehir

pr-patrol

by SmartOzzehir

๐Ÿ”Œ Claude Code plugins: pr-patrol (PR bot comment handler) & spec-interview (AI requirements gathering with 8-stage methodology)

โญ 0๐Ÿด 0๐Ÿ“… Jan 15, 2026

SKILL.md


name: pr-patrol description: This skill should be used when the user asks to "handle bot comments", "fix PR review feedback", "address CodeRabbit/Greptile/Copilot issues", "respond to review bot suggestions", "process automated review comments", or runs "/pr-patrol". Patrols the PR for bot comments (CodeRabbit, Greptile, Codex, Copilot, Sentry) with state tracking and batch processing through a 7-gate workflow. allowed-tools: Bash, Read, Edit, Write, Grep, Glob, Task, AskUserQuestion

PR Patrol

Process automated PR review comments through a 7-gate workflow with phase-based loading.


โš ๏ธ CRITICAL REMINDERS

  1. READ PHASE FILE FIRST - Check status in state file, read phases/gate-{N}.md for current phase
  2. USE AGENTS FOR VALIDATION - Use bot-comment-validator via Task tool, never manual
  3. ASK ABOUT PR-REVIEW AGENTS - After checks pass, ask about code-reviewer/silent-failure-hunter
  4. ISSUE COMMENTS NEED @MENTION - GitHub issue comments don't support threading
  5. UPDATE STATE FILE - After EVERY action (use scripts/update_state.sh)
  6. NEVER REPLY TO COPILOT - Silent fix only, no reactions, no replies
  7. TRUST SCRIPT OUTPUT - When scripts return data, DO NOT make extra API calls to "verify"!

Quick Reference

BotLoginReactionReply
CodeRabbitcoderabbitai[bot]โŒโœ…
Greptilegreptile-apps[bot]๐Ÿ‘/๐Ÿ‘Ž FIRSTโœ… THEN
Codexchatgpt-codex-connector[bot]๐Ÿ‘/๐Ÿ‘Ž FIRSTโœ… THEN
CopilotCopilotโŒ NEVERโŒ NEVER
Sentrysentry[bot]๐Ÿ‘/๐Ÿ‘Ž FIRSTโœ… THEN

Ignored: vercel[bot], dependabot[bot], renovate[bot], github-actions[bot]


Workflow Diagram

/pr-patrol [PR#]
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 0: Init โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [AskUserQuestion] Mode, scope       โ”‚ โ†’ phases/gate-0-init.md
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 1: Collect โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [AskUserQuestion] Proceed?          โ”‚ โ†’ phases/gate-1-collect.md
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 2: Validate โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [Task: bot-comment-validator]       โ”‚ โ†’ phases/gate-2-validate.md
โ”‚ [AskUserQuestion] Which to fix?     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 3: Fix & Check โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Apply fixes โ†’ typecheck โ†’ lint      โ”‚ โ†’ phases/gate-3-fix.md
โ”‚ [AskUserQuestion] Run pr-review?    โ”‚ โ† Gate 3.5!
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 4: Commit โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [AskUserQuestion] Review & commit?  โ”‚ โ†’ phases/gate-4-commit.md
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 5: Reply โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [AskUserQuestion] Post replies?     โ”‚ โ†’ phases/gate-5-reply.md
โ”‚ Also read: bot-formats.md           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€ GATE 6: Push โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [AskUserQuestion] Push? Cycle 2?    โ”‚ โ†’ phases/gate-6-push.md
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Phase Routing (FOLLOW THIS!)

Step 1: Check State File

STATE_FILE=".claude/bot-reviews/PR-{N}.md"

Step 2: Read Current Phase

StatusRead This Phase File
(no file)phases/gate-0-init.md
initializedphases/gate-1-collect.md
collectedphases/gate-2-validate.md
validatedphases/gate-3-fix.md
fixes_plannedphases/gate-3-fix.md
fixes_appliedphases/gate-3-fix.md (run checks)
checks_passedphases/gate-4-commit.md
committedphases/gate-5-reply.md
replies_sentphases/gate-6-push.md
pushedCheck for new comments โ†’ Cycle 2?

Step 3: Follow Phase Instructions

Each phase file contains:

  • Detailed step-by-step actions
  • MANDATORY AskUserQuestion prompts
  • Edge cases and error handling
  • State file update commands

Scripts Location

SCRIPTS="${CLAUDE_PLUGIN_ROOT}/skills/pr-patrol/scripts"

# Core scripts
"$SCRIPTS/fetch_pr_comments.sh" owner repo pr    # Parallel API fetch
"$SCRIPTS/detect_thread_states.sh"               # State detection
"$SCRIPTS/check_new_comments.sh" owner repo pr   # New since push
"$SCRIPTS/check_reply_status.sh" owner repo pr   # Reply tracking
"$SCRIPTS/update_state.sh" file field value      # State updates

Reference Files Location

SKILL_ROOT="${CLAUDE_PLUGIN_ROOT}/skills/pr-patrol"

# Read these files with their FULL paths:
"$SKILL_ROOT/phases/gate-{N}.md"    # Phase instructions
"$SKILL_ROOT/bot-formats.md"        # Bot protocols (CRITICAL for Gate 5!)
"$SKILL_ROOT/templates.md"          # Reply templates
FilePurposeWhen to Read
phases/gate-{N}.mdPhase-specific instructionsBased on status
bot-formats.mdBot-specific protocolsMUST READ before Gate 5
templates.mdReply message templatesGate 5 (replies)

Critical Rules

  1. EVERY gate requires AskUserQuestion - Never skip user approval
  2. ALL comments must be validated - Severity only affects priority
  3. Copilot gets NO response - Silent fix only, no reactions, no replies
  4. NEVER commit/push without approval - Explicit consent required
  5. NEVER force push - Blocked completely
  6. Typecheck/lint are MANDATORY - Block on failure
  7. ALWAYS use --paginate - Default GitHub API returns only 30 comments
  8. Fetch BOTH endpoints - Review comments (/pulls/{pr}/comments) AND issue comments (/issues/{pr}/comments)
  9. Extract embedded CodeRabbit comments - Use parse_coderabbit_embedded.sh for nitpicks, duplicates, outside-diff
  10. Issue vs PR review comments - Different reply methods! Issue comments need @mention (no threading)
  11. Reaction BEFORE reply - For Greptile/Codex/Sentry, add reaction first, then reply
  12. Short reply format - "Fixed in commit {sha}: {description}" NOT verbose essays
  13. Use helper scripts - ${CLAUDE_PLUGIN_ROOT}/skills/pr-patrol/scripts/ has utilities
  14. TRUST SCRIPT OUTPUT - When scripts return data, DO NOT make verification queries

jq Escaping Warning

CRITICAL: Shell escaping corrupts jq operators. This affects:

  • Direct jq commands
  • gh api --jq flag
  • Any inline jq in bash

Forbidden Patterns

# โŒ WRONG - "!=" gets escaped to "\!=" โ†’ "unexpected token" error
jq '[.[] | select(.field != null)]'
gh api ... --jq '[.[] | select(.in_reply_to_id != null)]'

# โŒ WRONG - Same issue with "not null"
jq 'select(.x != "value")'

Safe Alternatives

# โœ… CORRECT - Use truthy check (implicit null filter)
jq '[.[] | select(.field)]'

# โœ… CORRECT - Use "| not" for negation
jq '[.[] | select(.bot == "Copilot" | not)]'

# โœ… CORRECT - Use external .jq file for complex queries
jq -f "$SCRIPT_DIR/filter.jq"

Rule: For any jq with != or complex logic, use the scripts in scripts/ instead of inline jq.

Score

Total Score

75/100

Based on repository quality metrics

โœ“SKILL.md

SKILL.mdใƒ•ใ‚กใ‚คใƒซใŒๅซใพใ‚Œใฆใ„ใ‚‹

+20
โœ“LICENSE

ใƒฉใ‚คใ‚ปใƒณใ‚นใŒ่จญๅฎšใ•ใ‚Œใฆใ„ใ‚‹

+10
โœ“่ชฌๆ˜Žๆ–‡

100ๆ–‡ๅญ—ไปฅไธŠใฎ่ชฌๆ˜ŽใŒใ‚ใ‚‹

+10
โ—‹ไบบๆฐ—

GitHub Stars 100ไปฅไธŠ

0/15
โœ“ๆœ€่ฟ‘ใฎๆดปๅ‹•

1ใƒถๆœˆไปฅๅ†…ใซๆ›ดๆ–ฐ

+10
โ—‹ใƒ•ใ‚ฉใƒผใ‚ฏ

10ๅ›žไปฅไธŠใƒ•ใ‚ฉใƒผใ‚ฏใ•ใ‚Œใฆใ„ใ‚‹

0/5
โœ“Issue็ฎก็†

ใ‚ชใƒผใƒ—ใƒณIssueใŒ50ๆœชๆบ€

+5
โœ“่จ€่ชž

ใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐ่จ€่ชžใŒ่จญๅฎšใ•ใ‚Œใฆใ„ใ‚‹

+5
โœ“ใ‚ฟใ‚ฐ

1ใคไปฅไธŠใฎใ‚ฟใ‚ฐใŒ่จญๅฎšใ•ใ‚Œใฆใ„ใ‚‹

+5

Reviews

๐Ÿ’ฌ

Reviews coming soon