| name | pr-workflow |
| description | This skill should be used when the user asks to "respond to PR review", "check CodeRabbit comments", "get review comments", "look at PR comments", "PRレビュー対応", "CodeRabbitの指摘を確認", "レビューコメントを取得", "PR |
| version | 1.0.0 |
PR Workflow
GitHub PRレビューコメントの取得・分析・対応を効率化するスキル。
制約
{
"constraints": {
"禁止事項": [
"コメント取得前に修正を開始しない",
"3種類のコメント(inline/reviews/conversation)すべて確認せずに「対応完了」としない",
"Push はユーザー明示指示があるまで実行しない",
"対応理由を説明せずに「対応不要」と判断しない"
],
"検証": {
"修正後は必ず実行": ["npm run typecheck", "npm run build"]
}
}
}
クイックコマンド
変数設定
PR=<number>
REPO=reconstyle/cctelepathy
全コメント件数確認(最初に実行)
# 3種類のコメント件数を一括確認
echo "=== Comment Summary ===" && \
echo -n "Inline comments: " && gh api "repos/$REPO/pulls/$PR/comments" --jq 'length' && \
echo -n "Reviews with body: " && gh api "repos/$REPO/pulls/$PR/reviews" --jq '[.[] | select(.body and (.body | length > 0))] | length' && \
echo -n "Issue comments: " && gh api "repos/$REPO/issues/$PR/comments" --jq 'length'
1. インラインコメント取得
gh api "repos/$REPO/pulls/$PR/comments" \
--jq '.[] | {file:.path, line:.line, author:.user.login, body:.body}'
2. レビュー本文取得(Nitpicks含む)
# CodeRabbit のレビュー本文を取得(Nitpicks はここに含まれる)
gh api "repos/$REPO/pulls/$PR/reviews" \
--jq '.[] | select(.body and (.body | length > 0)) | {author: .user.login, state: .state, body: .body}'
重要: CodeRabbit は "Actionable comments" をインラインで、"Nitpick comments" をレビュー本文内に記載する
3. PR会話コメント取得
# issues API を使用(pulls API より確実)
gh api "repos/$REPO/issues/$PR/comments" \
--jq '.[] | {author:.user.login, body:.body}'
ワークフロー
{
"steps": [
{ "id": 1, "action": "変数設定 (PR, REPO)" },
{ "id": 2, "action": "3種類のコメント取得" },
{ "id": 3, "action": "優先度分類" },
{ "id": 4, "action": "修正実施" },
{ "id": 5, "action": "検証 (typecheck, build)" },
{ "id": 6, "action": "コミット (gitmoji使用)" },
{ "id": 7, "action": "Push (ユーザー承認後)" },
{ "id": 8, "action": "コメント返信 (任意)" }
]
}
優先度ガイドライン
| Priority | 対応 | 例 |
|---|---|---|
| P1 Critical | 必ず修正 | セキュリティ、ビルド失敗、ランタイムエラー |
| P2 Major | 評価の上対応 | 型エラー、欠落プロパティ |
| P3 Minor | 評価の上対応 | コードスタイル、命名 |
| Nitpick | 評価の上対応 | 好み、提案 |
原則: P1以外は「評価の上、明確な反対理由がない限りは対応」
取得漏れ防止チェックリスト
| API | 内容 | 備考 |
|---|---|---|
gh api repos/$REPO/pulls/$PR/comments |
インラインコメント | Actionable comments |
gh api repos/$REPO/pulls/$PR/reviews |
レビュー本文 | Nitpicks はここに含まれる |
gh api repos/$REPO/issues/$PR/comments |
PR会話コメント | issues API を使用 |
CodeRabbit レビュー構造:
Actionable comments posted: N→ インラインコメントとして投稿🧹 Nitpick comments (N)→ レビュー本文内に HTML 形式で記載
返信テンプレート
個別コメントへの返信
# コメントID取得
gh api "repos/$REPO/pulls/$PR/comments" \
--jq '.[] | {id:.id, path:.path, body:.body}'
# 返信
gh api "repos/$REPO/pulls/$PR/comments/{COMMENT_ID}/replies" \
-f body="対応しました。{修正内容}"
PR全体への返信
gh pr comment $PR --body "## Review Response
### Addressed
✅ {file}:{line} - {description}
### Skipped (with rationale)
⏭️ {issue} - {reason}"
TypeScript 固有の確認
レビュー対応後、以下を必ず確認:
# 型チェック
npm run typecheck
# ビルド
npm run build
# CLIテスト
node dist/bin/cli.js --help
Definition of Done (DoD)
機能が「完了」とみなされる条件:
- 実装完了: 要件を満たすコードが書かれている
- テスト作成:
- Unit/Component tests: 各Issue/PRに対応するテストを作成し、
npm testで pass すること - Integration tests: 複数コンポーネントの連携を検証するテスト(必要に応じて)
- Unit/Component tests: 各Issue/PRに対応するテストを作成し、
- 型チェック通過:
npm run typecheckがエラーなし - ビルド成功:
npm run buildが成功 - ドキュメント更新: 必要に応じて更新
重要: テストなしで「Done」にしない。テストはDoDの必須要件。
Development Workflows
PRレビュー対応には2つのワークフロー選択肢があります:
Individual PR Workflow
Pattern: 1 issue → 1 branch → 1 PR
- 明確な帰属、簡単なロールバック
- 独立したIssueに最適
Integrated PR Workflow
Pattern: N related issues → 1 integration branch → 1 PR
- 文脈的レビュー、rate limit削減
- 密接に関連するIssue群に最適
ワークフロー選択
Decision Framework を参照してください。
詳細ドキュメント
- Common Principles - 両ワークフロー共通の原則
- Individual PR Workflow - 1 issue → 1 PR パターン
- Integrated PR Workflow - N issues → 1 PR パターン
- Error Principles - エラー時の原則
- Decision Framework - ワークフロー選択と判断基準