diff --git a/.claude/agents/uniplan-be-reviewer.md b/.claude/agents/uniplan-be-reviewer.md index ed416f84..8fd94420 100644 --- a/.claude/agents/uniplan-be-reviewer.md +++ b/.claude/agents/uniplan-be-reviewer.md @@ -1,7 +1,7 @@ --- name: uniplan-be-reviewer description: uniplan backend reviewer. Evaluates backend diffs against project rules and produces review findings. Read-only — cannot edit code. System prompt carries the distilled reviewer context. Use for PR review flows and ad-hoc backend code review. -model: claude-sonnet-4-6 +model: claude-opus-5 effort: high tools: Read, Glob, Grep, Bash, Skill, ToolSearch --- @@ -104,9 +104,11 @@ Tests: If no issues found, state: **"No issues found."** (Still produce the Summary and Praise sections.) +**Finding length:** one to two sentences each — state the problem and why it matters, then stop. Do not walk through how you found it, restate the surrounding code, or repeat the rule verbatim. Cite the rule by name only when the violation is not self-evident from the description. This output is posted verbatim as a GitHub PR comment, so length is a cost the reviewer pays on every read. + ## Workflow specifics -- **PR review** (`/review`) — invoking prompt provides worktree path + base/head. Context line: `PR # review`. +- **PR review** (`/review-pr`) — invoking prompt provides worktree path + base/head. Context line: `PR # review`. - **Ad-hoc review** — invoking prompt provides the diff scope or a list of changed files. Context line: as supplied by the invoker, or `Backend review` if unspecified. You may read surrounding code via `Read` / `Grep` / `Glob` for context. Findings must be scoped to the diff. diff --git a/.claude/skills/review-pr/SKILL.md b/.claude/skills/review-pr/SKILL.md index fa8598d2..ce633fd1 100644 --- a/.claude/skills/review-pr/SKILL.md +++ b/.claude/skills/review-pr/SKILL.md @@ -11,6 +11,8 @@ Your role is a **thin dispatcher**: fetch PR metadata, prepare the worktree, cla uniplan is currently a backend-only project; this skill is structured so a frontend reviewer can be added later as a sibling Agent dispatch without restructuring. +> **CI override:** if the environment variable `CI=true` is set OR the invoking prompt explicitly says "running in CI / runner is already at the PR branch", **skip Step 2 (worktree creation) entirely**. In CI the runner has already checked out the PR branch into the working directory — set `` to the current working directory (`git rev-parse --show-toplevel`) and proceed. In CI the run is review-only: do not edit files, do not commit, do not push. + Follow these steps exactly. ## Step 1: Fetch PR metadata @@ -31,7 +33,7 @@ If the PR is not found, stop and inform the user. ## Step 2: Create a git worktree for the PR branch -**IMPORTANT: Always create the worktree — never skip this step, regardless of PR size or number of files changed.** The reviewer subagent reads source files from this worktree. +**Skip this step if running in CI** (see CI override above). Otherwise: **always create the worktree — never skip this step locally, regardless of PR size or number of files changed.** The reviewer subagent reads source files from this worktree. Run each command as a **separate Bash call**: @@ -206,3 +208,5 @@ After the review output, always print the following block (substituting the lite > All file edits for this PR must be made inside the worktree above. > Do **not** modify files in the main repository. ``` + +If the run is in CI, print "Implementation target: N/A (review-only run in CI)" instead. diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index ed68f9d5..b64fa687 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -91,6 +91,10 @@ jobs: - name: Run Claude Code Review uses: anthropics/claude-code-action@v1 + env: + # Trips the `/review-pr` skill's CI override so it skips worktree + # creation instead of relying on the prompt to contradict the skill. + CI: "true" with: # This secret MUST be defined as an environment-scoped secret on the # `reviewers-only` environment, not as a repo-wide secret. That way it is @@ -103,7 +107,7 @@ jobs: # The prompt posts via `gh` and dispatches the uniplan-be-reviewer # subagent (Task) + the /review-pr skill (Skill) — all must be granted. claude_args: >- - --model claude-sonnet-4-6 + --model claude-opus-5 --allowedTools "Bash(gh pr review:*),Bash(gh api:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(git:*),Task,Read,Glob,Grep,Skill" prompt: | You are orchestrating a code review of PR #${{ inputs.pr_number }} in ${{ github.repository }}. @@ -111,10 +115,15 @@ jobs: Run the project's `/review-pr` skill against this PR. The skill is defined in `.claude/skills/review-pr/SKILL.md` — read it and follow its steps. - For this CI invocation, override the worktree handling: you are already - checked out at the PR branch in the current working directory, so skip - the "create a worktree" step and treat the current directory as the - worktree path. All other steps apply unchanged. + For this CI invocation, the skill's own CI override applies (CI=true is + set in the environment): you are already checked out at the PR branch in + the current working directory, so skip the "create a worktree" step and + treat the current directory as the worktree path. All other steps apply + unchanged. + + This run is review-only. Do not push commits, do not edit any files, and + do not open new PRs — the only write you make is the review comment + described below. The skill will: 1. Fetch PR metadata.