Gh Pr Code Reviewのロゴ

Gh Pr Code Review

コミュニティ
ericmjl
gh-pr-code-review

PR code review workflow: pull diff, two-pass findings, draft and prioritize comments, then optionally post via gh api.

概要

公開者ericmjl
リポジトリskills
スキル名gh-pr-code-review
スター
41
フォーク
5
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    ericmjlがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルGh Pr Code ReviewをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/ericmjl/skills/tree/main/skills/gh-pr-code-review
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ericmjl/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/gh-pr-code-review .claude/skills/gh-pr-code-review
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでGh Pr Code Reviewを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にGh Pr Code Reviewを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Gh Pr Code Reviewは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

PR code review (gh)

This skill guides a repeatable pull request review workflow using the GitHub CLI.

It emphasizes two-pass review (to find more issues), drafting comments before posting, and posting only after explicit user confirmation.

Usage

Use this skill when the user asks you to review a pull request and leave actionable feedback.

Inputs you should accept:

  • PR number, PR URL, or branch name accepted by gh pr view / gh pr diff
  • Optional repo override via -R owner/repo if not in a git checkout

Requirements

  • gh authenticated (gh auth status)
  • Permission to comment on the PR
  • Optional but useful: jq

What it does

A code review in two passes, then a drafting and posting phase:

A) Pull down the PR diff and identify issues

B) Repeat the review, finding only new issues

C) Draft review comments but do not post yet

D) Prioritize comments by criticality:

  • critical: correctness/security/data loss/broken API/test failures
  • optional: maintainability/performance/edge cases/docs/test gaps
  • trivial: nits/style/micro-optimizations (do not show by default)

E) Show only critical and optional items to the user. Then, if (and only if) the user explicitly confirms, post:

  • inline (line-level) review comments where anchoring is unambiguous
  • a single summary timeline comment containing only critical + optional items

How it works

0) Gather PR context

  1. Identify the PR. Prefer a PR number or URL.
  2. Fetch PR metadata (including the head commit SHA):
bash
gh pr view <PR> --json number,title,url,baseRefName,headRefName,headRefOid,files,additions,deletions
  1. Fetch the diff (the primary review artifact):
bash
gh pr diff <PR> --color=never

Optional: check CI signal while reviewing:

bash
gh pr checks <PR>

1) Stage A: first-pass review

Review the diff and record issues as structured items. For each issue capture:

  • severity: critical | optional | trivial
  • path: file path when applicable
  • side: RIGHT (new code / additions / context) or LEFT (deletions)
  • line: line number in the diff blob when you can anchor reliably
  • body: the draft comment text (short, actionable)

Focus this pass primarily on:

  • correctness and logic errors
  • security risks
  • API breaks
  • data loss / irreversible behavior
  • missing or failing tests

2) Stage B: second-pass review (new issues only)

Re-review the same diff from scratch with a different lens:

  • edge cases
  • performance and algorithmic complexity
  • naming, clarity, ergonomics
  • documentation and user-facing behavior
  • consistency with project conventions

Critical rule: do not repeat issues from stage A. Only append genuinely new issues.

3) Stage C: draft comments (do not post)

Convert each issue into a comment draft that is ready to paste/post:

  • one idea per comment
  • include why it matters and a concrete suggestion
  • avoid bikeshedding; keep tone constructive

4) Stage D: prioritize

Assign each comment a criticality:

  • critical: must-fix
  • optional: should-fix
  • trivial: nice-to-fix

5) Stage E: show only critical + optional, then optionally post

  1. Show the user only critical + optional comments.
  2. Ask for explicit confirmation before posting:

"Post these to the PR now? (yes/no)"

  1. If user says yes:
  • Post inline comments for items with reliable path + line + side.
  • Post one summary timeline comment that includes all critical + optional items.
  • Do not post trivial items.

Posting comments with gh

Summary timeline comment (PR is an issue)

Use the Issues API to post one summary comment:

bash
gh api -X POST "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments" \
  -f body="<summary markdown>"

Endpoint reference: POST /repos/{owner}/{repo}/issues/{issue_number}/comments.

Inline (line-level) review comments

Use the Pull Request Review Comments API:

bash
SHA="$(gh pr view <PR> --json headRefOid -q .headRefOid)"

gh api -X POST "repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments" \
  -f body="<comment markdown>" \
  -f commit_id="$SHA" \
  -f path="path/to/file.py" \
  -F line=42 \
  -f side=RIGHT

Endpoint reference: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments.

Mapping a unified diff to (path, line, side)

Inline comments require an exact file path, a line number, and a side.

Use this deterministic approach for unified diffs:

  • Each hunk header looks like @@ -old_start,old_count +new_start,new_count @@.

  • Initialize counters: old_line = old_start, new_line = new_start.

  • Walk each subsequent hunk line:

    • If the line starts with ' ' (context): increment both old_line and new_line.
    • If the line starts with '+' (addition): increment new_line only.
    • If the line starts with '-' (deletion): increment old_line only.
  • To comment on the new code, use side=RIGHT and set line=new_line.

  • To comment on a deletion, use side=LEFT and set line=old_line.

If you cannot reliably determine line/side (for example, complex hunks or uncertainty), do not post an inline comment. Include the item only in the summary timeline comment.

よくある質問

AIスキル「Gh Pr Code Review」では何ができますか?

PR code review workflow: pull diff, two-pass findings, draft and prioritize comments, then optionally post via gh api.

TypingMindでGh Pr Code Reviewを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Gh Pr Code Reviewはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにGh Pr Code Reviewをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/ericmjl/skills/tree/main/skills/gh-pr-code-reviewを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Gh Pr Code Reviewを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Gh Pr Code Reviewは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもGh Pr Code Reviewを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Gh Pr Code Review」は無料ですか?

はい。ericmjlがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇