$npx -y skills add redhat-developer/rhdh-skill --skill rhdh-pr-reviewReview pull requests: code-level analysis with inline comments, and live cluster testing for rhdh-operator PRs. Supports GitHub (GitLab planned). Use when asked to review a PR, review code, post review comments, test PR changes on a cluster, deploy PR images for testing, or do a
| 1 | <cli_setup> |
| 2 | |
| 3 | For cluster testing workflows, set up the orchestrator CLI: |
| 4 | |
| 5 | ```bash |
| 6 | RHDH=../rhdh/scripts/rhdh |
| 7 | ``` |
| 8 | |
| 9 | </cli_setup> |
| 10 | |
| 11 | <essential_principles> |
| 12 | |
| 13 | <principle name="layered_architecture"> |
| 14 | Reviews follow a three-layer pipeline: **fetch** (forge-specific) → **analyze** (agnostic) → **post** (forge-specific). Each layer produces a structured artifact for the next. The analyze layer never calls forge-specific CLIs. |
| 15 | </principle> |
| 16 | |
| 17 | <principle name="verify_findings"> |
| 18 | Reviewers will produce false positives. Verify every finding against actual code at HEAD before including it. Drop findings that reference non-existent code, duplicate existing comments, misread the code, or conflict with codebase conventions. |
| 19 | </principle> |
| 20 | |
| 21 | <principle name="user_confirms_before_posting"> |
| 22 | Present the full review draft — summary, inline comments with file:line, and event type — to the user before posting. Proceed only after confirmation. |
| 23 | </principle> |
| 24 | |
| 25 | <principle name="deploy_full_bundle"> |
| 26 | For cluster testing: deploy the full PR bundle/manifests, not just the operator binary image. PR changes to CRDs, RBAC, default config, or bundle metadata are baked into the OLM bundle or install.yaml — a binary-only image swap misses them. |
| 27 | </principle> |
| 28 | |
| 29 | </essential_principles> |
| 30 | |
| 31 | <intake> |
| 32 | |
| 33 | ## What would you like to do? |
| 34 | |
| 35 | ### Code Review |
| 36 | |
| 37 | 1. **Review PR code** — Analyze a PR diff, generate findings, and post inline comments |
| 38 | 2. **Review PR code (analysis only)** — Analyze without posting (e.g., to review locally or post later) |
| 39 | |
| 40 | ### Cluster Testing (rhdh-operator PRs) |
| 41 | |
| 42 | 3. **Test PR on cluster** — Deploy PR operator bundle on a live RHDH cluster and verify changes |
| 43 | |
| 44 | ### Combined |
| 45 | |
| 46 | 4. **Full review** — Code review + post to GitHub + cluster testing |
| 47 | |
| 48 | **Wait for response before proceeding.** |
| 49 | |
| 50 | </intake> |
| 51 | |
| 52 | <routing> |
| 53 | |
| 54 | | Response | Workflow | |
| 55 | |----------|----------| |
| 56 | | 1, "review", "review PR", "code review", a PR URL or number | `workflows/fetch-github.md` → `workflows/review-code.md` → `workflows/post-to-github.md` | |
| 57 | | 2, "analyze", "analysis only", "review locally" | `workflows/fetch-github.md` → `workflows/review-code.md` (stop after findings) | |
| 58 | | 3, "test", "cluster", "deploy", "operator PR", "test on cluster" | `workflows/fetch-github.md` → `workflows/review-operator-pr.md` | |
| 59 | | 4, "full", "full review", "both" | `workflows/fetch-github.md` → `workflows/review-code.md` → `workflows/post-to-github.md` → `workflows/review-operator-pr.md` | |
| 60 | |
| 61 | ### Routing rules |
| 62 | |
| 63 | 1. **PR URL or number with no other context**: default to route 1 (code review + post). |
| 64 | 2. **rhdh-operator PR detected** (repo is `redhat-developer/rhdh-operator`): suggest route 4 (full review) but let the user choose. |
| 65 | 3. **"review" without "post" or "cluster"**: route 1. |
| 66 | 4. **All routes start with fetch.** The fetch workflow produces a context artifact consumed by all downstream workflows. |
| 67 | |
| 68 | ### Forge detection |
| 69 | |
| 70 | Currently GitHub only. Detect from URL pattern or `gh` CLI availability. |
| 71 | |
| 72 | When GitLab support is added: `fetch-gitlab.md` and `post-to-gitlab.md` will slot into the same pipeline. The analyze workflow (`review-code.md`) is forge-agnostic and needs no changes. |
| 73 | |
| 74 | </routing> |
| 75 | |
| 76 | <artifact_contracts> |
| 77 | |
| 78 | ## Context artifact (fetch → analyze / cluster test) |
| 79 | |
| 80 | Produced by the fetch workflow, consumed by all downstream workflows: |
| 81 | |
| 82 | ``` |
| 83 | context artifact |
| 84 | ├── forge: "github" |
| 85 | ├── repo: "owner/repo" |
| 86 | ├── pr_number: 123 |
| 87 | ├── head_sha: "abc123..." |
| 88 | ├── base_ref, head_ref, title, body, author, state, url |
| 89 | ├── labels: [...] |
| 90 | ├── files: [{path, additions, deletions}, ...] |
| 91 | ├── total_additions, total_deletions |
| 92 | ├── diff: "full unified diff" |
| 93 | ├── linked_issues: [{number, title, body, labels, state}, ...] |
| 94 | ├── jira_keys: ["RHIDP-1234", ...] |
| 95 | ├── existing_comments: [{user, path, line, body, created_at}, ...] |
| 96 | ├── existing_reviews: [{user, state, body}, ...] |
| 97 | └── ci_status: "pass" | "fail" | "pending" | "unknown" |
| 98 | ``` |
| 99 | |
| 100 | ## Findings artifact (analyze → post) |
| 101 | |
| 102 | Produced by the analysis workflow, consumed by the posting workflow: |
| 103 | |
| 104 | ``` |
| 105 | findings artifact |
| 106 | ├── pr: {repo, number, head_sha} |
| 107 | ├── summary: "top-level review text" |
| 108 | ├── event: "COMMENT" | "APPROVE" | "REQUEST_CHANGES" |
| 109 | └── findings[] |
| 110 | ├── path, line, start_line |
| 111 | ├── type: "suggestion" | "question" | "observation" |
| 112 | └── body: "comment text" |
| 113 | ``` |
| 114 | |
| 115 | </artifact_contracts> |
| 116 | |
| 117 | <reference_index> |
| 118 | |
| 119 | | Reference | Purpose | Load when... | Path | |
| 120 | |-----------|---------|--------------|------| |
| 121 | | review-perspectives | Review perspective examples and signal hints | Running `review-code.md` | `references/revie |