Skip to content

Commit 6cb5295

Browse files
hubwritersarahsCopilot
authored
Copilot: Add new prompt formatting to Markdown files (#57347)
Co-authored-by: Sarah Schneider <[email protected]> Co-authored-by: Sarah Schneider <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 2a29f59 commit 6cb5295

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+399
-253
lines changed

content/copilot/concepts/ai-tools.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ On {% data variables.product.github %}, use **{% data variables.product.prodname
4545

4646
Once you've chosen an issue to address, **{% data variables.copilot.copilot_chat_short %}** can help you brainstorm ideas for your project and learn about the various tools, libraries, and resources you might need. You can ask {% data variables.copilot.copilot_chat_short %} generalized questions about the project you're envisioning to get suggestions on a path forward. For example:
4747

48-
> I'd like to build an web app that helps users track their daily habits and provides personalized recommendations. Can you suggest features and technologies I could use?
48+
`I'd like to build an web app that helps users track their daily habits and provides personalized recommendations. Can you suggest features and technologies I could use?`
4949

5050
## Creation
5151

@@ -59,27 +59,27 @@ With **{% data variables.copilot.next_edit_suggestions %}** ({% data variables.r
5959

6060
Use {% data variables.copilot.copilot_chat_short %} in **ask mode** as your pair programmer to get help with coding tasks, understand tricky concepts, and improve your code. You can ask it questions, get explanations, or request suggestions in real time.
6161

62-
> Can you explain what this JavaScript function does? I'm not sure why it uses a `forEach` loop instead of a `for` loop.
62+
* `Can you explain what this JavaScript function does? I'm not sure why it uses a forEach loop instead of a for loop.`
6363

64-
> What’s the difference between `let`, `const`, and `var` in JavaScript? When should I use each one?
64+
* `What’s the difference between let, const, and var in JavaScript? When should I use each one?`
6565

6666
### Using {% data variables.copilot.copilot_chat_short %} in edit mode
6767

6868
Use {% data variables.copilot.copilot_chat_short %} in **edit mode** when you want more granular control over the edits that {% data variables.product.prodname_copilot_short %} proposes. In edit mode, you choose which files {% data variables.product.prodname_copilot_short %} can make changes to, provide context to {% data variables.product.prodname_copilot_short %} with each iteration, and decide whether or not to accept the suggested edits.
6969

70-
> Refactor the `calculateTotal` function to improve readability and efficiency.
70+
* `Refactor the calculateTotal function to improve readability and efficiency.`
7171

72-
> The login function is not working as expected. Can you debug it?
72+
* `The login function is not working as expected. Can you debug it?`
7373

74-
> Format this code to follow Python’s PEP 8 style guide.
74+
* `Format this code to follow Python’s PEP 8 style guide.`
7575

7676
### Using {% data variables.copilot.copilot_chat_short %} in agent mode
7777

7878
In **agent mode**, {% data variables.copilot.copilot_chat_short %} can assist with automating repetitive tasks and managing your workflow directly within your project. Use it to create pull requests after you make code changes. You can also use it to run tests and linters in the background while you're working on your project.
7979

80-
> Create a pull request for the recent changes in the `user-auth` module and include a summary of the updates.
80+
* `Create a pull request for the recent changes in the user-auth module and include a summary of the updates.`
8181

82-
> Run all tests and linters for the `payment-processing` module and provide a summary of any issues or errors found.
82+
* `Run all tests and linters for the payment-processing module and provide a summary of any issues or errors found.`
8383

8484
## Reviews
8585

@@ -98,25 +98,25 @@ The testing phase validates that your application works as intended. This phase
9898

9999
**{% data variables.copilot.copilot_chat_short %}** can assist by generating unit and integration tests, debugging failures, and suggesting additional test cases to ensure comprehensive coverage. Here are some example prompts:
100100

101-
> Write unit tests for this function to calculate the factorial of a number. Include edge cases like 0 and negative numbers.
101+
* `Write unit tests for this function to calculate the factorial of a number. Include edge cases like 0 and negative numbers.`
102102

103-
> How do I run these tests using Python's unittest framework?
103+
* `How do I run these tests using Python's unittest framework?`
104104

105-
> Write integration tests for the `deposit` function in the BankAccount class. Use mocks to simulate the NotificationSystem.
105+
* `Write integration tests for the deposit function in the BankAccount class. Use mocks to simulate the NotificationSystem.`
106106

107-
> What additional tests should I include to ensure full coverage for this module?
107+
* `What additional tests should I include to ensure full coverage for this module?`
108108

109109
## Deployment
110110

111111
The deployment phase involves preparing your code for production and ensuring a smooth release.
112112

113113
**{% data variables.copilot.copilot_chat_short %}** can help you configure deployment scripts, set up CI/CD pipelines, and troubleshoot issues. Here are some example prompts:
114114

115-
> Write a deployment script for a Node.js application using GitHub Actions to deploy to an AWS EC2 instance.
115+
* `Write a deployment script for a Node.js application using GitHub Actions to deploy to an AWS EC2 instance.`
116116

117-
> Set up a GitHub Actions workflow to build, test, and deploy a Python application to Heroku.
117+
* `Set up a GitHub Actions workflow to build, test, and deploy a Python application to Heroku.`
118118

119-
> Analyze this deployment log and suggest why the deployment failed.
119+
* `Analyze this deployment log and suggest why the deployment failed.`
120120

121121
## Operation
122122

@@ -126,11 +126,11 @@ You can use the **{% data variables.copilot.copilot_coding_agent %}** ({% data v
126126

127127
For issues you're tackling yourself, use **{% data variables.copilot.copilot_chat_short %}** for help analyzing logs, debugging issues, and suggesting optimizations. For example:
128128

129-
> Analyze this error log and suggest possible causes for the issue.
129+
* `Analyze this error log and suggest possible causes for the issue.`
130130

131-
> Write a script to monitor the memory usage of this application and alert when it exceeds a threshold.
131+
* `Write a script to monitor the memory usage of this application and alert when it exceeds a threshold.`
132132

133-
> How can I optimize the database queries in this code to improve performance?
133+
* `How can I optimize the database queries in this code to improve performance?`
134134

135135
## Next steps
136136

content/copilot/concepts/prompt-engineering.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,38 @@ When writing a prompt for {% data variables.product.prodname_copilot_short %}, f
2323

2424
For example:
2525

26-
> Write a function that tells me if a number is prime
27-
>
28-
> The function should take an integer and return true if the integer is prime
29-
>
30-
> The function should error if the input is not a positive integer
26+
```copilot copy prompt
27+
Write a JavaScript function that tells me if a number is prime
28+
29+
The function should take an integer and return true if the integer is prime
30+
31+
The function should error if the input is not a positive integer
32+
```
3133

3234
## Give examples
3335

3436
Use examples to help {% data variables.product.prodname_copilot_short %} understand what you want. You can provide example input data, example outputs, and example implementations.
3537

3638
For example:
3739

38-
> Write a function that finds all dates in a string and returns them in an array. Dates can be formatted like:
39-
>
40-
> * 05/02/24
41-
> * 05/02/2024
42-
> * 5/2/24
43-
> * 5/2/2024
44-
> * 05-02-24
45-
> * 05-02-2024
46-
> * 5-2-24
47-
> * 5-2-2024
48-
>
49-
> Example:
50-
>
51-
> findDates("I have a dentist appointment on 11/14/2023 and book club on 12-1-23")
52-
>
53-
> Returns: ["11/14/2023", "12-1-23"]
40+
```copilot copy prompt
41+
Write a Go function that finds all dates in a string and returns them in an array. Dates can be formatted like:
42+
43+
* 05/02/24
44+
* 05/02/2024
45+
* 5/2/24
46+
* 5/2/2024
47+
* 05-02-24
48+
* 05-02-2024
49+
* 5-2-24
50+
* 5-2-2024
51+
52+
Example:
53+
54+
findDates("I have a dentist appointment on 11/14/2023 and book club on 12-1-23")
55+
56+
Returns: ["11/14/2023", "12-1-23"]
57+
```
5458

5559
Unit tests can also serve as examples. Before writing your function, you can use {% data variables.product.prodname_copilot_short %} to write unit tests for the function. Then, you can ask {% data variables.product.prodname_copilot_short %} to write a function described by those unit tests.
5660

content/copilot/get-started/quickstart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ To use {% data variables.product.prodname_copilot_short %} on the {% data variab
5252

5353
For example, you could enter:
5454

55-
* Explain this file.
56-
* How could I improve this code?
57-
* How can I test this code?
55+
* `Explain this file.`
56+
* `How could I improve this code?`
57+
* `How can I test this code?`
5858

5959
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
6060

content/copilot/how-tos/provide-context/use-mcp/use-the-github-mcp-server.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ To configure the remote {% data variables.product.github %} MCP server with a PA
434434
}
435435
}
436436
```
437-
437+
438438
## Using the {% data variables.product.github %} MCP server in Xcode
439439

440440
The {% data variables.product.github %} MCP server enables you to perform a wide range of actions on {% data variables.product.github %}, via {% data variables.copilot.copilot_chat_short %} in Xcode.
@@ -546,8 +546,12 @@ The {% data variables.product.github %} MCP server is automatically configured i
546546
1. In the prompt box, type a request related to the skill you want {% data variables.copilot.copilot_chat_short %} to perform, and press **Enter**.
547547

548548
Some examples of requests you can make are:
549-
* `Create a new branch called [BRANCH-NAME] in the repository [USERNAME/REPO-NAME].`
550-
* `Merge the pull request [PULL-REQUEST-NUMBER] in the repository [USERNAME/REPO-NAME].`
549+
550+
{% prompt %}Create a new branch called [BRANCH-NAME] in the repository [OWNER/REPO-NAME].{% endprompt %}
551+
552+
{% prompt %}Search for users with the name [USER-NAME]{% endprompt %}
553+
554+
{% prompt %}Merge the pull request [PR-NUMBER] in the repository [OWNER/REPO-NAME].{% endprompt %}
551555

552556
1. {% data variables.copilot.copilot_chat_short %} will ask you to confirm that you want to proceed with the action. Click **Allow** to confirm.
553557
1. {% data variables.copilot.copilot_chat_short %} will use the relevant skill from the {% data variables.product.github %} MCP server to perform the action you requested. {% data variables.copilot.copilot_chat_short %} will show you the result of the action in the chat interface.

content/copilot/how-tos/use-chat/get-started-with-chat.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ Some of the example prompts require you to be in a specific context on the {% da
251251

252252
You can ask {% data variables.copilot.copilot_chat_short %} general software questions. For example:
253253

254-
* `tell me about nodejs web server frameworks`
255-
* `how can I create an Express app`
256-
* `what is the best way to update an npm package`
254+
* {% prompt %}tell me about nodejs web server frameworks{% endprompt %}
255+
* {% prompt %}how can I create an Express app{% endprompt %}
256+
* {% prompt %}what is the best way to update an npm package{% endprompt %}
257257

258258
## Ask questions about a repository
259259

content/copilot/how-tos/use-chat/use-chat-in-github.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Depending on the question you ask, and your enterprise and organization settings
3535

3636
Some examples of general questions you could ask are:
3737

38-
* `What are the advantages of the Go programming language?`
39-
* `What is Agile software development?`
40-
* `What is the most popular JavaScript framework?`
41-
* `Give me some examples of regular expressions.`
42-
* `Write a bash script to output today's date.`
38+
* {% prompt %}What are the advantages of the Go programming language?{% endprompt %}
39+
* {% prompt %}What is Agile software development?{% endprompt %}
40+
* {% prompt %}What is the most popular JavaScript framework?{% endprompt %}
41+
* {% prompt %}Give me some examples of regular expressions.{% endprompt %}
42+
* {% prompt %}Write a bash script to output today's date.{% endprompt %}
4343

4444
{% data reusables.copilot.stop-response-generation %}
4545
1. If {% data variables.product.prodname_copilot_short %} uses a Bing search to answer your question, you can click the **_n_ references** link at the top of the response to see the search results that {% data variables.product.prodname_copilot_short %} used to answer your question.
@@ -59,7 +59,7 @@ Depending on the question you ask, and your enterprise and organization settings
5959
6060
When you ask a question, {% data variables.product.prodname_copilot_short %} may generate one or more files as part of its response. In the {% data variables.copilot.copilot_chat_short %} panel, the files are displayed inline, within the chat response. In immersive view (that is, at [https://github.com/copilot](https://github.com/copilot)), the generated files are displayed in a side panel. You can view and edit the files in the panel, or download them to your computer.
6161

62-
For example, asking `Generate a simple calculator using HTML, CSS, and JavaScript` may generate multiple files, such as `index.html`, `styles.css`, and `script.js`.
62+
For example, asking {% prompt %}Generate a simple calculator using HTML, CSS, and JavaScript{% endprompt %} may generate multiple files, such as `index.html`, `styles.css`, and `script.js`.
6363

6464
In immersive view, you can also preview how some file formats, such as Markdown, render by toggling to the "Preview" tab in the side panel.
6565

@@ -118,9 +118,9 @@ To navigate between subthreads:
118118

119119
{% data variables.product.prodname_copilot_short %} has access to a collection of skills to fetch data from {% data variables.product.github %}, which are dynamically selected based on the question you ask.
120120

121-
You can explicitly ask {% data variables.copilot.copilot_chat_dotcom %} to use a particular skill - for example, `Use the Bing skill to find the latest GPT4 model from OpenAI`.
121+
You can explicitly ask {% data variables.copilot.copilot_chat_dotcom %} to use a particular skill - for example, {% prompt %}Use the Bing skill to find the latest GPT4 model from OpenAI.{% endprompt %}
122122

123-
Generate a list of currently available skills by asking {% data variables.product.prodname_copilot_short %}: `What skills are available?`
123+
Generate a list of currently available skills by asking {% data variables.product.prodname_copilot_short %}: {% prompt %}What skills are available?{% endprompt %}
124124

125125
## Asking {% data variables.copilot.copilot_chat_short %} questions in different contexts
126126

@@ -171,9 +171,9 @@ You can ask {% data variables.product.prodname_copilot_short %} a question about
171171

172172
For example, you could enter:
173173

174-
* What does this repo do?
175-
* Where is authentication implemented in this codebase?
176-
* How does license file detection work in this repo?
174+
* `What does this repo do?`
175+
* `Where is authentication implemented in this codebase?`
176+
* `How does license file detection work in this repo?`
177177

178178
1. Click **Ask {% data variables.product.prodname_copilot_short %}**.
179179

content/copilot/how-tos/use-chat/use-chat-in-mobile.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ You can ask a general question about software development{% ifversion ghec %} th
6363
1. At the bottom of the page, in the "Ask {% data variables.product.prodname_copilot_short %}" box, type a question and send the message.
6464

6565
Some examples of general questions you could ask are:
66-
* What are the advantages of the Go programming language?
67-
* What is Agile software development?
68-
* What is the most popular JavaScript framework?
69-
* Give me some examples of regular expressions.
70-
* Write a bash script to output today's date.
66+
* `What are the advantages of the Go programming language?`
67+
* `What is Agile software development?`
68+
* `What is the most popular JavaScript framework?`
69+
* `Give me some examples of regular expressions.`
70+
* `Write a bash script to output today's date.`
7171

7272
1. Within a conversation thread, you can ask follow-up questions. {% data variables.product.prodname_copilot_short %} will answer within the context of the conversation. For example, you could type "tell me more" to get {% data variables.product.prodname_copilot_short %} to expand on its last comment.
7373

@@ -84,11 +84,11 @@ You can ask questions about a specific repository, to get help with understandin
8484

8585
For example, if you chose the repository you are working in as the context, you could ask:
8686

87-
* What is the main purpose of this repo? What problem does it solve or what functionality does it provide?
88-
* What web frameworks are used in this project?
89-
* Where is rate limiting implemented in our API?
90-
* How is the code organized? Explain the project architecture.
91-
* Are there any specific environment requirements for working on this project?
87+
* `What is the main purpose of this repo? What problem does it solve or what functionality does it provide?`
88+
* `What web frameworks are used in this project?`
89+
* `Where is rate limiting implemented in our API?`
90+
* `How is the code organized? Explain the project architecture.`
91+
* `Are there any specific environment requirements for working on this project?`
9292

9393
> [!IMPORTANT]
9494
> {% data variables.product.prodname_copilot_short %}'s ability to answer natural language questions like these in a repository context is improved when the repository has been indexed for semantic code search. Without indexing, {% data variables.copilot.copilot_mobile_short %} may not be able to provide the most relevant answers to your questions.
@@ -110,15 +110,15 @@ You can chat with {% data variables.product.prodname_copilot_short %} about a fi
110110

111111
For example, if you are asking about the entire file, you could enter:
112112

113-
* Explain this file.
114-
* How could I improve this code?
115-
* How can I test this script?
113+
* `Explain this file.`
114+
* `How could I improve this code?`
115+
* `How can I test this script?`
116116

117117
If you are asking about specific lines, you could enter:
118118

119-
* How could I improve this class?
120-
* Add error handling to this code.
121-
* Write a unit test for this method.
119+
* `How could I improve this class?`
120+
* `Add error handling to this code.`
121+
* `Write a unit test for this method.`
122122

123123
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
124124

@@ -135,10 +135,10 @@ You can ask questions about a specific pull request in a repository.
135135

136136
For example, you could ask:
137137

138-
* What is the purpose of this pull request?
139-
* What changes are being made in this pull request?
140-
* Are there any potential issues with this pull request?
141-
* What is the status of this pull request?
138+
* `What is the purpose of this pull request?`
139+
* `What changes are being made in this pull request?`
140+
* `Are there any potential issues with this pull request?`
141+
* `What is the status of this pull request?`
142142

143143
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
144144

@@ -153,10 +153,10 @@ You can ask questions about a specific issue in a repository.
153153

154154
For example, you could ask:
155155

156-
* What is the purpose of this issue?
157-
* What is the status of this issue?
158-
* What are the steps to reproduce this issue?
159-
* Are there any potential solutions to this issue?
156+
* `What is the purpose of this issue?`
157+
* `What is the status of this issue?`
158+
* `What are the steps to reproduce this issue?`
159+
* `Are there any potential solutions to this issue?`
160160

161161
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
162162

@@ -171,10 +171,10 @@ You can ask questions about a specific discussion in a repository.
171171

172172
For example, you could ask:
173173

174-
* What is the purpose of this discussion?
175-
* What are the main points of this discussion?
176-
* What are the next steps for this discussion?
177-
* Are there any potential issues with this discussion?
174+
* `What is the purpose of this discussion?`
175+
* `What are the main points of this discussion?`
176+
* `What are the next steps for this discussion?`
177+
* `Are there any potential issues with this discussion?`
178178

179179
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
180180

0 commit comments

Comments
 (0)