Open5
GitHubCopilotのカスタマイズ

.github/copilot-instructions.md
- ファイルが保存されているワークスペースにのみ適用
- すべてのチャット リクエストに自動的に含め、コードの生成に適用

.github/instructions/.instructions.md
- 特定のタスク向けのカスタム指示を保存するファイル(複数可)
- 2 種類のスコープをサポート
- ワークスペース指示ファイル: ワークスペース内でのみ使用可能であり、.github/instructionsワークスペースのフォルダーに保存
- ユーザー インストラクション ファイル: 複数のワークスペースで使用でき、現在のVS Code プロファイルに保存
- メタデータをヘッダーに含める
- applyTo:指示を自動的に適用するファイルのglobパターンを指定します。カスタム指示を常に含めるには、**パターンを使用
---
applyTo: "**"
---
Add a comment at the end of the file: 'Contains AI-generated edits.'

settings.json
- ユーザー設定またはワークスペース設定でのシナリオごとの固有の設定
# コード生成
"github.copilot.chat.codeGeneration.instructions": [
{
"file": ".copilot-codeGeneration-instructions.md"
}
],
# テスト生成
"github.copilot.chat.testGeneration.instructions": [
{
"file": ".copilot-test-instructions.md"
}
],
# コードレビュー
"github.copilot.chat.reviewSelection.instructions": [
{
"file": ".copilot-review-instructions.md"
}
],
# コミットメッセージの生成
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"file": ".copilot-commit-message-instructions.md"
},
],
# プルリクエストのタイトルと説明の生成
"github.copilot.chat.pullRequestDescriptionGeneration.instructions": [
{
"file": ".copilot-pull-request-description-instructions.md"
}
],

.github/prompts/*.prompt.md
- Markdownファイルで完全なプロンプトを作成し、チャットで参照
- 既存のプロンプトを補足するカスタム指示とは異なり、プロンプトファイルはスタンドアロンのプロンプト
- ワークスペース内に保存して他のユーザーと共有
- 一般的なタスク用の再利用可能なテンプレートを作成したり、ドメインの専門知識をコードベースに保存したり、チーム全体でAIインタラクションを標準化
- 3つのメタデータをヘッダーに含める
- mode[ask|edit|agent]:プロンプトを実行するときに使用するチャット モード
- tool:エージェントモードで使用できるツール名の配列。例えば terminalLastCommand や githubRepo のようなツール名の配列です。チャット入力フィールドに # を入力すると、ツール名が表示される
- description:プロンプトの簡単な説明
- プロンプトファイル内では、
${variableName}
構文を使用して変数を参照- ワークスペース変数 :
${workspaceFolder}
、${workspaceFolderBasename}
- 選択変数 :
${selection}
、${selectedText}
- ファイルコンテキスト変数:
${file}
、${fileBasename}
。${fileDirname}
、${fileBasenameNoExtension}
- 入力変数 :
${input:variableName}
、${input:variableName:placeholder}
(チャット入力フィールドからプロンプトに値を渡す)
- ワークスペース変数 :
memo
- 手順などを実行させる場合に、手順内容にリスクがあると、実行せず改善提案ばかりしてくる