メモ
- Copilot プロンプト ファイルはパブリック プレビュー段階であり、変更される可能性があります。 プロンプト ファイルは、VS Code でのみ使用できます。 「GitHub Copilot Chat の回答のカスタマイズについて」を参照してください。
- 特定の言語とシナリオ向けの、コミュニティに投稿されたプロンプト ファイルの例については、Awesome GitHub Copilot Customizations リポジトリを参照してください。
カスタマイズについて
次の 2 種類のファイルを使って、GitHub Copilot の応答をカスタマイズできます。
- カスタム指示では、ユーザーのすべての対話に対して GitHub Copilot がどのように動作する必要があるかについての実行時のガイダンスを提供します。 初歩的な例については、「初めてのカスタム指示」をご覧ください。
- プロンプト ファイル (パブリック プレビュー) では、必要に応じて呼び出すことができる、特定のタスクに対する再利用可能なプロンプトを定義します。 プロンプト ファイルは、VS Code でのみ使用できます。
初めてのプロンプト ファイル
明確かつ適切に記述されたコードの説明を書くのに役立つ、この簡単なプロンプト ファイルを使って始めます。
コードの説明のプロンプト
--- mode: 'agent' description: 'Generate a clear code explanation with examples' --- Explain the following code in a clear, beginner-friendly way: Code to explain: ${input:code:Paste your code here} Target audience: ${input:audience:Who is this explanation for? (e.g., beginners, intermediate developers, etc.)} Please provide: * A brief overview of what the code does * A step-by-step breakdown of the main parts * Explanation of any key concepts or terminology * A simple example showing how it works * Common use cases or when you might use this approach Use clear, simple language and avoid unnecessary jargon.
---
mode: 'agent'
description: 'Generate a clear code explanation with examples'
---
Explain the following code in a clear, beginner-friendly way:
Code to explain: ${input:code:Paste your code here}
Target audience: ${input:audience:Who is this explanation for? (e.g., beginners, intermediate developers, etc.)}
Please provide:
* A brief overview of what the code does
* A step-by-step breakdown of the main parts
* Explanation of any key concepts or terminology
* A simple example showing how it works
* Common use cases or when you might use this approach
Use clear, simple language and avoid unnecessary jargon.
テストする
-
上記のプロンプト ファイルを
explain-code.prompt.md
として.github/prompts
フォルダーに保存します。 -
Visual Studio Code で Copilot Chat ビューを表示し、「
/explain-code
」と入力します。Copilot は、エージェント モードがまだ選ばれていない場合はそれに切り替わり、コードと対象者の種類を入力するようユーザーに求めます。
-
次を入力します。
Text The code is `function fibonacci(n) { return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2); }`. The audience is beginners.
The code is `function fibonacci(n) { return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2); }`. The audience is beginners.
参考資料
- Visual Studio Code ドキュメントの「Visual Studio Code でプロンプト ファイルを使う」- プロンプト ファイルの作成と使用の方法に関する情報
- GitHub Copilot Chat の回答のカスタマイズについて - GitHub Copilot での応答カスタマイズの概要
- 優れた GitHub Copilot カスタマイズ - コミュニティに投稿されたカスタム プロンプト ファイルや、特定の言語やシナリオ向けのその他のカスタマイズのリポジトリ