commit-push-pr
変更をコミットし、リモートにプッシュし、プルリクエストを作成します。ユーザーが「コミットしてPR作成」「変更をプッシュしてPR」などと指示した際に使用します。
When & Why to Use This Skill
The Commit-Push-PR skill is a powerful automation tool designed to streamline the Git development workflow. It handles the end-to-end process of staging changes, generating context-aware commit messages, pushing to remote repositories, and opening comprehensive GitHub Pull Requests. By leveraging AI to analyze code diffs, it ensures high-quality documentation and reduces the manual overhead of repetitive CLI tasks.
Use Cases
- Automated Feature Submission: Quickly move from local development to a remote Pull Request by automating the 'add-commit-push-pr' sequence with a single natural language prompt.
- AI-Generated Documentation: Automatically create descriptive, 'why'-focused commit messages and detailed PR summaries that include change logs and test plans based on actual code modifications.
- Workflow Standardization: Maintain project consistency by using standardized PR templates and ensuring that every submission includes necessary metadata and generated-by-Claude attribution.
- Efficient Branch Management: Simplify the process of pushing new local branches to origin and setting up upstream tracking without manually typing complex Git flags.
| name | commit-push-pr |
|---|---|
| description | 変更をコミットし、リモートにプッシュし、プルリクエストを作成します。ユーザーが「コミットしてPR作成」「変更をプッシュしてPR」などと指示した際に使用します。 |
Commit-Push-PR Skill
このスキルは、Git操作のワークフロー(コミット→プッシュ→PR作成)を自動化します。
実行手順
1. 変更の確認
まず、現在の変更状況を確認します:
git status
git diff
git log -3 --oneline
2. 変更のステージングとコミット
変更をステージングし、適切なコミットメッセージでコミットします:
# 変更をステージング
git add <変更されたファイル>
# コミット(適切なメッセージで)
git commit -m "$(cat <<'EOF'
<コミットメッセージ>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
EOF
)"
3. リモートへプッシュ
現在のブランチをリモートにプッシュします:
# 新しいブランチの場合は -u オプションを付ける
git push -u origin <branch-name>
# 既存のブランチの場合
git push
4. プルリクエストの作成
GitHub CLIを使用してPRを作成します:
gh pr create --title "<PR タイトル>" --body "$(cat <<'EOF'
## 概要
<変更内容の要約>
## 変更詳細
<詳細な説明>
## テスト計画
- [ ] <テスト項目1>
- [ ] <テスト項目2>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
重要な注意事項
コミットメッセージの作成
- 変更の「なぜ」を重視した簡潔なメッセージ(1-2文)
- プロジェクトの既存のコミットスタイルに従う
- 日本語または英語(プロジェクトの慣例に合わせる)
PR本文の作成
- 全ての関連コミット(最新だけでなく)を分析してPR全体の概要を作成
git log [base-branch]...HEADとgit diff [base-branch]...HEADで変更範囲を確認- 概要は1-3箇条書き
- テスト計画をチェックリストで提供
セキュリティ
.env、credentials.jsonなどの機密ファイルはコミットしない- pre-commitフックが失敗した場合は、修正後に新しいコミットを作成(amendは使用しない)
- force pushは使用しない(ユーザーが明示的に要求した場合を除く)
使用例
ユーザー: 「変更をコミットしてPR作成して」
→ このスキルが自動的に適用され、上記の手順を実行
実行後
PRのURLをユーザーに提示します。