以下の内容はhttps://dk521123.hatenablog.com/entry/2025/08/21/143045より取得しました。


【Github】GitHub Copilot 〜 copilot-instructions.md 〜

◾️はじめに

GitHub Copilot の copilot-instructions.md (リポジトリ カスタム命令)
について学んだので、メモ。

目次

【1】copilot-instructions.md (リポジトリ カスタム命令)
【2】サポート状況
 1)プラン別
【3】使い方
 1)1 つの .github/copilot-instructions.md ファイルの使用
 2)1 つ以上の .instructions.md ファイルの使用

【1】copilot-instructions.md (リポジトリ カスタム命令)

* copilotに対して、プロジェクト一般のルールを予め指定できるファイル

【2】サポート状況

https://docs.github.com/ja/enterprise-cloud@latest/copilot/how-tos/configure-custom-instructions/add-repository-instructions

より抜粋
~~~~
* VS Code の Copilot Chat
* Copilot コーディング エージェント
* Visual Studio、JetBrains IDE、Xcode、および GitHub Web サイト
 での Copilot Chat (copilot-instructions.md ファイルのみ)
* Copilot コード レビュー (copilot-instructions.md ファイルのみ
~~~~

1)プラン別

https://docs.github.com/en/copilot/get-started/plans?utm_source=chatgpt.com#customization

* Repository and personal custom instructions
* Organization custom instructions (public preview)

【3】使い方

1)1 つの .github/copilot-instructions.md ファイルの使用

[1] リポジトリのルートに .github/copilot-instructions.md 
 という名前のファイルを作成
 => .github ディレクトリがまだ存在しない場合は作成します。

[2] Markdown 形式で自然言語(日本語もOK)の指示をファイルに追加

.github/copilot-instructions.md

* 変数名や関数名は省略形は避けて意味のある名前を使ってください
* コメントは簡潔かつ具体的に書いてください
* コード可読性を重視してください

2)1 つ以上の .instructions.md ファイルの使用

[1] .github/instructions/*.instructions.md という名前のファイルを作成
[2] glob 構文を使って、Markdown ファイルに applyTo フロントマターを追加し、
 指示が適用されるファイルまたはディレクトリを指定

構成例

.github/
  instructions/
    general.instructions.md
    python.instructions.md
    scala.instructions.md
    testing.instructions.md

.github/instructions/scala.instructions.md

---
applyTo: "scala/**/*.scala"
---

* 変数名や関数名は省略形は避けて意味のある名前を使ってください
* コメントは簡潔かつ具体的に書いてください
* コード可読性を重視してください

関連記事

Github ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2019/07/18/234652
GitHub Copilot 〜 基礎知識編 〜
https://dk521123.hatenablog.com/entry/2025/05/22/143541
GitHub Copilot 〜 VS Code
https://dk521123.hatenablog.com/entry/2025/05/25/233810
Visual Studio Code ~ tasks.json
https://dk521123.hatenablog.com/entry/2025/08/22/003035




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

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