このクイック スタートでは、リポジトリの GitHub Copilot をカスタマイズする手順について説明します。 最終的に、 Copilot はプロジェクトの規則を認識し、一般的なタスク用の特殊なエージェントを持ち、プロジェクト コンテキストをキュレーションします。
**シナリオ:** 確立されたテスト スイート、コーディング規則、アクティブな問題を使用して、チームの Web アプリケーション リポジトリで作業します。
Copilotは、1 日目からコードベースを効果的に操作する必要があります。
前提条件
- CopilotプランにはCopilot クラウドエージェント (GitHub Copilot Pro+、Copilot 事業、またはCopilot Enterprise) が含まれています。 詳細については、「GitHub Copilotの計画」を参照してください。
- クラウド エージェント は、組織またはアカウントに対して有効になっています。 詳細については、「GitHub Copilot クラウド エージェントへのアクセスの管理」を参照してください。
- GitHub リポジトリへの書き込みアクセス。
手順 1: プロジェクトの規則 Copilot 教える
リポジトリのカスタム命令は Copilot プロジェクトに関する永続的なコンテキスト (構造、コーディング標準、コードのビルドとテスト方法) を提供します。 リポジトリ内のすべての Copilot 操作では、これらの手順が自動的に使用されます。
Copilot クラウドエージェント ファイルを生成するように`copilot-instructions.md`に依頼します。
1. github.com/copilot/agents に移動します。
-
プロンプト フィールドのドロップダウン メニューからリポジトリを選択します。
-
次のプロンプトを入力します。
Text Onboard this repository to Copilot cloud agent by adding a .github/copilot-instructions.md file. Include information about project structure, coding conventions, the test framework, and how to build and run the project.
Onboard this repository to Copilot cloud agent by adding a .github/copilot-instructions.md file. Include information about project structure, coding conventions, the test framework, and how to build and run the project. -
生成されたファイルを確認し、pull request をマージします。
Copilot では、チャット、コード レビュー、エージェント セッション全体にわたるプロジェクトの規則を理解できるようになりました。 「[AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions)」を参照してください。
手順 2: 特殊なエージェントを作成する
カスタム・エージェント では、定期的なタスク用のフォーカスされたアシスタントを作成できます。 この例では、バグを診断して修正するエージェントを作成します。
1. github.com/copilot/agents に移動し、リポジトリを選択します。
-
プロンプト フィールドで、[ ] をクリックします。 次に、[カスタム エージェント作成] をクリックします。
-
ファイルの名前を
bug-fixer.agent.mdに変更します。 -
テンプレートの内容を次のように置き換えます。
YAML --- name: Bug Fixer description: Diagnoses and fixes bugs reported in GitHub issues. tools: - read - edit - terminal - search --- You are a bug-fixing specialist. When given a bug report or issue: 1. Reproduce the bug by writing a failing test. 2. Identify the root cause. 3. Fix the code. 4. Verify the fix passes the test and doesn't break existing tests. Always follow the project's testing conventions and coding standards.
--- name: Bug Fixer description: Diagnoses and fixes bugs reported in GitHub issues. tools: - read - edit - terminal - search --- You are a bug-fixing specialist. When given a bug report or issue: 1. Reproduce the bug by writing a failing test. 2. Identify the root cause. 3. Fix the code. 4. Verify the fix passes the test and doesn't break existing tests. Always follow the project's testing conventions and coding standards. -
ファイルをコミットし、既定のブランチにマージします。
バグ修正エージェントが、[エージェント] タブの [エージェント] ドロップダウンに表示されるようになりました。問題の URL を貼り付ける前に選択し、フォーカスされたデバッグ セッションを開始します。 「Copilot クラウドエージェント用のカスタム エージェントの作成」を参照してください。
手順 3: スペースを使用してプロジェクト コンテキストを整理する
Copilotスペース では、プロジェクトの特定の領域に対する正確なコンテキスト Copilot ニーズをキュレーションできます。 回答は、関連するファイル、問題、ドキュメントに記載されています。
1. github.com/copilot/spaces に移動し、[スペースの作成] をクリックします。
-
スペースに名前を付けて ("API アーキテクチャ" など)、所有者を選択します。
-
[ソース追加] をクリックし、プロジェクトに関連するコンテキストを追加します。 * ** ファイルとリポジトリの追加** - アーキテクチャ ドキュメント、API スキーマ、またはキー構成ファイルを追加します。 * ** ファイル、プル要求、問題をリンクする** - アクティブな問題やデザインディスカッションの URL を貼り付けます。
-
スペースのチャットで、「私たちのAPIはエラーハンドリングにどのようなパターンを使用していますか?」といった質問をしてみてください。
Copilot キュレーションしたコンテキストのみを使用して回答します。 「[AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/copilot-spaces/create-copilot-spaces)」を参照してください。
次のステップ
[AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-personal-instructions)** — すべてのリポジトリに適用される個人設定を設定します。
[AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/add-skills)** — エージェントに新しい機能を追加します。
[AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/extend-cloud-agent-with-mcp)** — エージェントを外部のツールとサービスに接続します。
[AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/copilot-spaces/collaborate-with-others)** - チームメイトとスペースを共有します。