You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md
+70Lines changed: 70 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,76 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro
144
144
145
145
For an example of an article that uses code annotations on {% data variables.product.prodname_docs %}, see [AUTOTITLE](/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions).
146
146
147
+
## {% data variables.product.prodname_copilot_short %} prompts
148
+
149
+
Prompts for {% data variables.product.prodname_copilot_short %} can either be displayed in blocks or included inline within text.
150
+
151
+
### Prompt blocks
152
+
153
+
These are very similar to code blocks, but use the `copilot` keyword rather than the name of a programming language.
154
+
155
+
Prompt blocks should always have a copy button, added using the `copy` option, and may also have a {% data variables.product.prodname_copilot_short %} button, added using the `prompt` option. The {% data variables.product.prodname_copilot_short %} button gives the reader a quick way to run the prompt in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}. The `copy` and `prompt` options can be used in any order.
156
+
157
+
#### Example prompt block with {% data variables.product.prodname_copilot_short %} and copy buttons
158
+
159
+
````markdown
160
+
```copilot prompt copy
161
+
What is git?
162
+
```
163
+
````
164
+
165
+
This is rendered as:
166
+
167
+
```copilot prompt copy
168
+
What is git?
169
+
```
170
+
171
+
You should only add a {% data variables.product.prodname_copilot_short %} button to a prompt block if:
172
+
* The prompt can be run without any further context (as shown in the example above).
173
+
* There is a code block in the same article that provides the required context for the prompt.
174
+
175
+
#### Including context with a prompt
176
+
177
+
If you use a {% data variables.product.prodname_copilot_short %} button, you can add context to the prompt that is sent to {% data variables.copilot.copilot_chat_short %} by referencing a code block in the same article. You do this by adding `id=STRING-OF-YOUR-CHOICE` to the code block and `ref=STRING-OF-YOUR-CHOICE` to the prompt block.
178
+
179
+
#### Example code block used as context within a prompt block
180
+
181
+
````markdown
182
+
Add an id to the code block whose code you want to add to the prompt as context:
183
+
184
+
```javascript id=js-age
185
+
function logPersonsAge(a, b, c) {
186
+
if (c) {
187
+
console.log(a + " is " + b + " years old.");
188
+
} else {
189
+
console.log(a + " does not want to reveal their age.");
190
+
}
191
+
}
192
+
```
193
+
194
+
Then, elsewhere in the same article, reference the id in the prompt block:
195
+
196
+
```copilot copy prompt ref=js-age
197
+
Improve the variable names in this function
198
+
```
199
+
````
200
+
201
+
There are many examples of prompt blocks with context in the {% data variables.product.prodname_copilot_short %} Cookbook. For example, see [AUTOTITLE](/free-pro-team@latest/copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability).
202
+
203
+
### Inline prompts
204
+
205
+
For most inline prompts, mark these by using backticks, just like inline code.
206
+
207
+
If the prompt does not require any context, you can add a clickable {% data variables.product.prodname_copilot_short %} icon after the prompt. This allows the reader to run the prompt in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}. To add the clickable icon, surround the prompt with Liquid syntax tags:
208
+
209
+
```markdown
210
+
{% raw %}... you can click {% prompt %}what is git{% endprompt %} to run this ...{% endraw %}
211
+
```
212
+
213
+
This is rendered as:
214
+
215
+
... you can click {% prompt %}what is git{% endprompt %} to run this ...
216
+
147
217
## Octicons
148
218
149
219
Octicons are icons used across {% data variables.product.prodname_dotcom %}’s interface. We reference Octicons when documenting the user interface and to indicate binary values in tables. Find the name of specific Octicons on the [Octicons site](https://primer.style/octicons).
Copy file name to clipboardExpand all lines: content/copilot/concepts/ai-tools.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ On {% data variables.product.github %}, use **{% data variables.product.prodname
45
45
46
46
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:
47
47
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?`
49
49
50
50
## Creation
51
51
@@ -59,27 +59,27 @@ With **{% data variables.copilot.next_edit_suggestions %}** ({% data variables.r
59
59
60
60
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.
61
61
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.`
63
63
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?`
65
65
66
66
### Using {% data variables.copilot.copilot_chat_short %} in edit mode
67
67
68
68
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.
69
69
70
-
> Refactor the `calculateTotal` function to improve readability and efficiency.
70
+
*`Refactor the calculateTotal function to improve readability and efficiency.`
71
71
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?`
73
73
74
-
> Format this code to follow Python’s PEP 8 style guide.
74
+
*`Format this code to follow Python’s PEP 8 style guide.`
75
75
76
76
### Using {% data variables.copilot.copilot_chat_short %} in agent mode
77
77
78
78
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.
79
79
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.`
81
81
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.`
83
83
84
84
## Reviews
85
85
@@ -98,25 +98,25 @@ The testing phase validates that your application works as intended. This phase
98
98
99
99
**{% 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:
100
100
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.`
102
102
103
-
> How do I run these tests using Python's unittest framework?
103
+
*`How do I run these tests using Python's unittest framework?`
104
104
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.`
106
106
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?`
108
108
109
109
## Deployment
110
110
111
111
The deployment phase involves preparing your code for production and ensuring a smooth release.
112
112
113
113
**{% 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:
114
114
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.`
116
116
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.`
118
118
119
-
> Analyze this deployment log and suggest why the deployment failed.
119
+
*`Analyze this deployment log and suggest why the deployment failed.`
120
120
121
121
## Operation
122
122
@@ -126,11 +126,11 @@ You can use the **{% data variables.copilot.copilot_coding_agent %}** ({% data v
126
126
127
127
For issues you're tackling yourself, use **{% data variables.copilot.copilot_chat_short %}** for help analyzing logs, debugging issues, and suggesting optimizations. For example:
128
128
129
-
> Analyze this error log and suggest possible causes for the issue.
129
+
*`Analyze this error log and suggest possible causes for the issue.`
130
130
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.`
132
132
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?`
Copy file name to clipboardExpand all lines: content/copilot/concepts/prompt-engineering.md
+25-21Lines changed: 25 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,34 +23,38 @@ When writing a prompt for {% data variables.product.prodname_copilot_short %}, f
23
23
24
24
For example:
25
25
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
+
```
31
33
32
34
## Give examples
33
35
34
36
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.
35
37
36
38
For example:
37
39
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
+
```
54
58
55
59
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.
Copy file name to clipboardExpand all lines: content/copilot/how-tos/provide-context/use-mcp/use-the-github-mcp-server.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -434,7 +434,7 @@ To configure the remote {% data variables.product.github %} MCP server with a PA
434
434
}
435
435
}
436
436
```
437
-
437
+
438
438
## Using the {% data variables.product.github %} MCP server in Xcode
439
439
440
440
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
546
546
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**.
547
547
548
548
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 %}
551
555
552
556
1. {% data variables.copilot.copilot_chat_short %} will ask you to confirm that you want to proceed with the action. Click **Allow** to confirm.
553
557
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.
Copy file name to clipboardExpand all lines: content/copilot/how-tos/use-chat/use-chat-in-github.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,11 +35,11 @@ Depending on the question you ask, and your enterprise and organization settings
35
35
36
36
Some examples of general questions you could ask are:
37
37
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 %}
43
43
44
44
{% data reusables.copilot.stop-response-generation %}
45
45
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
59
59
60
60
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.
61
61
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`.
63
63
64
64
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.
65
65
@@ -118,9 +118,9 @@ To navigate between subthreads:
118
118
119
119
{% 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.
120
120
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 %}
122
122
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 %}
124
124
125
125
## Asking {% data variables.copilot.copilot_chat_short %} questions in different contexts
126
126
@@ -171,9 +171,9 @@ You can ask {% data variables.product.prodname_copilot_short %} a question about
171
171
172
172
For example, you could enter:
173
173
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?`
177
177
178
178
1. Click **Ask {% data variables.product.prodname_copilot_short %}**.
0 commit comments