github-pr について
github-prは、GitHub CLIでPull Requestを準備・作成するスキルです。規約に沿ったタイトル、構造化された説明、アトミックコミット、レビュー関連のオプションを扱います。
主な機能
- 01規約に沿ったPRタイトル形式
- 02構造化されたPR説明テンプレート
- 03アトミックコミットの指針
- 04gh pr createコマンド例
- 05レビュアー、ラベル、ドラフトの指定
- 06曖昧なタイトルや大規模PRを避ける指針
活用シーン
- 01明確なPRタイトルと説明の作成
- 02ghでのドラフトPR作成
- 03変更をアトミックコミットに整理
- 04PRへのレビュアーやラベルの追加
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ gentleman-programming/ gentleman-skills --skill github-prインストール後、Claude Code で/github-prを入力して読み込まれたか確認します。
詳細
使用する場面
- 新しいプルリクエストを作成するとき
- PR のタイトルと説明を書くとき
- レビュー用のコミットを準備するとき
gh pr createコマンドを使用するとき
重要なパターン
PR のタイトル = Conventional Commit
<type>(<scope>): <short description>
feat New feature
fix Bug fix
docs Documentation
refactor Code refactoring
test Adding tests
chore Maintenance
PR の説明の構成
## Summary
- 1-3 bullet points explaining WHAT and WHY
## Changes
- List main changes
## Testing
- [ ] Tests added/updated
- [ ] Manual testing done
Closes #123
アトミックコミット
# Good: One thing per commit
git commit -m "feat(user): add User model"
git commit -m "feat(user): add UserService"
git commit -m "test(user): add UserService tests"
# Bad: Everything in one commit
git commit -m "add user feature"
コード例
基本的な PR の作成
gh pr create \
--title "feat(auth): add OAuth2 login" \
--body "## Summary
- Add Google OAuth2 authentication
## Changes
- Added AuthProvider component
- Created useAuth hook
Closes #42"
HEREDOC を使った PR(複雑な説明)
gh pr create --title "feat(dashboard): add analytics" --body "$(cat <<'EOF'
## Summary
- Add real-time analytics dashboard
## Changes
- Created AnalyticsProvider
- Added LineChart, BarChart components
## Testing
- [x] Unit tests for components
- [x] Manual testing complete
## Screenshots

Closes #123
EOF
)"
ドラフト PR
gh pr create --draft \
--title "wip: refactor auth" \
--body "Work in progress"
レビュアーとラベルを指定した PR
gh pr create \
--title "feat(api): add rate limiting" \
--body "Adds rate limiting to API" \
--reviewer "user1,user2" \
--label "enhancement,api"
コマンド
# Create PR
gh pr create --title "type(scope): desc" --body "..."
# Create with web editor
gh pr create --web
# View PR status
gh pr status
# View diff
gh pr diff
# Check CI status
gh pr checks
# Merge with squash
gh pr merge --squash
# Add reviewer
gh pr edit --add-reviewer username
避けるべきパターン
避ける:曖昧なタイトル
# Bad
gh pr create --title "fix bug"
gh pr create --title "update"
# Good
gh pr create --title "fix(auth): prevent session timeout"
避ける:巨大な PR
# Bad: 50 files, 2000+ lines in one PR
# Good: Split into logical PRs
# PR 1: feat(models): add User model
# PR 2: feat(api): add user endpoints
# PR 3: feat(ui): add user pages
避ける:説明が空の PR
# Bad
--body "Added feature"
# Good
--body "## Summary
- What you did and why
## Changes
- Specific changes
Closes #123"
クイックリファレンス
| タスク | コマンド |
|---|---|
| PR を作成 | gh pr create -t "type: desc" -b "body" |
| ドラフト PR | gh pr create --draft |
| ウェブエディター | gh pr create --web |
| レビュアーを追加 | --reviewer user1,user2 |
| ラベルを追加 | --label bug,high-priority |
| Issue をリンク | 本文に Closes #123 と記載 |
| ステータスを表示 | gh pr status |
| スカッシュマージ | gh pr merge --squash |
リソース
コメント
Markdown 対応