一键导入
pr-review-comprehensive
Comprehensive PR review with strict priority-based organization and merge readiness assessment
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Comprehensive PR review with strict priority-based organization and merge readiness assessment
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Dispatch a background worker with role-templated prompt and auto-populated collision fences
Comprehensive system health monitoring — checks agent performance, database, Kafka topics, pattern discovery, and service status across the ONEX platform
Orchestrate a Claude Code agent team to autonomously work a Linear epic across multiple repos
Run DoD evidence checks against a ticket contract and generate a verification receipt
Autonomous per-ticket pipeline that chains ticket-work, local-review, PR creation, CI watching, PR review loop, integration verification gate, and auto-merge into a single unattended workflow with Slack notifications and policy guardrails
Full autonomous audit-debug-fix loop for all dashboard pages — Playwright recon, parallel systematic-debug, fix, PR, Linear ticket, re-audit, iterate until clean. Supports local and cloud targets with optional post-fix redeployment.
| name | pr-review-comprehensive |
| description | Comprehensive PR review with strict priority-based organization and merge readiness assessment |
| level | basic |
| debug | false |
When invoked, your FIRST and ONLY action is to dispatch to a polymorphic-agent. Do NOT read files, run bash, or take any other action before dispatching.
Agent(
subagent_type="onex:polymorphic-agent",
description="Run pr-review for PR #<pr_number>",
prompt="Run the pr-review skill. <full context and args>"
)
CRITICAL: subagent_type MUST be "onex:polymorphic-agent" (with the onex: prefix).
Apply the persona profile above when generating outputs.
Production-ready PR review system that fetches all feedback from GitHub, organizes by priority, and enforces strict merge requirements.
Run this gate before all other review steps for every PR.
Branch pattern: omn-(\d+) (case-insensitive) → OMN-{N}
PR title pattern: \[OMN-(\d+)\] or OMN-(\d+):
If no ticket_id found: skip contract check, log "no ticket ID in PR" and proceed to Step 1.
Primary: $ONEX_CC_REPO_PATH/contracts/{ticket_id}.yaml (if ONEX_CC_REPO_PATH is set)
Fallback: $OMNI_HOME/onex_change_control/contracts/{ticket_id}.yaml
If contract not found:
Invoke the contract-compliance-check skill:
/contract-compliance-check {ticket_id}
Route result as follows:
| Result | Action |
|---|---|
BLOCK | Add as CRITICAL finding; halt review (do not proceed to Step 1) |
WARN | Add as MAJOR finding; continue review (proceed to Step 1) |
PASS | Log pass; continue review (proceed to Step 1) |
emergency_bypass semantics: If emergency_bypass.enabled=true with non-empty justification and follow_up_ticket_id, downgrade BLOCK to WARN and continue.
Post contract check result as a PR comment via gh pr comment:
gh pr comment {PR_NUMBER} --body "$(cat <<'EOF'
## Seam Contract Check — {ticket_id}
{contract_compliance_check_output}
EOF
)"
DO NOT run bash scripts directly. When this skill is invoked, you MUST dispatch to a polymorphic-agent.
Bash(${CLAUDE_PLUGIN_ROOT}/skills/pr-review/collate-issues 30)
Bash(${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-quick-review 22)
Task(
subagent_type="onex:polymorphic-agent",
description="PR review for #30",
prompt="Review PR #30. Use the pr-review skill tools:
1. Run: ${CLAUDE_PLUGIN_ROOT}/skills/pr-review/collate-issues 30
2. Analyze the output and categorize issues
3. Report findings organized by priority (CRITICAL/MAJOR/MINOR/NIT)
Available tools in ${CLAUDE_PLUGIN_ROOT}/skills/pr-review/:
- collate-issues <PR#> - Get all issues from PR
- collate-issues-with-ci <PR#> - Get PR issues + CI failures
- pr-quick-review <PR#> - Quick summary review
- fetch-pr-data <PR#> - Raw PR data from GitHub
Return a summary with:
- Count by priority level
- Merge readiness assessment
- List of issues to fix"
)
WHY: Polymorphic agents have full ONEX capabilities, intelligence integration, quality gates, and proper observability. Running bash directly bypasses all of this.
Blocking issues that MUST be resolved before merge:
Merge Status: ❌ Cannot merge until resolved
Important issues that SHOULD be resolved before merge:
Merge Status: ⚠️ Should resolve before merge
Quality issues that should be addressed:
Merge Status: ⚠️ Should resolve (not blocking)
Optional improvements that can be deferred:
Merge Status: ✅ Can merge even if nits remain
✅ Can Merge When:
❌ Cannot Merge When:
📁 Temporary Files: Always use repository-local
./tmp/directory for temporary files. Never use system/tmp/- this violates the repository pattern established in PR #36. All examples below correctly use{REPO}/tmp/for output files.
Single command for most use cases - fetches, categorizes, and displays automatically:
# Quick review with smart defaults (saves to {REPO}/tmp/pr-review-22.md)
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-quick-review 22
# Save to specific file
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-quick-review 22 --save ./my-review.md
# JSON output for scripting
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-quick-review 22 --json > pr22.json
# CI/CD mode (fails if issues found)
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-quick-review 22 --strict
Benefits:
New in v2: Pre-process PR data into structured JSON for agent consumption without manual jq parsing.
# Analyze PR data from fetch-pr-data
fetch-pr-data 36 | analyze-pr-comments > categorized.json
# From file
analyze-pr-comments pr_data.json > analysis.json
# Pipeline usage
fetch-pr-data 36 | analyze-pr-comments | jq '.summary'
Output Structure:
{
"pr_number": 36,
"analysis_timestamp": "2025-11-17T14:30:00Z",
"last_commit": {
"sha": "b4fe0d78...",
"timestamp": "2025-11-17T12:00:00Z"
},
"categorized_issues": {
"critical": [{
"id": "issue_1",
"source": "issue_comment",
"author": "claude-code[bot]",
"severity": "CRITICAL",
"title": "Run Tests job hung",
"description": "...",
"file": "ci.yml",
"line": 45,
"status": "unaddressed",
"created_at": "2025-11-17T13:00:00Z",
"structured_sections": {...}
}],
"major": [...],
"minor": [...],
"nitpicks": [...]
},
"summary": {
"total_critical": 4,
"total_major": 16,
"total_minor": 7,
"total_nitpicks": 19,
"total_all": 46,
"total_actionable": 27,
"unaddressed_critical": 4,
"unaddressed_major": 14,
"unaddressed_minor": 3
},
"structured_bot_reviews": [...]
}
Features:
Why This Matters for Agents:
# Review PR with priority organization
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/review-pr 22
# Output:
# - Priority breakdown (Critical/Major/Minor/Nit)
# - Merge readiness assessment
# - Organized issues by priority
# - Saved to {REPO}/tmp/pr-review-22.md
# Fail if any Critical/Major/Minor issues found
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/review-pr 22 --strict
# Exit codes:
# 0 - Ready to merge (only nits or no issues)
# 2 - Not ready (Critical/Major/Minor issues found)
# Save to specific file
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/review-pr 22 --output-file ./tmp/pr22-review.md
# JSON output for programmatic processing
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/review-pr 22 --json > pr22.json
Production-grade review with stricter standards and Linear integration:
# Production review (all Critical/Major/Minor MUST be resolved)
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-review-production 22
# Create Linear tickets for Critical and Major issues
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-review-production 22 \
--create-linear-tickets \
--team 9bdff6a3-f4ef-4ff7-b29a-6c4cf44371e6
# JSON output for CI/CD pipelines
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-review-production 22 --json
# Exit codes:
# 0 - Ready for production (all Critical/Major/Minor resolved)
# 1 - Invalid arguments
# 2 - Not ready (unresolved Critical/Major/Minor issues)
# 3 - GitHub API error
Production Requirements:
- name: PR Review
run: |
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/review-pr ${{ github.event.pull_request.number }} --strict
# Upload review artifact
if [ -f ./tmp/pr-review-*.md ]; then
gh pr comment ${{ github.event.pull_request.number }} \
--body-file ./tmp/pr-review-*.md
fi
# PR #22 - Review Summary
**Generated**: 2025-11-13 10:30:00
## Priority Breakdown
| Priority | Count | Status |
|----------|-------|--------|
| 🔴 CRITICAL | 2 | Must resolve before merge |
| 🟠 MAJOR | 5 | Should resolve before merge |
| 🟡 MINOR | 8 | Should resolve |
| ⚪ NIT | 12 | Optional (nice to have) |
**Total Issues**: 27
## Merge Readiness
❌ **NOT READY TO MERGE**
- ❌ 2 Critical issue(s) must be resolved
- ❌ 5 Major issue(s) should be resolved
- ⚠️ 8 Minor issue(s) should be resolved
---
## 🔴 CRITICAL Issues (2)
### CRITICAL-1: coderabbitai[bot]
**File**: `agents/lib/security.py`
SQL injection vulnerability in user input handling...
---
### CRITICAL-2: claude[bot]
**File**: `services/api.py`
Unauthenticated endpoint exposes sensitive data...
---
## 🟠 MAJOR Issues (5)
...
{
"critical": [
{
"author": "coderabbitai[bot]",
"path": "agents/lib/security.py",
"body": "SQL injection vulnerability...",
"id": 123456
}
],
"major": [...],
"minor": [...],
"nit": [...],
"summary": {
"critical_count": 2,
"major_count": 5,
"minor_count": 8,
"nit_count": 12,
"total": 27
}
}
Issues are automatically classified based on keywords:
CRITICAL Keywords:
critical, security, vulnerability, data loss, crash, breaking changeMAJOR Keywords:
major, bug, error, incorrect, performance, test, missing, should, importantNIT Keywords:
nit, nitpick, minor, consider, suggestion, optional, nice to have, style, formattingDefault: If no keywords match → classified as MINOR
review-pr)Best for: Development, feature branches, regular PRs
pr-review-production)Best for: Production deployments, release branches, critical PRs
| Scenario | Use | Reason |
|---|---|---|
| Feature branch → dev | review-pr | Development velocity matters |
| Dev → staging | review-pr --strict | Catch issues before production |
| Staging → production | pr-review-production | Zero tolerance, full tracking |
| Hotfix → production | pr-review-production | Critical path, must be perfect |
| Experimental PR | review-pr | Allow flexibility for exploration |
Claude Code Access: ${CLAUDE_PLUGIN_ROOT}/skills/pr-review/
Executables:
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-quick-review - One-command quick review (RECOMMENDED)${CLAUDE_PLUGIN_ROOT}/skills/pr-review/fetch-pr-data - Fetch all PR data from 4 GitHub endpoints${CLAUDE_PLUGIN_ROOT}/skills/pr-review/analyze-pr-comments - Pre-process raw data into categorized analysis (NEW)${CLAUDE_PLUGIN_ROOT}/skills/pr-review/review-pr - Comprehensive review with priority organization${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-review-production - Production-grade wrapper (NEW)Required tools (install with brew install gh jq):
gh - GitHub CLIjq - JSON processorPR data fetching uses tier-aware backend selection:
| Tier | Backend | Details |
|---|---|---|
FULL_ONEX | node_git_effect.pr_view() | Typed Pydantic models, structured PR data |
STANDALONE | _bin/pr-merge-readiness.sh | Shell script wrapping gh pr view with merge readiness assessment |
EVENT_BUS | _bin/pr-merge-readiness.sh | Same as STANDALONE |
Tier detection: see @_lib/tier-routing/helpers.md.
from omniclaude.nodes.node_git_effect.models import (
GitOperation, ModelGitRequest,
)
request = ModelGitRequest(
operation=GitOperation.PR_VIEW,
repo=repo,
pr_number=pr_number,
json_fields=[
"number", "title", "mergeable", "mergeStateStatus",
"reviewDecision", "statusCheckRollup", "headRefName",
"baseRefName", "isDraft", "reviewRequests", "latestReviews",
],
)
result = await handler.pr_view(request)
${CLAUDE_PLUGIN_ROOT}/_bin/pr-merge-readiness.sh --pr {N} --repo {repo}
# Returns: { ready, mergeable, ci_status, review_decision, merge_state_status, blockers }
The _bin/pr-merge-readiness.sh script provides a unified merge readiness assessment
including CI status, review decision, and blocker list -- reducing the number of separate
gh calls skills need to make.
The review comment fetching (collate-issues, fetch-pr-data, analyze-pr-comments) is
always direct gh CLI -- these are read-only operations fetching PR feedback from GitHub's
4 endpoints. The tier routing above applies only to merge readiness state assessment, not
comment collection.
PR review uses direct GitHub API calls (via gh CLI) rather than event-based architecture because:
Use event-based architecture for:
Use direct API/MCP for:
The PR review skill now has a type-safe Python backend using Pydantic models.
models.py - Pydantic v2 models for all PR data structuresfetcher.py - Type-safe GitHub API fetcheranalyzer.py - Comment analyzer with Claude bot detectionpr_review.py - Unified entry point# Quick summary
./pr_review.py 38
# Full analysis
./pr_review.py 38 --full
# Only Claude bot comments (NEVER MISSED!)
./pr_review.py 38 --claude-only
# Merge blockers only
./pr_review.py 38 --blockers
# JSON output
./pr_review.py 38 --json
# Markdown report
./pr_review.py 38 --markdown --save
/tmp/pr-review-cache-v2/Use the wrapper script for backward compatibility with existing workflows:
# Same as pr_review.py but via bash wrapper
${CLAUDE_PLUGIN_ROOT}/skills/pr-review/pr-review-v2 38 --full
from models import PRData, PRAnalysis, CommentSeverity, BotType
from fetcher import PRFetcher
from analyzer import PRAnalyzer, generate_markdown_report
# Fetch PR data
fetcher = PRFetcher("owner/repo", 38)
pr_data = fetcher.fetch()
# Analyze
analyzer = PRAnalyzer(pr_data)
analysis = analyzer.analyze()
# Check merge readiness
if analysis.merge_blockers:
print(f"Blocked by {len(analysis.merge_blockers)} issues")
# Get Claude bot comments (NEVER missed)
for comment in analysis.claude_issues:
print(f"[{comment.severity.value}] {comment.body[:100]}")
# Generate markdown report
report = generate_markdown_report(analysis)
${CLAUDE_PLUGIN_ROOT}/skills/linear/_bin/pr-merge-readiness.sh -- STANDALONE merge readiness assessment backend_lib/tier-routing/helpers.md -- tier detection and routing helpers