Yesterday I talked about custom instructions as a general way to influence the behavior of Github Copilot in multiple contexts(coding, testing, reviewing, ...) in VS Code. With prompt files you can go one step further, and provide specific instructions for a task.
Let’s give this feature a try.
Active the prompts file feature
First we need to activate this feature:
- Go to File –> Preferences –> Settings.
- Search for Chat and look for the Prompt files setting.
- Click on the Edit in settings.json link.
- The settings.json file is opened with a new
chat.promptFiles
setting already added. - Change the value to
true
. Now VSCode will look for prompt files in the.github/prompts
folder.
Creating a prompt file
Now we are ready to add one or more prompts file to the .github/prompts
folder.
For every task you should create a separate Markdown prompt file.
Remark: It is possible to reference other files inside your Markdown prompt file as well:
Using a prompt file
Now we can use our newly created prompt files.
- Open the VSCode Copilot Chat window:
-
Select the Attach Context icon (Ctrl+/), and then select Prompt....
-
Choose a prompt file from the Quick Pick to attach it to your chat request.
-
Now we can either directly send the prompt or include other instructions.