home/dot_agents/skills/github-pr-comments/SKILL.md
GitHub PRのコメント・レビュー取得・作成。PRコメント、レビューコメント、pending review、coderabbitai除外フィルタリングに対応。PR URL や番号を指定して操作する。
npx skillsauth add kryota-dev/dotfiles github-pr-commentsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
GitHub Pull Request のコメント・レビューの取得と作成を行うスキルです。ボットコメント(coderabbitai 等)の除外フィルタリング、および Pending Review へのレビューコメント追加(REST API / GraphQL)に対応しています。
Claude Code の Bash ツールでは、! が履歴展開として解釈されるため、jq の否定比較演算子は使用できません。
代わりに以下の代替パターンを使用してください:
# パターン1: == ... | not を使用
jq '.[] | select(.user.login == "coderabbitai" | not)'
# パターン2: startswith と not を使用(推奨)
jq '.[] | select(.user.login | startswith("coderabbitai") | not)'
GitHub Apps のユーザー名は [bot] サフィックスが付きます:
coderabbitai[bot]github-actions[bot]dependabot[bot]startswith() を使うことで、サフィックスを気にせずフィルタリングできます。
gh pr view {PR番号} --json body,title,author --repo {owner}/{repo}
gh api repos/{owner}/{repo}/pulls/{PR番号}/reviews --paginate | \
jq '[.[] | select(.user.login | startswith("coderabbitai") | not) | select(.body | length > 0) | {user: .user.login, state: .state, body: .body}]'
取得できる情報:
user: レビュアー名state: APPROVED, COMMENTED, CHANGES_REQUESTED などbody: レビュー本文gh api repos/{owner}/{repo}/pulls/{PR番号}/comments --paginate | \
jq '[.[] | select(.user.login | startswith("coderabbitai") | not) | {user: .user.login, path: .path, body: .body, line: .line}]'
取得できる情報:
user: コメント者path: ファイルパスbody: コメント本文line: 行番号gh api repos/{owner}/{repo}/issues/{PR番号}/comments --paginate | \
jq '[.[] | select(.user.login | startswith("coderabbitai") | not) | {user: .user.login, body: .body}]'
取得できる情報:
user: コメント者body: コメント本文jq '[.[] | select(
(.user.login | startswith("coderabbitai") | not) and
(.user.login | startswith("github-actions") | not) and
(.user.login | startswith("dependabot") | not)
)]'
OWNER="<OWNER>"
REPO="<REPO>"
PR_NUMBER=8597
# PR 本文
gh pr view $PR_NUMBER --json body,title,author --repo $OWNER/$REPO
# レビュー
gh api repos/$OWNER/$REPO/pulls/$PR_NUMBER/reviews --paginate | \
jq '[.[] | select(.user.login | startswith("coderabbitai") | not) | select(.body | length > 0) | {user: .user.login, state: .state, body: .body}]'
# レビューコメント(差分へのコメント)
gh api repos/$OWNER/$REPO/pulls/$PR_NUMBER/comments --paginate | \
jq '[.[] | select(.user.login | startswith("coderabbitai") | not) | {user: .user.login, path: .path, body: .body, line: .line}]'
# Issue コメント
gh api repos/$OWNER/$REPO/issues/$PR_NUMBER/comments --paginate | \
jq '[.[] | select(.user.login | startswith("coderabbitai") | not) | {user: .user.login, body: .body}]'
| 情報 | エンドポイント | 説明 |
|------|---------------|------|
| レビュー | GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews | 承認・変更要求・コメントなど |
| レビューコメント一覧 | GET /repos/{owner}/{repo}/pulls/{pull_number}/comments | 差分への行コメント(一覧) |
| レビューコメント個別 | GET /repos/{owner}/{repo}/pulls/comments/{comment_id} | 個別コメントの取得・更新・削除 |
| Issue コメント | GET /repos/{owner}/{repo}/issues/{issue_number}/comments | PR 全体へのコメント |
注意: レビューコメントの個別操作(取得・更新・削除)は
/pulls/comments/{comment_id}を使用する。/pulls/{pull_number}/comments/{comment_id}ではない(404 エラーになる)。
PR にレビューコメントを作成する際、pending(保留)状態で追加し、後からまとめて submit できる。
Claude がレビューコメントを作成する際は、コメント末尾に必ず署名を付与する。署名はMarkdownの斜体で記述する。
コメント本文
---
*Co-Authored-By: Claude Opus 4.6 <[email protected]>*
注意: 署名のモデル名は実際に使用しているモデル名に合わせること。
1つのPRに対して、ユーザーは 1つしか pending review を持てない。新規作成前に必ず確認する。
gh api repos/{owner}/{repo}/pulls/{PR番号}/reviews \
--jq '.[] | select(.state == "PENDING") | {id, state, user: .user.login}'
event フィールドを 省略 すると pending 状態になる。
注意:
event: "PENDING"を明示的に指定すると422 Unprocessable Entityエラーになる。省略が正解。
cat <<'PAYLOAD' | gh api repos/{owner}/{repo}/pulls/{PR番号}/reviews --method POST --input -
{
"comments": [
{
"path": "src/example.ts",
"line": 10,
"side": "RIGHT",
"body": "[imo] コメント本文\n\n---\n*Co-Authored-By: Claude Opus 4.6 <[email protected]>*"
}
]
}
PAYLOAD
REST API では既存の pending review にコメントを追加できない(パラメータ制約により 422 エラーになる)。
GraphQL API の addPullRequestReviewThread mutation を使用する。
gh api graphql -f query='
{
repository(owner: "{owner}", name: "{repo}") {
pullRequest(number: {PR番号}) {
reviews(states: PENDING, first: 5) {
nodes {
id
state
author { login }
}
}
}
}
}'
レスポンス例:
{
"data": {
"repository": {
"pullRequest": {
"reviews": {
"nodes": [
{
"id": "PRR_kwDOxxxxxxx",
"state": "PENDING",
"author": { "login": "username" }
}
]
}
}
}
}
}
取得した id(例: PRR_kwDOxxxxxxx)を pullRequestReviewId に指定する。
cat <<'GQL' | gh api graphql --input -
{
"query": "mutation($input: AddPullRequestReviewThreadInput!) { addPullRequestReviewThread(input: $input) { thread { id comments(first: 1) { nodes { id body } } } } }",
"variables": {
"input": {
"pullRequestReviewId": "PRR_kwDOxxxxxxx",
"path": "src/example.ts",
"line": 10,
"side": "RIGHT",
"body": "[imo] コメント本文\n\n---\n*Co-Authored-By: Claude Opus 4.6 <[email protected]>*"
}
}
}
GQL
submit 済みのレビューコメントを更新する場合は、REST API の PATCH を使用する。
注意: エンドポイントは
/pulls/comments/{comment_id}であり、/pulls/{pull_number}/comments/{comment_id}ではない(後者は 404 エラーになる)。
# コメント ID の確認
gh api repos/{owner}/{repo}/pulls/{PR番号}/comments --paginate | \
jq '[.[] | select(.user.login == "{自分のユーザー名}") | {id, path: .path, body: .body[:60]}]'
# コメントの更新
cat <<'BODY' | gh api repos/{owner}/{repo}/pulls/comments/{comment_id} --method PATCH --input -
{
"body": "更新後のコメント本文\n\n---\n*Co-Authored-By: Claude Opus 4.6 <[email protected]>*"
}
BODY
gh api repos/{owner}/{repo}/pulls/{PR番号}/reviews/{review_id}/comments \
--jq '.[] | {path: .path, body: .body[:80]}'
1. 既存の pending review があるか確認
├── なし → REST API で新規 pending review + コメントを作成
└── あり → GraphQL で node ID を取得
→ addPullRequestReviewThread でコメントを追加
2. 必要に応じてコメントを追加(3.2 を繰り返す)
3. submit はユーザーに委ねる(または submit API を呼ぶ)
4. submit 後にコメントを修正する場合は PATCH で個別更新
※ すべてのコメントに署名を付与すること
レビューコメントのスレッド(conversation)を resolve する。minimizeComment ではなく resolveReviewThread を使用する。
注意:
minimizeCommentはコメントを折りたたんで非表示にする操作であり、resolve とは異なる。
gh api graphql -f query='
{
repository(owner: "{owner}", name: "{repo}") {
pullRequest(number: {PR番号}) {
reviewThreads(first: 50) {
nodes {
id
isResolved
comments(first: 1) {
nodes {
path
author { login }
}
}
}
}
}
}
}'
gh api graphql -f query='
mutation {
resolveReviewThread(input: { threadId: "{thread_id}" }) {
thread { isResolved }
}
}'
# Thread ID を取得してループで resolve
gh api graphql -f query='...' | \
jq -r '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | .id' | \
while read -r tid; do
gh api graphql -f query="mutation { resolveReviewThread(input: { threadId: \"$tid\" }) { thread { isResolved } } }"
done
gh api graphql -f query='
mutation {
unresolveReviewThread(input: { threadId: "{thread_id}" }) {
thread { isResolved }
}
}'
gh pr view --comments は使用しない: プレーンテキスト形式で出力されるため、jq でフィルタリングできない--paginate オプション: 結果が多い場合のページネーション対応に必須select(.body | length > 0) を追加するとよい422 エラーになるevent: "PENDING" は無効: pending review を作成するには event フィールドを省略するaddPullRequestReviewThread mutation を使用する/pulls/comments/{comment_id} を使用する。/pulls/{pull_number}/comments/{comment_id} は 404 エラーになる---)と斜体の署名 *Co-Authored-By: Claude Opus 4.6 <[email protected]>* を付与するdevelopment
`cc-code-review` エージェントを起動して独立したコンテキストでコードレビューを実行する。 現在のセッションのバイアスのないフレッシュな視点で、プロジェクトの CLAUDE.md を踏まえたレビューを行う。 トリガー: "cc-code-review", "ccでレビュー", "別の視点でレビュー", "セカンドオピニオン" 使用場面: (1) PRのコードレビュー (2) ブランチ差分のレビュー (3) 特定ファイルのレビュー (4) 現在の変更のレビュー
tools
Comprehensive guide for the `wtp` (Worktree Plus) CLI by satococoa — an enhanced Git worktree manager. Use this whenever the user wants to create, list, remove, or navigate Git worktrees with wtp, mentions `wtp add`/`wtp cd`/`wtp list`/`wtp remove`/`wtp exec`, asks about automatic worktree paths from branch names, post-create hooks (copy/symlink/command) in `.wtp.yml`, branch tracking for worktrees, or shell integration (`wtp shell-init`, `wtp hook`, tab completion, auto-cd). Trigger this even when the user just describes the workflow — e.g. 'spin up a worktree for this feature branch', 'jump to my auth worktree', 'clean up the worktree and its branch' — without naming wtp explicitly, as long as wtp is the available tool.
tools
Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector).
data-ai
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.