Примечание.
- Файлы запроса Copilot находятся в public preview и подвергаются изменению. Файлы запросов доступны только в IDE VS Code, Visual Studio и JetBrains. Смотрите АВТОЗАГОЛОВОК.
- Примеры файлов запросов для определенных языков и сценариев в сообществе см. в репозитории GitHub Copilot Customizations .
Сведения о настройках
Вы можете настроить ответы GitHub Copilot, используя два типа файлов:
-
**Пользовательские инструкции предоставляют текущие рекомендации** по работе GitHub Copilot во всех взаимодействиях. Вводные примеры см. в разделе [AUTOTITLE](/copilot/tutorials/customization-library/custom-instructions/your-first-custom-instructions). -
**Файлы запроса (общедоступная предварительная версия)** определяют повторно используемые запросы для определенных задач, которые можно вызвать при необходимости. Файлы запросов доступны только в IDE VS Code, Visual Studio и JetBrains.
Первый файл запроса
Начните с этого простого файла запроса, который помогает писать четкие, хорошо документированные объяснения кода.
Запрос на объяснение кода
---
agent: 'agent'
description: 'Generate a clear code explanation with examples'
---
Explain the following code in a clear, beginner-friendly way:
Code to explain: ${input:code:Paste your code here}
Target audience: ${input:audience:Who is this explanation for? (e.g., beginners, intermediate developers, etc.)}
Please provide:
* A brief overview of what the code does
* A step-by-step breakdown of the main parts
* Explanation of any key concepts or terminology
* A simple example showing how it works
* Common use cases or when you might use this approach
Use clear, simple language and avoid unnecessary jargon.
---
agent: 'agent'
description: 'Generate a clear code explanation with examples'
---
Explain the following code in a clear, beginner-friendly way:
Code to explain: ${input:code:Paste your code here}
Target audience: ${input:audience:Who is this explanation for? (e.g., beginners, intermediate developers, etc.)}
Please provide:
* A brief overview of what the code does
* A step-by-step breakdown of the main parts
* Explanation of any key concepts or terminology
* A simple example showing how it works
* Common use cases or when you might use this approach
Use clear, simple language and avoid unnecessary jargon.
Тестирование
-
Сохраните вышеуказанный файл запросов как
explain-code.prompt.mdв папке.github/prompts. -
В Visual Studio Codeотобразите представление Копилот Чат и введите
/explain-code.Copilot переключится в режим агента, если это еще не выбрано, и предложит ввести код и тип аудитории.
-
Введите:
Text The code is `function fibonacci(n) { return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2); }`. The audience is beginners.The code is `function fibonacci(n) { return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2); }`. The audience is beginners.
данных, многократно используемых.copilot.prompt-files-further-reading %}