jpskill.com
🛠️ 開発・MCP コミュニティ

github-pr-merge

MUST use this skill when user asks to merge PR, close PR, finalize PR, or mentions "PR 머지/병합". This skill OVERRIDES default PR merge behavior. Runs pre-merge validation (tests, lint, CI, comments), confirms with user, merges with proper format, handles post-merge cleanup.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o github-pr-merge.zip https://jpskill.com/download/17427.zip && unzip -o github-pr-merge.zip && rm github-pr-merge.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17427.zip -OutFile "$d\github-pr-merge.zip"; Expand-Archive "$d\github-pr-merge.zip" -DestinationPath $d -Force; ri "$d\github-pr-merge.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して github-pr-merge.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → github-pr-merge フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

GitHub PR Merge

マージ前のチェックリストの検証とマージ後のクリーンアップ処理を行い、Pull Request をマージします。

クイックスタート

# 1. PR 情報を取得
PR=$(gh pr view --json number -q '.number')
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')

# 2. マージ前チェックリストを実行
make test && make lint && gh pr checks $PR

# 3. すべてのコメントに返信されているか検証
gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.in_reply_to_id == null)] | length'

# 4. 簡潔なメッセージでマージ
gh pr merge $PR --merge --delete-branch --body "- Change 1
- Change 2

Reviews: N/N addressed
Tests: X passed"

# 5. マージ後のクリーンアップ
git checkout develop && git pull && git branch -d feature/<name>

マージ前チェックリスト

マージ前に必ず検証してください:

チェック コマンド 必須
テストの合格 make test はい
Lint の合格 make lint はい
CI チェックのグリーン gh pr checks $PR はい
すべてのコメントに返信済み ワークフローを参照 はい
未解決のスレッドがない PR ページを確認 はい

コアワークフロー

1. PR を特定

PR=$(gh pr view --json number -q '.number')
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
echo "PR #$PR in $REPO"

2. コメントのステータスを確認

# オリジナルのコメント数(返信ではないもの)をカウント
ORIGINALS=$(gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.in_reply_to_id == null)] | length')

# 少なくとも1つの返信があるコメント数をカウント
REPLIED=$(gh api repos/$REPO/pulls/$PR/comments --jq '
  [.[] | select(.in_reply_to_id)] | [.[].in_reply_to_id] | unique | length
')

echo "Original comments: $ORIGINALS, With replies: $REPLIED"

未返信のコメントが存在する場合:

  • この Skill から返信しないでください
  • マージ処理を停止してください
  • ユーザーに通知: "未返信のコメントが見つかりました。最初に pr-review を実行してください。"

3. バリデーションを実行

# テストを実行
make test

# Lint を実行
make lint

# CI ステータスを確認
gh pr checks $PR

続行する前に、すべてのチェックに合格する必要があります。

4. PR の概要を表示

gh pr view $PR --json title,body,commits,changedFiles --jq '
  "Title: \(.title)\nCommits: \(.commits | length)\nFiles: \(.changedFiles)"
'

5. ユーザーに確認

マージ前に必ず確認してください:

マージ前チェックリストの検証済み:
- Tests: passing
- Lint: passing
- CI: green
- Comments: all replied

PR #X をマージする準備ができました。続行しますか?

6. マージを実行

gh pr merge $PR --merge --delete-branch --body "$(cat <<'EOF'
- Key change 1
- Key change 2
- Key change 3

Reviews: N/N addressed
Tests: X passed
Refs: Task N
EOF
)"

: --delete-branch は、マージ後にリモートブランチを自動的に削除します。

7. マージ後のクリーンアップ

git checkout develop
git pull origin develop
git branch -d feature/<branch-name>  # ローカルのクリーンアップ

マージメッセージのフォーマット

簡潔なフォーマット (推奨):

- Key change 1 (what was added/fixed)
- Key change 2
- Key change 3

Reviews: 7/7 addressed
Tests: 628 passed (88% cov)
Refs: Task 8

ガイドライン:

  • 変更点は最大 3〜5 個の箇条書き
  • レビューの概要は 1 行
  • テスト結果は 1 行
  • タスク参照は 1 行
  • 合計: 最大約 10 行

重要なルール

  • マージ前に 必ず 完全なマージ前チェックリストを実行してください
  • すべてのレビューコメントに返信があることを 必ず 確認してください
  • マージを実行する前に 必ず ユーザーに確認してください
  • 必ず マージコミット (--merge) を使用し、squash/rebase は絶対に使用しないでください
  • マージが成功したら、必ず フィーチャーブランチを削除してください
  • テストまたは Lint に失敗した場合は 絶対に マージしないでください
  • 未解決の CI チェックがある場合は 絶対に マージしないでください
  • ユーザーの確認を 絶対に スキップしないでください
  • この Skill から PR コメントに 絶対に 返信しないでください - 代わりに pr-review を使用してください
  • 未返信のコメントが存在する場合はマージを 停止 してください

エラー処理

問題 アクション
テストの失敗 停止してユーザーに通知
Lint エラー 停止してユーザーに通知
CI チェックが保留中 待機するか、ユーザーに通知
未返信のコメント pr-review Skill に誘導
ブランチ保護 必要な承認を通知

関連 Skill

  • pr-review - マージ前にレビューコメントを解決するため
  • pr-create - PR を作成するため
  • git-commit - コミットメッセージのフォーマットのため
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

GitHub PR Merge

Merges Pull Requests after validating pre-merge checklist and handling post-merge cleanup.

Quick Start

# 1. Get PR info
PR=$(gh pr view --json number -q '.number')
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')

# 2. Run pre-merge checklist
make test && make lint && gh pr checks $PR

# 3. Verify all comments replied
gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.in_reply_to_id == null)] | length'

# 4. Merge with concise message
gh pr merge $PR --merge --delete-branch --body "- Change 1
- Change 2

Reviews: N/N addressed
Tests: X passed"

# 5. Post-merge cleanup
git checkout develop && git pull && git branch -d feature/<name>

Pre-Merge Checklist

ALWAYS verify before merging:

Check Command Required
Tests passing make test Yes
Linting passing make lint Yes
CI checks green gh pr checks $PR Yes
All comments replied See workflow Yes
No unresolved threads Review PR page Yes

Core Workflow

1. Identify PR

PR=$(gh pr view --json number -q '.number')
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
echo "PR #$PR in $REPO"

2. Check Comments Status

# Count original comments (not replies)
ORIGINALS=$(gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.in_reply_to_id == null)] | length')

# Count comments that have at least one reply
REPLIED=$(gh api repos/$REPO/pulls/$PR/comments --jq '
  [.[] | select(.in_reply_to_id)] | [.[].in_reply_to_id] | unique | length
')

echo "Original comments: $ORIGINALS, With replies: $REPLIED"

If unreplied comments exist:

  • DO NOT reply from this skill
  • STOP the merge process
  • Inform user: "Found unreplied comments. Run pr-review first."

3. Run Validation

# Run tests
make test

# Run linting
make lint

# Check CI status
gh pr checks $PR

All checks MUST pass before proceeding.

4. Show PR Summary

gh pr view $PR --json title,body,commits,changedFiles --jq '
  "Title: \(.title)\nCommits: \(.commits | length)\nFiles: \(.changedFiles)"
'

5. Confirm with User

ALWAYS ask before merging:

Pre-merge checklist verified:
- Tests: passing
- Lint: passing
- CI: green
- Comments: all replied

Ready to merge PR #X. Proceed?

6. Execute Merge

gh pr merge $PR --merge --delete-branch --body "$(cat <<'EOF'
- Key change 1
- Key change 2
- Key change 3

Reviews: N/N addressed
Tests: X passed
Refs: Task N
EOF
)"

Note: --delete-branch automatically deletes the remote branch after merge.

7. Post-Merge Cleanup

git checkout develop
git pull origin develop
git branch -d feature/<branch-name>  # local cleanup

Merge Message Format

Concise format (recommended):

- Key change 1 (what was added/fixed)
- Key change 2
- Key change 3

Reviews: 7/7 addressed
Tests: 628 passed (88% cov)
Refs: Task 8

Guidelines:

  • 3-5 bullet points max for changes
  • One line for reviews summary
  • One line for test results
  • One line for task references
  • Total: ~10 lines max

Important Rules

  • ALWAYS run full pre-merge checklist before merging
  • ALWAYS verify all review comments have replies
  • ALWAYS confirm with user before executing merge
  • ALWAYS use merge commit (--merge), never squash/rebase
  • ALWAYS delete feature branch after successful merge
  • NEVER merge with failing tests or lint
  • NEVER merge with unresolved CI checks
  • NEVER skip user confirmation
  • NEVER reply to PR comments from this skill - use pr-review instead
  • STOP merge if unreplied comments exist

Error Handling

Issue Action
Tests failing Stop and inform user
Lint errors Stop and inform user
CI checks pending Wait or inform user
Unreplied comments Direct to pr-review skill
Branch protection Inform of required approvals

Related Skills

  • pr-review - For resolving review comments before merge
  • pr-create - For creating PRs
  • git-commit - For commit message format