以下の内容はhttps://tsubalog.hatenablog.com/entry/2026/02/21/144659より取得しました。


.github/instructions/NAME.instructions.md のメモ

.github/instructions/NAME.instructions.md とは

.github/instructions/NAME.instructions.md は、特定のパスやファイルタイプに対してパス固有の指示(Path specific instructions)を与えるためのファイルです。

.github/copilot-instructions.md はリポジトリ全体に適用される指示となります。

docs.github.com

作り方

いくつかの作り方があります。

例えば、C# に対する指示を設定したい場合は以下のようにします。
この例ではリポジトリ内にあるすべての .cs ファイルに対してこの指示が適用されるようになっています。

---
description: 'Guidelines for building C# applications'
applyTo: '**/*.cs'
---

# C# Development

## C# Instructions
- Always use the latest version C#, currently C# 14 features.
- Write clear and concise comments for each function.
...

引用元: github/awesome-copilot: instructions/csharp.instructions.md

効果があるところ

.github/instructions/NAME.instructions.md は GitHub.com だけではなく、VS Code など複数の環境で参照されます。
ただし、環境や機能(Chat / Code review / Agent)によって「どの種類の指示がサポートされているか」が異なります。

対応表は公式のリファレンスが最も確実です。

docs.github.com

参考:Awesome Copilot

カスタム指示を作るときに、私は github/awesome-copilot のリポジトリを参考することが多いです。
ここからベースとなる指示をコピーしてきて、プロジェクトに合わせてカスタマイズします。

github.com

.github/copilot-instructions.md との使い分け

両方のファイルが存在する場合、以下のように動作します。

  1. .github/copilot-instructions.md の指示が全体に適用される
  2. 特定のファイルに対しては、パス固有の指示(.github/instructions/NAME.instructions.md)が追加で適用される

つまり、リポジトリ全体の共通ルールは copilot-instructions.md に書き、特定のファイルタイプに対する特別なルールはパス固有の指示に書く、という使い分けができます。

まとめ

.github に配置できるファイルの一覧はこちらの記事でまとめています。

tsubalog.hatenablog.com




以上の内容はhttps://tsubalog.hatenablog.com/entry/2026/02/21/144659より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14