Skip to main content
Skip to content

Custom instructions for GitHub Copilot

Customize GitHub Copilot responses to your preferences, project conventions, and organization requirements.

About customizing Copilot responses

GitHub Copilot can provide responses that are tailored to your preferences, the way your team works, the tools you use, and the specifics of your project. Instead of repeatedly adding the same context to your prompts, you can create custom instructions that automatically provide this information to Copilot to allow it to generate higher quality responses.

Prompt files provide another way to give Copilot task-specific instructions and context. Unlike custom instructions, you choose when to use them in a chat. For more information, see Prompt files for GitHub Copilot.

The types of custom instructions available, and the Copilot features that use them, vary by client and surface (GitHub.com, Visual Studio Code, Visual Studio, JetBrains IDEs, Xcode, and Eclipse). To check which types your environment supports, see さまざまな種類のカスタム命令のサポート. For supported IDEs and versions, see Copilot機能マトリックス.

メモ

AI の非決定論的な性質により、Copilot は、使用されるたびにまったく同じ方法でカスタム命令に従うとは限りません。

Types of custom instructions

Custom instructions can apply at different levels:

TypeScopeExample uses
Personal instructionsYour conversations with CopilotSpecify your individual preferences, such as preferred language or response style.
Repository custom instructionsConversations with Copilot performed in the context of a repository, project, path, or supported agentDescribe the languages, frameworks, tools, architecture, and coding conventions used in a project.
Organization custom instructionsConversations with Copilot when used in the context of an organizationProvide organization-wide language, security, compliance, or response guidelines.

Some clients (JetBrains IDEs and Xcode) provide additional global, workspace, or project instruction mechanisms. These mechanisms do not always map directly to personal, repository, and organization instructions in GitHub.

About personal instructions

Personal instructions configured on GitHub.com apply to GitHub Copilot Chat in GitHub. Other clients, such as Copilot CLI, use local files for personal instructions. See カスタム指示の追加 GitHub Copilot CLI.

You can customize how Copilot Chat responds to you on GitHub.com by adding personal instructions. These instructions apply only to you. For example, you can specify your preferred language, the level of detail you want, or how you want responses to be structured. See GitHub Copilot 用に個人用カスタム命令を追加する.

About repository custom instructions

Repository custom instructions provide project-specific context and guidance. For example, you can describe the repository's purpose, the frameworks and tools it uses, and the coding or testing conventions that contributors should follow.

There are three main types of repository custom instructions:

  • リポジトリ全体のカスタム指示。リポジトリのコンテキストで行われたすべてのリクエストに適用されます。

    これらは、リポジトリの copilot-instructions.md ディレクトリ内の .github ファイルで指定されます。

  • パス固有のカスタム指示。指定したパスに一致するファイルのコンテキストで行われたリクエストに適用されます。

    これらは、リポジトリ内の NAME.instructions.md ディレクトリ内または下にある 1 つ以上の.github/instructions ファイルで指定されます。

    パス固有の指示を使うと、特定の種類のファイルまたは特定のディレクトリにのみ適用される情報でリポジトリ全体の指示がオーバーロードされるのを回避できます。

  • エージェント命令は、リポジトリ全体のカスタム命令に似ていますが、現在のところ、Copilot のすべての機能ではサポートされていません。

    これらは、 AGENTS.md、 CLAUDE.md、または GEMINI.mdと呼ばれるファイルで指定されます。

さまざまな Copilot 機能で利用可能なリポジトリカスタム命令タイプのサポートに関する詳細は、さまざまな種類のカスタム命令のサポート をご覧ください。

サンプルのキュレーション コレクションについては、 カスタム指示 を参照してください。

Note that agent instruction files, such as AGENTS.md, provide instructions to supported AI agents. They are different from custom agent definition files stored in .github/agents, which define specialized agents and their configuration. For the agent instruction filenames that Copilot recognizes, see さまざまな種類のカスタム命令のサポート.

Repository custom instructions across clients and surfaces

Which types of repository custom instructions you can use (repository-wide, path-specific, or agent instructions) depends on your environment and on the task, such as chatting, working in the cloud, or reviewing a pull request. For example, an environment may support path-specific instructions for one task but not another. To check support for your setup, see さまざまな種類のカスタム命令のサポート. For supported IDEs and versions, see Copilot機能マトリックス.

About organization custom instructions

メモ

サポート: 現在、組織のカスタム手順は、Copilot ChatでのGitHub.com、Copilot code reviewでのGitHub.com、Copilot cloud agentでのGitHub.comに対してのみサポートされています。

Organization owners can add instructions to tailor Copilot to the needs and preferences of their organization. These instructions are used for all members of the organization, regardless of whether they receive their Copilot subscription from that organization.

Organization custom instructions can only be configured for organizations with a Copilot Business or Copilot Enterprise subscription.

For example, organization instructions can:

  • Specify a language that should be used in responses.
  • Provide organization-wide security or compliance guidance.
  • Specify preferred response formats, such as not generating code blocks.
  • Direct people to an internal knowledge base or support channel for particular topics.

For information about adding organization instructions, see GitHub Copilot の組織のカスタム手順を追加する.

Precedence of custom instructions

Precedence depends on the client and feature. Most surfaces and clients, including Copilot CLI, Visual Studio Code and Visual Studio, combine applicable instruction files without defining a general precedence order.

For Copilot Chat on GitHub.com, all relevant instructions are provided to Copilot. The order of precedence, from highest to lowest, is:

  1. Personal instructions
  2. Repository custom instructions:
    1. Path-specific instructions in any applicable .github/instructions/**/*.instructions.md file
    2. Repository-wide instructions in .github/copilot-instructions.md
    3. Agent instructions, such as instructions in an AGENTS.md file
  3. Organization custom instructions

可能な限り、競合する一組の命令を提供しないようにしてください。 応答の品質が気になる場合は、リポジトリの指示を一時的に無効にすることができます。 「GitHub Copilot用のリポジトリカスタム命令の追加」をご覧ください。

Using custom instructions

Custom instructions consist of natural language instructions and are most effective when they are short, self-contained statements. Consider the scope over which you want an instruction to apply before deciding whether to add it at the personal, repository, or organization level.

Common use cases include:

  • Response preferences. Specify a preferred language, response structure, tone, or level of explanation.
  • Project context. Explain the purpose, architecture, or domain of a repository.
  • Languages and frameworks. Identify the languages, libraries, frameworks, and versions used by a project.
  • Coding and testing conventions. Describe naming, formatting, testing, error-handling, or documentation standards.
  • Review and security guidance. Identify issues that should receive particular attention when a supported feature reviews or changes code.
  • Organization requirements. Provide organization-wide language, security, compliance, or support guidance.

For example:

  • Personal instruction: Always respond in Portuguese.
  • Personal instruction: Explain a single concept per line. Be clear and concise.
  • Repository instruction: Use Vue with the PrimeVue library.
  • Repository instruction: Use early returns whenever possible.
  • Organization instruction: For questions related to security, use the Security Docs Knowledge Base.
  • Organization instruction: Do not generate code blocks in responses.

Instructions about testing, commit messages, or code review can provide useful context. However, the Copilot features that use a particular instruction vary by client and surface, and custom instructions do not guarantee that generated content will comply with a policy.

メモ

プル要求を確認するときに、 Copilot は、ベース ブランチではなく、ヘッド ブランチ (変更したブランチ) からリポジトリのカスタム命令、エージェント命令、およびエージェント スキルを読み取ります。 たとえば、 my-feature-branch を mainにマージする場合、 Copilot は my-feature-branchの命令とスキルを使用するため、同じプル要求で変更を最初にマージせずにテストできます。

効果的なカスタム指示の記述

カスタム命令ファイルに追加する手順は、短く自己完結型のステートメントで、このリポジトリでの作業に役立つ関連情報を Copilot に提供する必要があります。 指示はすべてのチャット メッセージと共に送信されるため、リポジトリのコンテキストで行うほとんどの要求に幅広く適用できるものである必要があります。

指示ファイルに使う正確な構造は、プロジェクトとニーズによって異なりますが、次のガイドラインがよい出発点となります。

  • 目的、目標、関連する背景情報など、作業中のプロジェクトの概要を提供します。
  • 名前付け規則、書式設定規則、ベスト プラクティスなど、従う必要があるコーディング標準と規則を指定します。
  • プロジェクトで使われる特定のツール、ライブラリ、またはフレームワークを、関連するバージョン番号または構成と共に含めます。

次の命令ファイルは、これらの操作の例です。

# Project Overview

This project is a web application that allows users to manage their tasks and to-do lists. It is built using React and Node.js, and uses MongoDB for data storage.

## Libraries and Frameworks

- React and Tailwind CSS for the frontend.
- Node.js and Express for the backend.
- MongoDB for data storage.

## Coding Standards

- Use semicolons at the end of each statement.
- Use single quotes for strings.
- Use function based components in React.
- Use arrow functions for callbacks.

## UI guidelines

- A toggle is provided to switch between light and dark mode.
- Application should have a modern and clean design.

リポジトリのサイズと複雑さも考慮する必要があります。 次のような指示は、共同作成者が少数の小規模なリポジトリではうまくいく可能性がありますが、大規模で多様なリポジトリでは、問題が発生する可能性があります。

  • 応答を作成するときに外部リソースを参照するという要求
  • 特定のスタイルで回答するという指示
  • 常に特定の詳細レベルで応答するという要求

たとえば、次の指示では意図した結果が得られない場合があります。

Always conform to the coding styles defined in styleguide.md in repo my-org/my-repo when generating code.

Use @terminal when answering questions about Git.

Answer all questions in the style of a friendly colleague, using informal language.

Answer all questions in less than 1000 characters, and words of no more than 12 characters.

Next steps

Further reading