When running a PR code review, follow the process outlined here.
Pre-requisites
- gh CLI: !
which gh 2>/dev/null || echo "not installed"
- jq: !
which jq 2>/dev/null || echo "not installed"
If gh is not found, inform the user it must be installed and configured; if jq is not found, inform the user it must
be installed. In either case, immediately stop.
Project Context
- current branch: !
git branch --show-current 2>/dev/null || echo unknown
- default branch: !
git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || echo unknown
- changed files: !
gh pr diff --name-only 2>/dev/null || echo "no pr"
- personal config directory: !
echo "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
- project .han/config.md: !
cat .han/config.md 2>/dev/null || echo ""
As your first action, use the Read tool on .han/config.md inside the personal config directory path above. A read
that returns no file is no personal configuration: continue silently. When that file or the project .han/config.md
probe supplies content, apply it per config-rule.md, which governs precedence
between the two files, relative-path resolution, and what to do with a file that reads but cannot be used.
Step 1: Validate PR State
If changed files is empty or reads no pr, or gh pr view --json number,url fails, inform the user no reviewable PR
exists for the current branch and stop.
Step 2: Run Code Review
Invoke the /code-review skill to perform the full code review. Pass along any user-provided focus areas or context
from the original arguments.
/code-review writes its report to a file and names the path in its closing message; it does not print the review into
the conversation. Capture that path — Step 3 reads the report from it. After /code-review completes, proceed
immediately to Step 3 — do not stop here.
Step 3: Offer to Post Review to GitHub
Ask the user whether they'd like to post the review to the PR on GitHub using AskUserQuestion with options "Yes, post
the review to GitHub" and "No, just the local review". If the user declines, proceed to Step 5.
If the user accepts:
- Gather PR metadata by running
${CLAUDE_SKILL_DIR}/scripts/pr-metadata.sh, which outputs JSON with owner_repo,
pr_number, head_sha, pr_author_login, and current_user_login.
- Read the report file at the path captured in Step 2, then build the review body from it: Review Summary table, Review
Recommendation, and all findings organized by severity, plus any optional sections that are present. Treat every section other than the Review Summary table and the Review
Recommendation as optional — the code-review skill renders a section only when it has content, so a section (the
What's Good section, an absent severity section on a clean review, the Security Vulnerabilities section, the
Remediation note) may simply not be there. Include each section when present and omit it without error or an empty
heading when absent.
- Continue to Step 4 — do not post yet.
Step 4: Pre-Post Clarity Check
Because the review body will be publicly visible on the PR, run a clarity pass on the draft before posting.
Match the body's length to what the review found. Every finding earns its place by naming a specific problem at a
specific location. Skip filler sections, a restated summary of the diff, and boilerplate the reader can see for
themselves on the PR. Stay inside what the review covered: this step edits wording and severity, and never adds a
finding /code-review did not raise.
- Write the draft review body to a temporary file (e.g.,
/tmp/post-code-review-to-pr-draft.md) using the Write tool.
- Launch a single
han-core:junior-developer agent in artifact-review mode with the prompt: "You are reviewing the
text of a code review that is about to be posted publicly on a GitHub pull request. The review is at {draft_path}. Do
not re-review the code — review the review. Flag findings whose wording is unclear, severity is mis-assigned (CRIT
used where WARN would be accurate, or vice versa), language is accusatory or blaming rather than evidence-based, or
file_path:line_number references are missing or invalid. Return a short list of specific edits with before/after
text; return an empty list if the review reads well as-is."
- Apply every actionable edit the agent returns. If the agent raises a severity-assignment issue, adjust the finding's
task ID and the Review Summary table to match.
- Generate a unique temp file path by running
${CLAUDE_SKILL_DIR}/scripts/create-review-tempfile.sh. Write the final,
edited review body to that path using the Write tool (not Bash).
- Post based on authorship: If
pr_author_login matches current_user_login (self-authored PR), post as a PR
comment (GitHub rejects formal reviews from PR authors) by running
${CLAUDE_SKILL_DIR}/scripts/post-pr-comment.sh {pr_number} {temp_file_path}. If they differ, determine event type
(REQUEST_CHANGES if any CRIT or WARN findings exist, COMMENT if only SUGG) and post as a formal review by running
${CLAUDE_SKILL_DIR}/scripts/post-pr-review.sh {owner/repo} {pr_number} {head_sha} {event_type} {temp_file_path}.
- On success, report the PR URL. On failure, report the error.
Step 5: Offer to Create Fix Plan (Only If Issues Found)
If any Critical or Warning issues were identified, ask the user using AskUserQuestion — "Would you like me to create a
plan to fix the identified issues?" with options "Yes, create a fix plan" and "No, just the review". If yes, enter plan
mode and create a detailed implementation plan listing each Critical and Warning item by task ID, with specific code
changes, file paths, and line numbers, ordered by priority (Critical first). If no Critical or Warning issues were
found, the review is complete — suggestions alone do not warrant a fix plan.
1---2name: post-code-review-to-pr3description: >4 Run a full pull request review and post review comments directly to the current branch's GitHub PR. Requires the gh5 CLI to be installed and a PR to already exist for the current branch. Use when you want review feedback posted to6 GitHub as PR comments. For local code review without posting to GitHub, use code-review instead. Does not write or7 update PR descriptions — use update-pr-description for that.8argument-hint: "[optional context about the PR or areas to focus on]"9allowed-tools: Bash(jq *), Bash(gh *), Bash(git *), Bash(make *), Bash(npm *), Read, Write, Grep, Glob, Skill, Agent10metadata:11 source: https://skillmd.com/skills/testdouble/post-code-review-to-pr12---1314When running a PR code review, follow the process outlined here.1516## Pre-requisites1718- gh CLI: !`which gh 2>/dev/null || echo "not installed"`19- jq: !`which jq 2>/dev/null || echo "not installed"`2021If `gh` is not found, inform the user it must be installed and configured; if `jq` is not found, inform the user it must22be installed. In either case, immediately stop.2324## Project Context2526- current branch: !`git branch --show-current 2>/dev/null || echo unknown`27- default branch: !`git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || echo unknown`28- changed files: !`gh pr diff --name-only 2>/dev/null || echo "no pr"`29- personal config directory: !`echo "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"`30- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""`3132As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read33that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md`34probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence35between the two files, relative-path resolution, and what to do with a file that reads but cannot be used.3637## Step 1: Validate PR State3839If `changed files` is empty or reads `no pr`, or `gh pr view --json number,url` fails, inform the user no reviewable PR40exists for the current branch and stop.4142## Step 2: Run Code Review4344Invoke the `/code-review` skill to perform the full code review. Pass along any user-provided focus areas or context45from the original arguments.4647`/code-review` writes its report to a file and names the path in its closing message; it does not print the review into48the conversation. **Capture that path** — Step 3 reads the report from it. After /code-review completes, proceed49immediately to Step 3 — do not stop here.5051## Step 3: Offer to Post Review to GitHub5253Ask the user whether they'd like to post the review to the PR on GitHub using `AskUserQuestion` with options "Yes, post54the review to GitHub" and "No, just the local review". If the user declines, proceed to Step 5.5556If the user accepts:57581. Gather PR metadata by running `${CLAUDE_SKILL_DIR}/scripts/pr-metadata.sh`, which outputs JSON with `owner_repo`,59 `pr_number`, `head_sha`, `pr_author_login`, and `current_user_login`.602. Read the report file at the path captured in Step 2, then build the review body from it: Review Summary table, Review61 Recommendation, and all findings organized by severity, plus any optional sections that are present. Treat every section other than the Review Summary table and the Review62 Recommendation as optional — the code-review skill renders a section only when it has content, so a section (the63 What's Good section, an absent severity section on a clean review, the Security Vulnerabilities section, the64 Remediation note) may simply not be there. Include each section when present and omit it without error or an empty65 heading when absent.663. Continue to Step 4 — do **not** post yet.6768## Step 4: Pre-Post Clarity Check6970Because the review body will be publicly visible on the PR, run a clarity pass on the draft before posting.7172Match the body's length to what the review found. Every finding earns its place by naming a specific problem at a73specific location. Skip filler sections, a restated summary of the diff, and boilerplate the reader can see for74themselves on the PR. Stay inside what the review covered: this step edits wording and severity, and never adds a75finding `/code-review` did not raise.76771. Write the draft review body to a temporary file (e.g., `/tmp/post-code-review-to-pr-draft.md`) using the Write tool.782. Launch a single `han-core:junior-developer` agent in artifact-review mode with the prompt: "You are reviewing the79 text of a code review that is about to be posted publicly on a GitHub pull request. The review is at {draft_path}. Do80 not re-review the code — review the review. Flag findings whose wording is unclear, severity is mis-assigned (CRIT81 used where WARN would be accurate, or vice versa), language is accusatory or blaming rather than evidence-based, or82 `file_path:line_number` references are missing or invalid. Return a short list of specific edits with before/after83 text; return an empty list if the review reads well as-is."843. Apply every actionable edit the agent returns. If the agent raises a severity-assignment issue, adjust the finding's85 task ID and the Review Summary table to match.864. Generate a unique temp file path by running `${CLAUDE_SKILL_DIR}/scripts/create-review-tempfile.sh`. Write the final,87 edited review body to that path using the Write tool (not Bash).885. **Post based on authorship:** If `pr_author_login` matches `current_user_login` (self-authored PR), post as a PR89 comment (GitHub rejects formal reviews from PR authors) by running90 `${CLAUDE_SKILL_DIR}/scripts/post-pr-comment.sh {pr_number} {temp_file_path}`. If they differ, determine event type91 (`REQUEST_CHANGES` if any CRIT or WARN findings exist, `COMMENT` if only SUGG) and post as a formal review by running92 `${CLAUDE_SKILL_DIR}/scripts/post-pr-review.sh {owner/repo} {pr_number} {head_sha} {event_type} {temp_file_path}`.936. On success, report the PR URL. On failure, report the error.9495## Step 5: Offer to Create Fix Plan (Only If Issues Found)9697If any Critical or Warning issues were identified, ask the user using `AskUserQuestion` — "Would you like me to create a98plan to fix the identified issues?" with options "Yes, create a fix plan" and "No, just the review". If yes, enter plan99mode and create a detailed implementation plan listing each Critical and Warning item by task ID, with specific code100changes, file paths, and line numbers, ordered by priority (Critical first). If no Critical or Warning issues were101found, the review is complete — suggestions alone do not warrant a fix plan.