From cook
Analyzes local Git changes and automatically creates a Draft PR with a generated description and labels.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cook:pr-createThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Git 変更分析に基づく自動 PR 作成で効率的な Pull Request ワークフローを実現します。
Git 変更分析に基づく自動 PR 作成で効率的な Pull Request ワークフローを実現します。
# 変更分析による自動 PR 作成
git add . && git commit -m "feat: ユーザー認証機能の実装"
「変更内容を分析して適切な説明文とラベルで Draft PR を作成してください」
# 既存テンプレート保持での更新
cp .github/PULL_REQUEST_TEMPLATE.md pr_body.md
「テンプレート構造を完全に保持して変更内容を補完してください」
# 段階的品質向上
gh pr ready
「品質確認完了後、Ready for Review に変更してください」
# 1. ブランチ作成とコミット
git checkout main && git pull
git checkout -b feat-user-profile
git add . && git commit -m "feat: ユーザー プロフィール機能の実装"
git push -u origin feat-user-profile
# 2. PR 作成
「以下の手順で PR を作成してください:
1. git diff --cached で変更内容を確認
2. .github/PULL_REQUEST_TEMPLATE.md を使用して説明文を作成
3. 変更内容から適切なラベルを最大 3 個選択
4. Draft PR として作成 (HTML コメント保持)」
# 3. CI 確認後に Ready 化
「CI が通ったら PR を Ready for Review に変更してください」
# ガイドラインに従った命名規則: {type}-{subject}
git checkout main
git pull
git checkout -b feat-user-authentication
# ブランチ確認 (現在のブランチ名を表示)
git branch --show-current
# 変更をステージング
git add .
# ガイドラインに従ったコミットメッセージ
git commit -m "feat: ユーザー認証 API の実装"
# 初回 Push(upstream 設定)
git push -u origin feat-user-authentication
# 2 回目以降
git push
Step 1: 変更内容の分析
# ファイル変更の取得 (ステージ済み変更を確認)
git diff --cached --name-only
# 内容分析 (最大 1000 行)
git diff --cached | head -1000
Step 2: 説明文の自動生成
# テンプレート処理の優先順位
# 1. 既存 PR 説明 (完全保持)
# 2. .github/PULL_REQUEST_TEMPLATE.md
# 3. デフォルトテンプレート
cp .github/PULL_REQUEST_TEMPLATE.md pr_body.md
# HTML コメント・区切り線を保持したまま空セクションのみ補完
Step 3: ラベルの自動選択
# 利用可能ラベルの取得 (非インタラクティブ)
「.github/labels.yml または GitHub リポジトリから利用可能なラベルを取得して、変更内容に基づいて適切なラベルを自動選択してください」
# パターンマッチングによる自動選択 (最大 3 個)
# - ドキュメント: *.md, docs/ → documentation|docs
# - テスト: test, spec → test|testing
# - バグ修正: fix|bug → bug|fix
# - 新機能: feat|feature → feature|enhancement
Step 4: GitHub API での PR 作成 (HTML コメント保持)
# PR 作成
「以下の情報で Draft PR を作成してください:
- タイトル: コミットメッセージから自動生成
- 説明文: .github/PULL_REQUEST_TEMPLATE.md を使用して適切に記入
- ラベル: 変更内容から自動選択 (最大 3 個)
- ベースブランチ: main
- HTML コメントは完全に保持」
方法 B: GitHub MCP(フォールバック)
// HTML コメント保持での PR 作成
mcp__github__create_pull_request({
owner: "organization",
repo: "repository",
base: "main",
head: "feat-user-authentication",
title: "feat: ユーザー認証の実装",
body: prBodyContent, // HTML コメントを含む完全な内容
draft: true,
maintainer_can_modify: true,
});
*.md, README, docs/ → documentation|docs|doctest, spec → test|testing.github/, *.yml, Dockerfile → ci|build|infra|opspackage.json, pubspec.yaml → dependencies|depsfix|bug|error|crash|修正 → bug|fixfeat|feature|add|implement|新機能|実装 → feature|enhancement|featrefactor|clean|リファクタ → refactor|cleanup|cleanperformance|perf|optimize → performance|perfsecurity|secure → security.github/PULL_REQUEST_TEMPLATE.md を必ず使用{type}-{subject}
例:
- feat-user-profile
- fix-login-error
- refactor-api-client
{type}: {description}
例:
- feat: ユーザー認証 API の実装
- fix: ログイン エラーの修正
- docs: README の更新
.github/PULL_REQUEST_TEMPLATE.md 構造を維持<!-- Copilot review rule --> などを維持<!-- ... --> を完全に保持--- などの構造を維持重要: GitHub CLI (gh pr edit) は HTML コメントを自動エスケープし、シェル処理で EOF < /dev/null などの不正な文字列が混入する場合があります。
根本的解決策:
# 変更後の再コミット
git add .
git commit -m "fix: レビュー フィードバックに基づく修正"
git push
gh pr edit は HTML コメントをエスケープ、不正文字列混入--field オプションで適切なエスケープ処理.github/labels.yml 定義外のラベル作成不可gh pr checks で状態確認gh pr readynpx claudepluginhub wasabeef/claude-code-cookbook --plugin cookAutomates PR creation by analyzing git changes, selecting labels, and generating descriptions from templates. Supports draft PRs and CI-ready workflows.
Automates pull request creation by analyzing Git changes, generating descriptions from templates, and selecting labels. Invoke with 'criar PR' or 'abrir pull request'.
Creates pull requests by analyzing Git changes, auto-generating descriptions from templates, and selecting labels based on file patterns.