本文へ移動
cccskills
無料GitHub で公開

post-code-review-to-pr

Run a full pull request review and post review comments directly to the current branch's GitHub PR. Requires the gh CLI to be installed and a PR to already exist for the current branch. Use when you want review feedback posted to GitHub as PR comments. For local code review without posting to GitHub, use code-review instead. Does not write or update PR descriptions — use update-pr-description for that.

インストール方法を見る

含まれるファイル(5)

  • SKILL.md7.3 KB
  • scripts/create-review-tempfile.sh154 B
  • scripts/post-pr-comment.sh680 B
  • scripts/post-pr-review.sh1.0 KB
  • scripts/pr-metadata.sh901 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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: !bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$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:

  1. 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.
  2. 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 Review Coverage 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. Review Coverage always crosses when present. It appears only when no specialist read the change, and a reviewer on the pull request is the reader who most needs to know that.
  3. 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. Three sections are exempt from that length-matching and are never cut or shortened: the Review Summary table, the Review Recommendation, and the Review Coverage section. Review Coverage names no problem at any location by construction; it says which coverage the review did not have, and deleting it as filler would hide that from the widest audience the review reaches. Stay inside what the review covered: this step edits wording and severity, and never adds a finding /code-review did not raise.

  1. Write the draft review body to a temporary file (e.g., /tmp/post-code-review-to-pr-draft.md) using the Write tool.
  2. 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. Leave the Review Summary table, the Review Recommendation, and any Review Coverage section as they are; they are not findings and are not subject to the length-matching bar. Return a short list of specific edits with before/after text; return an empty list if the review reads well as-is."
  3. 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.
  4. 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).
  5. 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}.
  6. 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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Builds a new Claude Code agent (subagent) from scratch through a relentless, evidence-based interview that walks the agent's design tree decision-by-decision — entity fit, domain focus and vocabulary, role identity, anti-patterns, description, model tier, tools, and self-containment — then reviews the finished agent against the plugin-building guidance and applies every fix it finds. Use when creating, authoring, scaffolding, designing, or drafting a new agent or subagent. Does not build a skill or slash command — use skill-builder. Does not serve, vendor, or refresh the authoring guidance itself — use guidance.

日本語の概要は準備中です。原文の説明を表示しています。

testdouble/han2812026年10月1日 更新

Performs deep architectural analysis of a specified module, directory, or feature area by examining structural coupling, data flow, concurrency patterns, risk, and SOLID alignment. Use when the user wants to assess, evaluate, or review the architecture, design quality, dependency structure, coupling, cohesion, or technical debt of an existing part of the codebase. Not for investigating specific bugs, runtime errors, or failures — use investigate. Not for test planning — use automated-test-planning. Not for file-level code review — use code-review. Not for researching open-ended options, prior art, or how something works — use research. Not for designing a new interface or contract — use design-an-api. Not for planning the change its findings imply — use plan-a-change. Not for discovering bounded contexts, ubiquitous language, or where code boundaries diverge from domain boundaries — use ddd-analysis. Not for writing documentation or architectural decision records.

日本語の概要は準備中です。原文の説明を表示しています。

testdouble/han2812026年10月1日 更新

Create, extract, or convert an ADR (architectural decision record) using the ADR template. Use when creating new ADRs, extracting an ADR from existing documentation, converting a document into an ADR, recording an architecture or design decision, or updating the status of an existing ADR. Does not create or update enforceable coding standards or conventions — use coding-standard for that. Does not write feature or system documentation — use project-documentation instead.

日本語の概要は準備中です。原文の説明を表示しています。

testdouble/han2812026年10月1日 更新

Produce a standalone test plan by analyzing code for test coverage gaps and edge cases. Use when you need to create, generate, or draft a test plan for a branch, need to analyze test coverage, or need to identify what tests to write for specific files or directories. Does not produce a plain-language plan for a person to run tests by hand — use manual-test-planning for that. Does not write test code — use tdd to implement behavior test-first. Does not refine existing plans — use iterative-plan-review. Does not review code quality, security, or style — use code-review for full code review. Does not evaluate architectural testability or structural coupling — use architectural-analysis for architectural assessment.

日本語の概要は準備中です。原文の説明を表示しています。

testdouble/han2812026年10月1日 更新

Produces a human-readable, progressive-disclosure overview of unfamiliar code or a pull request's changes — why it exists (the real problem it solves or goal it serves for the business or a user), and from there what it does, how it flows, and where to start — so you can get up to speed before working on or reviewing it. Use when you want to understand, get oriented in, make sense of, explain, or get up to speed on a chunk of code, a file, a directory, a symbol, or a PR's changes. Writes the overview to a scratch file and changes no code. Does not review code quality or raise findings — use code-review for auditing changes or post-code-review-to-pr for posting them. Does not produce durable feature or system documentation — use project-documentation. Does not assess architecture or structural risk — use architectural-analysis. Does not diagnose bugs or root-cause failures — use investigate. Does not pace a person through the code one step at a time in conversation — use code-walkthrough.

日本語の概要は準備中です。原文の説明を表示しています。

testdouble/han2812026年10月1日 更新

Produces a progressive-disclosure overview of unfamiliar code or a pull request's changes with code-overview and publishes the resulting overview to a user-specified Confluence location. Use when the user wants code or a PR explained, oriented, or made sense of AND the overview posted to a Confluence space or page. Requires a configured Atlassian MCP server. Does not produce the overview to a local file only — use code-overview. Does not publish an arbitrary existing markdown file — use markdown-to-confluence. Does not document an already-understood feature to Confluence — use project-documentation-to-confluence. Does not root-cause a bug to Confluence — use investigate-to-confluence. Does not plan or specify a new feature to Confluence — use plan-a-feature-to-confluence. Does not publish to Jira — use work-items-to-jira.

日本語の概要は準備中です。原文の説明を表示しています。

testdouble/han2812026年10月1日 更新

testdouble のスキルをすべて見る

このスキルの問題を報告する