refactor /review-pr into a reusable pr-review skill#36
Conversation
Move the canonical PR review workflow from .opencode/commands/review-pr.md into .opencode/skills/pr-review/SKILL.md so agents can load it through the native skill tool. Keep /review-pr as a thin wrapper that forwards the requested aspects and loads the skill, allow the review-pr-orchestrator agent to load only the pr-review skill, and update the validation suite and documentation to track the new implementation source. Closes #32 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f6e66ca to
cc25e52
Compare
dceoy
left a comment
There was a problem hiding this comment.
One important issue remains: direct pr-review skill loading is advertised as supported, but it does not enter the action's review-only isolation path and therefore does not preserve the trusted-skill and read-only guarantees of /review-pr.
| ## Pull Request Reviews | ||
|
|
||
| The bundled `/review-pr` command submits a GitHub pull request review through `gh api`. It uses inline review comments for every finding that can be safely anchored to the PR diff, and includes only unanchorable findings in the review body as summary-only fallback items when at least one inline comment is submitted. If no finding can be anchored inline, `/review-pr` returns a top-level markdown fallback instead. When there are no summary-only findings, the review body is a single line (`OpenCode PR Review: <N> inline finding(s).`) with no empty "Summary-only findings" section. | ||
| The bundled review workflow is implemented as the `pr-review` OpenCode skill (`.opencode/skills/pr-review/SKILL.md`); the `/review-pr` command is a thin wrapper that forwards the requested aspects and loads that skill, so agents can also load `pr-review` directly through the native skill tool. The workflow submits a GitHub pull request review through `gh api`. It uses inline review comments for every finding that can be safely anchored to the PR diff, and includes only unanchorable findings in the review body as summary-only fallback items when at least one inline comment is submitted. If no finding can be anchored inline, `/review-pr` returns a top-level markdown fallback instead. When there are no summary-only findings, the review body is a single line (`OpenCode PR Review: <N> inline finding(s).`) with no empty "Summary-only findings" section. |
There was a problem hiding this comment.
important: The newly advertised direct-load path is not equivalent to /review-pr. action.yml enables the fresh global config, OPENCODE_DISABLE_PROJECT_CONFIG=1, and the deny-by-default review-pr-orchestrator only when the effective prompt starts with /review-pr. A prompt that merely asks an agent to load pr-review runs in normal mode, where project config remains enabled; OpenCode can therefore resolve a project-local skill with the same name instead of this trusted bundled skill, and execution uses the caller agent's broader permissions rather than the orchestrator's read-only boundary. Either route direct skill use through the same isolated/orchestrated path (with an end-to-end regression test), or scope this claim to trusted sessions where those guarantees are not promised.
Summary
Fixes #32.
.opencode/commands/review-pr.mdinto a new OpenCode skill at.opencode/skills/pr-review/SKILL.md, so agents can loadpr-reviewdirectly through the native skill tool./review-prto a thin wrapper that keepsagent: review-pr-orchestrator, forwards$ARGUMENTSas the requested review aspects, and instructs the agent to load and follow thepr-reviewskill; no workflow instructions are duplicated in the command.review-pr-orchestratoragent (whose permission block denies everything by default) to load only thepr-reviewskill (skill: { "*": deny, pr-review: allow }).headRefOidpinning with stale-head rejection, aspect-based reviewer selection, anchor validation, summary-only handling, batched submission throughreview-pr-submit.shonly, the exact no-findings result, and read-onlysimplify. The only text change is that the$ARGUMENTSplaceholder (which OpenCode substitutes only in commands) became "supplied by the caller that loaded this skill".Validation & docs
validate-opencode.batsnow scans both the command and the skill for agent references, checks the resolver allow-list path against the skill, and adds three tests: the command stays a thin wrapper (no helper-script or review-state references), the skill frontmatter declaresname: pr-reviewplus a description, and the orchestrator permits thepr-reviewskill.AGENTS.mdandREADME.mdto name the skill as the implementation source.Notes
~/.config/opencode/andOPENCODE_DISABLE_PROJECT_CONFIG=1is exported before the run, so the skill resolves from the trusted global config rather than the untrusted checkout, matching the existing handling for commands and agents..agents/skills/local-qa/scripts/qa.shpasses: prettier/yamllint/shellcheck/zizmor/actionlint/checkov clean, all 50 bats tests green.🤖 Generated with Claude Code