github-copilot-agent-tips-and-tricks について
gh-awでGitHub Copilotのコーディングエージェントによるプルリクエストを検索、レビュー、追跡するためのガイドです。GitHub CLIやGitでの検索、確認項目、トラブルシューティングを扱います。
主な機能
- 01作成者やブランチ接頭辞でPRを検索
- 02GitHub CLIとjqによるPRの絞り込み
- 03ブランチとコミット履歴の検索
- 04PRのメタデータと差分の確認
- 05検索と認証の問題への対処
活用シーン
- 01CopilotコーディングエージェントのPR特定
- 02マージ前のCopilot PR変更内容のレビュー
- 03Copilotの貢献状況の継続的な追跡
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ github/ gh-aw --skill github-copilot-agent-tips-and-tricksインストール後、Claude Code で/github-copilot-agent-tips-and-tricksを入力して読み込まれたか確認します。
詳細
GitHub Copilot エージェントのヒントとコツ
このガイドでは、gh-aw の Copilot コーディングエージェントのプルリクエストを見つけ、確認し、作業する方法を説明します。
Copilot エージェントの PR を特定する
ブランチの命名規則
Copilot コーディングエージェントのブランチには copilot/ というプレフィックスが付くため、簡単に特定して絞り込めます。
このリポジトリの例:
copilot/add-cache-for-imported-workflowscopilot/fix-istruthy-bundling-issuecopilot/update-audit-command-copilotcopilot/refactor-mcp-tool-rendering
作成者の確認
Copilot コーディングエージェントの PR は通常、次のアカウントが作成します。
app/github-copilot— GitHub Copilot ボットアカウント- Copilot をアシスタントとして使用する個々の開発者
Copilot エージェントの PR を検索する
GitHub CLI (gh) を使用する
前提条件:
# Authenticate with GitHub CLI
gh auth login
作成者で検索(GitHub Copilot ボット):
# List all PRs created by the Copilot bot
gh pr list --author "app/github-copilot" --limit 100
# Include closed PRs
gh pr list --author "app/github-copilot" --state all --limit 100
# Get detailed JSON output
gh pr list --author "app/github-copilot" --json number,title,author,headRefName,createdAt,state
ブランチのプレフィックスで検索:
# Find all PRs from copilot/* branches
gh pr list --search "head:copilot/" --state all
# Combine with other filters
gh pr list --search "head:copilot/ is:open"
gh pr list --search "head:copilot/ is:merged"
jq で絞り込む:
# Extract specific fields
gh pr list --limit 100 --json author,number,title,headRefName \
--jq '.[] | select(.headRefName | startswith("copilot/")) | {number, title, branch: .headRefName}'
# Filter by author containing "copilot"
gh pr list --limit 100 --json author,number,title \
--jq '.[] | select(.author.login | contains("copilot"))'
Git コマンドを使用する
Copilot のブランチを一覧表示する:
# Local and remote copilot branches
git branch -a | grep copilot
# Remote copilot branches only
git branch -r | grep copilot
コミット履歴を検索する:
# Find commits with "copilot" in message
git log --all --grep="copilot" --oneline
# Find commits by copilot author
git log --all --author="copilot" --oneline
# Show graph with copilot-related commits
git log --all --grep="copilot" --oneline --graph
マージ済みの Copilot PR を見つける:
# Search for merge commits
git log --all --merges --grep="copilot" --oneline
# With PR numbers
git log --all --merges --oneline | grep -i copilot
Copilot エージェントの PR によくあるパターン
gh-aw リポジトリの最近の例
このリポジトリの分析によると、Copilot コーディングエージェントの PR は通常、次のような内容に対応しています。
-
リファクタリングとコード構成
- 例:「ALL_TOOLS を分離して JSON ファイルにし、実行時にフィルタリングする」
- 例:「MCP ツールテーブルの重複したレンダリングロジックを解消する」
-
ドキュメントの改善
- 例:「スキーマで厳格モードの適用範囲と CLI フラグを説明する」
- 例:「厳格モードの包括的なリファレンスドキュメントを追加する」
-
バグ修正
- 例:「loadAgentOutput のエラー処理に関する JavaScript のテストアサーションを修正する」
- 例:「重複した formatFileSize() 関数を削除する」
-
テストの強化
- 例:「すべてのエンジンで Playwright MCP 構成の統合テストを追加する」
-
セキュリティ修正
- 例:「copilot-session-insights ワークフローのテンプレートインジェクションのリスクを修正する」
確認する PR のメタデータ
Copilot コーディングエージェントの PR をレビューするときは、次の点に注意してください。
- ブランチ名:
copilot/descriptive-nameのパターンに従っていること - コミットメッセージ:「Initial plan」コミットが含まれていることがよくあります
- PR の説明:問題と解決策が説明されていること
- リンクされた issue:対応中の issue が参照されている場合があります
ワークフローのヒント
関連する PR を見つける
# Find PRs related to a specific feature
gh pr list --search "head:copilot/ refactor" --state all
# Find PRs in a date range
gh pr list --search "head:copilot/ created:>=2024-01-01" --state all
# Find PRs with specific labels
gh pr list --search "head:copilot/ label:enhancement"
Copilot PR をレビューする
# Check out a copilot PR locally
gh pr checkout <PR-number>
# View PR diff
gh pr diff <PR-number>
# View PR details
gh pr view <PR-number>
# View PR in browser
gh pr view <PR-number> --web
Copilot の貢献を追跡する
# Count merged copilot PRs
gh pr list --author "app/github-copilot" --state merged --json number --jq 'length'
# List recent copilot PRs with dates
gh pr list --author "app/github-copilot" --state all --limit 20 \
--json number,title,createdAt,state \
--jq '.[] | "\(.number): \(.title) (\(.state)) - \(.createdAt)"'
# Export to CSV for analysis
gh pr list --author "app/github-copilot" --state all --limit 100 \
--json number,title,createdAt,state,author \
--jq -r '.[] | [.number, .title, .state, .createdAt] | @csv' > copilot-prs.csv
トラブルシューティング
認証の問題
「gh auth login」のプロンプトが表示される場合:
# Authenticate with GitHub CLI
gh auth login
# Or set token environment variable
export GH_TOKEN="your-github-token"
検索結果が見つからない
検索結果が返されない場合:
- 正しいリポジトリにいることを確認します
- 作成者名が正しいか確認します(
app/github-copilotまたはgithub-copilotを試してください) - 代わりにブランチのプレフィックスで検索します:
gh pr list --search "head:copilot/" - PR が存在するか確認します:
git branch -r | grep copilot
レート制限
GitHub API のレート制限に達した場合:
# Check rate limit status
gh api rate_limit
# Use authenticated requests (higher limits)
gh auth login
ベストプラクティス
- 作成者による検索が使えない場合は、ブランチのプレフィックスで検索する
- 追跡と分析のため、PR の一覧を定期的にエクスポートする
- Copilot の実装アプローチを理解するため、コミット履歴を確認する
- Copilot の計画プロセスを確認するため、「Initial plan」コミットをチェックする
- Copilot の PR をマージする前に、テストがパスすることを確認する
- 特にワークフローの変更では、セキュリティへの影響を確認する
追加リソース
- GitHub CLI のドキュメント:https://cli.github.com/manual/
- GitHub Copilot のドキュメント:https://docs.github.com/en/copilot
- Git のブランチフィルタリング:https://git-scm.com/docs/git-branch
- jq による JSON 処理:https://stedolan.github.io/jq/manual/
コメント
Markdown 対応