メモ
エージェント スキルは、CopilotコーディングエージェントでGitHub Copilot CLI(コマンドラインインターフェース)、Visual Studio Code、およびエージェント モードで動作します。
エージェント スキルは、関連がある場合に特殊なタスクのパフォーマンスを向上させるために読み込むことができる命令、スクリプト、およびリソースのフォルダーです。 詳しくは、「エージェントのスキルについて」をご覧ください。
スキルの作成と追加
エージェント スキルを作成するには、 SKILL.md ファイルと、必要に応じて、補助 Markdown ファイルやスクリプトなど、 SKILL.md の手順で参照するその他のリソースを記述します。
スキルを追加するには、SKILL.md ファイルと補助リソースを、Copilot がスキルを探す場所に保存します。 これは、リポジトリ内でも、ホーム ディレクトリ内でもかまいません。
-
サポートされているいずれかの場所に
skillsディレクトリを作成して、スキルを格納し、将来作成する可能性があるその他のディレクトリを作成します。1 つのリポジトリに固有の プロジェクト スキルの場合は、リポジトリ内の
.github/skills、.claude/skills、または.agents/skillsディレクトリを作成して使用します。**個人のスキル**の場合は、プロジェクト間で共有し、ホーム ディレクトリに`~/.copilot/skills`、`~/.claude/skills`、または`~/.agents/skills`ディレクトリを作成して使用します。 -
新しいスキルのサブディレクトリを作成します。 各スキルには、独自のディレクトリ (たとえば、
.github/skills/webapp-testing) が必要です。スキルサブディレクトリ名は小文字で、スペースにはハイフンを使用する必要があります。
-
スキルサブディレクトリで、スキルの指示を含む
SKILL.mdファイルを作成します。重要
スキル ファイルには、
SKILL.mdという名前を付ける必要があります。`SKILL.md` ファイルは、YAML frontmatter を含む Markdown ファイルです。 最も単純な形式では、次のものが含まれます。- YAMLフロントマター * name (必須): スキルのユニークな識別子。 スペースにはハイフンを使用して、小文字にする必要があります。 通常、これはスキルのディレクトリの名前と一致します。 * description (必須): スキルが実行する内容と、それを使用する必要があるタイミング Copilot 説明。 * license (省略可能): このスキルに適用されるライセンスの説明。
-
Copilotが従う手順、例、ガイドラインを含む Markdown 本文。
-
必要に応じて、スキルのディレクトリにスクリプト、例、またはその他のリソースを追加します。
詳細については、「スキルでスクリプトを実行できるようにする」を参照してください。
`SKILL.md` ファイルの例
**プロジェクト スキル**の場合、このファイルはリポジトリの`.github/skills/github-actions-failure-debugging` ディレクトリにあります。
**個人のスキル**の場合、このファイルは `~/.copilot/skills/github-actions-failure-debugging` ディレクトリにあります。
--- name: github-actions-failure-debugging description: Guide for debugging failing GitHub Actions workflows. Use this when asked to debug failing GitHub Actions workflows. --- To debug failing GitHub Actions workflows in a pull request, follow this process, using tools provided from the GitHub MCP Server: 1. Use the `list_workflow_runs` tool to look up recent workflow runs for the pull request and their status 2. Use the `summarize_job_log_failures` tool to get an AI summary of the logs for failed jobs, to understand what went wrong without filling your context windows with thousands of lines of logs 3. If you still need more information, use the `get_job_logs` or `get_workflow_run_logs` tool to get the full, detailed failure logs 4. Try to reproduce the failure yourself in your own environment. 5. Fix the failing build. If you were able to reproduce the failure yourself, make sure it is fixed before committing your changes.
---
name: github-actions-failure-debugging
description: Guide for debugging failing GitHub Actions workflows. Use this when asked to debug failing GitHub Actions workflows.
---
To debug failing GitHub Actions workflows in a pull request, follow this process, using tools provided from the GitHub MCP Server:
1. Use the `list_workflow_runs` tool to look up recent workflow runs for the pull request and their status
2. Use the `summarize_job_log_failures` tool to get an AI summary of the logs for failed jobs, to understand what went wrong without filling your context windows with thousands of lines of logs
3. If you still need more information, use the `get_job_logs` or `get_workflow_run_logs` tool to get the full, detailed failure logs
4. Try to reproduce the failure yourself in your own environment.
5. Fix the failing build. If you were able to reproduce the failure yourself, make sure it is fixed before committing your changes.
スキルでスクリプトを実行できるようにする
スキルが呼び出されると、 Copilot はスキルのディレクトリ内のすべてのファイルを自動的に検出し、スキルの指示と共に使用できるようにします。 つまり、スキル ディレクトリにスクリプトやその他のリソースを含め、 SKILL.md の手順でそれらを参照できます。
スクリプトを実行するスキルを作成するには:
-
**スキルのディレクトリにスクリプトを追加します。** たとえば、SVG 画像を PNG に変換するスキルは、次の構造を持つ場合があります。.github/skills/image-convert/ ├── SKILL.md └── convert-svg-to-png.sh -
**必要に応じて、スキルに必要なツールを事前に承認します。** `SKILL.md` frontmatter では、[`allowed-tools`] フィールドを使用して、毎回確認を求めずに使用できるツールCopilot一覧表示できます。 ツールが [ `allowed-tools` ] フィールドに表示されていない場合は、 Copilot を使用する前にアクセス許可を求められます。--- name: image-convert description: Converts SVG images to PNG format. Use when asked to convert SVG files. allowed-tools: shell ---警告
このスキルと参照されているスクリプトを確認し、そのソースを完全に信頼している場合にのみ、
shellまたはbashツールを事前に承認してください。shellまたはbashを事前に承認すると、ターミナル コマンドを実行するための確認手順が削除され、攻撃者が制御するスキルやプロンプトインジェクションが環境内で任意のコマンドを実行できるようになります。 不明な場合は、shellからbashとallowed-toolsを省略して、Copilotがターミナル コマンドを実行する前に明示的な確認を要求する必要があります。 -
**スクリプトの使用方法 Copilot 指示する手順を記述します。** `SKILL.md`の Markdown 本文で、スクリプトを実行するタイミングと方法について説明します。When asked to convert an SVG to PNG, run the `convert-svg-to-png.sh` script from this skill's base directory, passing the input SVG file path as the first argument.
Copilotがエージェント スキルを使用する方法
タスクを実行する場合、Copilot は、プロンプトとスキルの説明に基づいて、スキルを使用するタイミングを決定します。
Copilotがスキルの使用を選択すると、SKILL.md ファイルがエージェントのコンテキストに挿入され、エージェントが指示にアクセスできるようになります。 その後、これらの手順に従って、スキルのディレクトリに含めてきたスクリプトや例を使用できます。
スキルとカスタム命令
スキルとカスタム命令の両方を使用して、 Copilot をリポジトリで作業する方法と特定のタスクを実行する方法を教えることができます。
ほぼすべてのタスクに関連する簡単な手順 (リポジトリのコーディング標準に関する情報など) と、Copilot が関連する場合にのみアクセスする必要があるより詳細な手順のスキルには 、カスタム命令を使用することをお勧めします。
リポジトリのカスタム手順の詳細については、 GitHub Copilot用のリポジトリカスタム命令の追加 を参照してください。