dotsagent.io
言語:日本語
.github/copilot-instructions.md

GitHub Copilot custom instructions: 配置場所とツールでの読み込み方

GitHub Copilotは、リポジトリ全体に適用される .github/copilot-instructions.md と、パス固有の .instructions.md ファイルを読み込みます。また、AGENTS.md、またはルートにある単一の CLAUDE.md か GEMINI.md も読み込みます。

配置場所

  • .github/copilot-instructions.md。リポジトリ全体に適用されます。
  • .github/instructions/**/NAME.instructions.md。applyTo に一致するファイルに適用されます。
  • リポジトリ内の任意の場所にある AGENTS.md。最も近いファイルが優先されます。
  • 代替として、ルートにある単一の CLAUDE.md または GEMINI.md。

形式

Markdown。指示の間の空白は無視されます。frontmatterを指定できるのは .instructions.md ファイルのみです。applyTo にはカンマ区切りのglobを指定し、excludeAgent には "code-review" または "cloud-agent" を指定します。コードレビューの4,000文字制限は2026-06-12に撤廃されました。GitHubは、1ファイルあたり約1,000行以内を推奨しています。

Frontmatterのキー: applyToexcludeAgent

.github/copilot-instructions.md
# Copilot instructions

This is a Rails app with a React front end in app/javascript/.

## Build and test

- Install: `bundle install && yarn install`
- Test: `bin/rails test`
- Lint: `bin/rubocop`

## Conventions

- Put business logic in app/services/, not in controllers.
- Every migration must be reversible.
- Never commit credentials or edit config/master.key.

優先順位と統合

個人の指示、リポジトリの指示、組織の指示の順に適用され、該当する指示セットはすべて送信されます。パス固有のファイルとリポジトリ全体に適用されるファイルの両方が一致する場合、Copilotは両方を使用します。コードレビューでは、pull requestのheadブランチにある指示が読み込まれます。

ヒント

  • github.comでは、パス固有の .instructions.md ファイルが使えるのはCopilot cloud agentとCopilot code reviewのみです。
  • レビューでファイルを使わず、cloud agentでは引き続き使うには、excludeAgent: "code-review" を追加してください。
  • Copilot cloud agentに copilot-instructions.md の下書きを作成させることができます。内容はおよそ2ページに収め、特定のタスクに限定しないでください。

1つのフォームから、AGENTS.mdと5つのツールに対応するルールファイルを生成します。 AGENTS.mdジェネレーターを開く →

その他の指示ファイル

出典

  1. docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instr
  2. docs.github.com/en/copilot/reference/custom-instructions-support
  3. docs.github.com/en/copilot/tutorials/customize-code-review
  4. github.blog/changelog/2026-06-12-copilot-code-review-new-configurations-and-contr