Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0738ba4

Browse files
authored
Create a Copilot best practices article (#52023)
1 parent 67918ef commit 0738ba4

10 files changed

Lines changed: 95 additions & 8 deletions

File tree

content/copilot/about-github-copilot/github-copilot-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ AI-generated text completion to help you write pull request descriptions quickly
3636

3737
### {% data variables.product.prodname_copilot_short %} knowledge bases _({% data variables.product.prodname_copilot_enterprise_short %} only)_
3838

39-
Create and manage collections of documentation to use as context for chatting with {% data variables.product.prodname_copilot_short %}. When you ask a question in {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_dotcom_the_website %} or in {% data variables.product.prodname_vscode_shortname %}, you can specify a knowledge base as the context for your question.
39+
Create and manage collections of documentation to use as context for chatting with {% data variables.product.prodname_copilot_short %}. When you ask a question in {% data variables.product.prodname_copilot_chat_dotcom_short %} or in {% data variables.product.prodname_vscode_shortname %}, you can specify a knowledge base as the context for your question.
4040

4141
## {% data variables.product.prodname_copilot %} features for administrators
4242

content/copilot/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ featuredLinks:
1414
- /copilot/about-github-copilot/what-is-github-copilot
1515
- /copilot/quickstart
1616
popular:
17+
- /copilot/using-github-copilot/best-practices-for-using-github-copilot
1718
- /copilot/using-github-copilot/prompt-engineering-for-github-copilot
1819
- /copilot/using-github-copilot/getting-code-suggestions-in-your-ide-with-github-copilot
1920
- /copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide

content/copilot/managing-copilot/managing-copilot-for-your-enterprise/managing-policies-and-features-for-copilot-in-your-enterprise.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ You can chat with {% data variables.product.prodname_copilot %} in your IDE to g
6969

7070
### Give {% data variables.product.prodname_copilot_short %} access to Bing
7171

72-
> [!NOTE] Bing search integration into {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_dotcom_the_website %}, {% data variables.product.prodname_vscode_shortname %}, and {% data variables.product.prodname_vs %} is currently in beta and is subject to change.
72+
> [!NOTE] Bing search integration into {% data variables.product.prodname_copilot_chat_dotcom_short %}, {% data variables.product.prodname_vscode_shortname %}, and {% data variables.product.prodname_vs %} is currently in beta and is subject to change.
7373
7474
{% data variables.product.prodname_copilot_chat %} can use Bing to provide enhanced responses by searching the internet for information related to a question. Bing search is particularly helpful when discussing new technologies or highly specific subjects.
7575

content/copilot/setting-up-github-copilot/setting-up-github-copilot-for-your-organization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Alternatively, you can set up a self-serve workflow using the API. See "[Add tea
4141

4242
## 5. Share onboarding material
4343

44-
* **Share onboarding material**: Share onboarding material with each member that you granted {% data variables.product.prodname_copilot_short %} access to. See "[AUTOTITLE](/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself)."
44+
* **Share onboarding material**: Share onboarding material with each member that you granted {% data variables.product.prodname_copilot_short %} access to. See "[AUTOTITLE](/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself)" and "[AUTOTITLE](/copilot/using-github-copilot/best-practices-for-using-github-copilot)."
4545
* **Encourage adoption**: Encouragement from leadership can help drive adoption of {% data variables.product.prodname_copilot_short %} in your organization. Consider messaging your support of {% data variables.product.prodname_copilot_short %} and how it can help your organization.
4646
* **Set up training sessions or workshops**: Training sessions or workshops can help members learn how to use {% data variables.product.prodname_copilot_short %} effectively.
4747

@@ -57,7 +57,7 @@ Enhance the {% data variables.product.prodname_copilot_short %} experience for y
5757

5858
To help your organization get the most out of {% data variables.product.prodname_copilot_short %}, reach out to users who have not used {% data variables.product.prodname_copilot_short %} recently. (You can use the API to identify users who have not used {% data variables.product.prodname_copilot_short %} recently.) To help those users, consider:
5959

60-
* Sharing resources to help them get started, such as "[AUTOTITLE](/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself)" and "[AUTOTITLE](/copilot/using-github-copilot/prompt-engineering-for-github-copilot)"
60+
* Sharing resources to help them get started, such as "[AUTOTITLE](/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself)," "[AUTOTITLE](/copilot/using-github-copilot/best-practices-for-using-github-copilot)," and "[AUTOTITLE](/copilot/using-github-copilot/prompt-engineering-for-github-copilot)"
6161
* Learning about their barriers to using {% data variables.product.prodname_copilot_short %}
6262
* Addressing any concerns they have about using {% data variables.product.prodname_copilot_short %}
6363
* Giving them ideas for how to incorporate {% data variables.product.prodname_copilot_short %} into their work

content/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ If you have your own subscription to {% data variables.product.prodname_copilot_
4545

4646
Start using {% data variables.product.prodname_copilot_short %} to help you write code faster and more efficiently. For all the ways you can use {% data variables.product.prodname_copilot_short %}, see "[AUTOTITLE](/copilot/using-github-copilot)." {% data variables.product.prodname_copilot_short %} code suggestions and {% data variables.product.prodname_copilot_chat_short %} in your IDE is a great place to start.
4747

48-
To improve your {% data variables.product.prodname_copilot_short %} results, follow these prompt engineering strategies: "[AUTOTITLE](/copilot/using-github-copilot/prompt-engineering-for-github-copilot)."
48+
To learn how to best use {% data variables.product.prodname_copilot_short %}, see "[AUTOTITLE](/copilot/using-github-copilot/best-practices-for-using-github-copilot)" and "[AUTOTITLE](/copilot/using-github-copilot/prompt-engineering-for-github-copilot)."
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: Best practices for using GitHub Copilot
3+
intro: 'Learn how to get the most out of {% data variables.product.prodname_copilot_short %}.'
4+
topics:
5+
- Copilot
6+
versions:
7+
feature: copilot
8+
shortTitle: Best practices
9+
---
10+
11+
## Understand {% data variables.product.prodname_copilot_short %}'s strengths and weaknesses
12+
13+
{% data variables.product.prodname_copilot %} is an AI coding assistant that helps you write code faster and with less effort, allowing you to focus more energy on problem solving and collaboration. Before you start working with {% data variables.product.prodname_copilot_short %}, it's important to understand when you should and shouldn't use it.
14+
15+
**Some of the things {% data variables.product.prodname_copilot_short %} does best include**:
16+
17+
* Writing tests and repetitive code
18+
* Debugging and correcting syntax
19+
* Explaining and commenting code
20+
* Generating regular expressions
21+
22+
**{% data variables.product.prodname_copilot_short %} is not designed to**:
23+
24+
* Respond to prompts unrelated to coding and technology
25+
* Replace your expertise and skills. Remember that you are in charge, and {% data variables.product.prodname_copilot_short %} is a powerful tool at your service.
26+
27+
## Choose the right {% data variables.product.prodname_copilot_short %} tool for the job
28+
29+
While {% data variables.product.prodname_copilot_short %} code completions and {% data variables.product.prodname_copilot_chat_short %} share some functionality, the two tools are best used in different circumstances.
30+
31+
**Code completions work best for**:
32+
33+
* Completing code snippets, variable names, and functions as you write them
34+
* Generating repetitive code
35+
* Generating code from inline comments in natural language
36+
* Generating tests for test-driven development
37+
38+
**Alternatively, {% data variables.product.prodname_copilot_chat_short %} is best suited for**:
39+
40+
* Answering questions about code in natural language
41+
* Generating large sections of code, then iterating on that code to meet your needs
42+
* Accomplishing specific tasks with keywords and skills. {% data variables.product.prodname_copilot_chat_short %} has built-in keywords and skills designed to provide important context for prompts and accomplish common tasks quickly. Different types of keywords and skills are available in different {% data variables.product.prodname_copilot_chat_short %} platforms. See "[AUTOTITLE](/copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide#using-keywords-in-your-prompt){% ifversion fpt %}."{% else %}" and "[AUTOTITLE](/copilot/using-github-copilot/asking-github-copilot-questions-in-githubcom#powered-by-skills)."{% endif %}
43+
* Completing a task as a specific persona. For example, you can tell {% data variables.product.prodname_copilot_chat_short %} that it is a Senior C++ Developer who cares greatly about code quality, readability, and efficiency, then ask it to review your code.
44+
45+
## Create thoughtful prompts
46+
47+
Prompt engineering, or structuring your request so {% data variables.product.prodname_copilot_short %} can easily understand and respond to it, plays a critical role in {% data variables.product.prodname_copilot_short %}'s ability to generate a valuable response. Here are a few quick tips you should remember while crafting your prompts:
48+
49+
* Break down complex tasks.
50+
* Be specific about your requirements.
51+
* Provide examples of things like input data, outputs, and implementations.
52+
* Follow good coding practices.
53+
54+
To learn more, see "[AUTOTITLE](/copilot/using-github-copilot/prompt-engineering-for-github-copilot)."
55+
56+
## Check {% data variables.product.prodname_copilot_short %}'s work
57+
58+
While {% data variables.product.prodname_copilot_short %} is very powerful, it is still a tool capable of making mistakes, and you should always validate the code it suggests. Use the following tips to ensure you are accepting accurate, secure suggestions:
59+
60+
* **Understand suggested code before you implement it.** To ensure you fully understand {% data variables.product.prodname_copilot_short %}'s suggestion, you can ask {% data variables.product.prodname_copilot_chat_short %} to explain the code.
61+
* **Review {% data variables.product.prodname_copilot_short %}'s suggestions carefully.** Consider not just the functionality and security of the suggested code, but also the readability and maintainability of the code moving forward.
62+
* **Use automated tests and tooling to check {% data variables.product.prodname_copilot_short %}'s work.** With the help of tools like linting, {% data variables.product.prodname_code_scanning %}, and IP scanning, you can automate an additional layer of security and accuracy checks.
63+
64+
> [!TIP] Optionally, you may want to check {% data variables.product.prodname_copilot_short %}'s work for similarities to existing public code. If you don't want to use similar code, you can turn off suggestions matching public code. See {% ifversion fpt %}"[AUTOTITLE](/copilot/managing-copilot/managing-copilot-as-an-individual-subscriber/managing-copilot-policies-as-an-individual-subscriber#enabling-or-disabling-suggestions-matching-public-code)" or "[AUTOTITLE](/copilot/managing-copilot/managing-github-copilot-in-your-organization/setting-policies-for-copilot-in-your-organization/managing-policies-for-copilot-in-your-organization#policies-for-suggestion-matching)."{% else %}"[AUTOTITLE](/copilot/managing-copilot/managing-copilot-as-an-individual-subscriber/managing-copilot-policies-as-an-individual-subscriber#enabling-or-disabling-suggestions-matching-public-code)," "[AUTOTITLE](/copilot/managing-copilot/managing-github-copilot-in-your-organization/setting-policies-for-copilot-in-your-organization/managing-policies-for-copilot-in-your-organization#policies-for-suggestion-matching)," or "[AUTOTITLE](/copilot/managing-copilot/managing-copilot-for-your-enterprise/managing-policies-and-features-for-copilot-in-your-enterprise#suggestions-matching-public-code)."{% endif %}
65+
66+
## Guide {% data variables.product.prodname_copilot_short %} towards helpful outputs
67+
68+
There are several adjustments you can make to steer {% data variables.product.prodname_copilot_short %} towards more valuable responses:
69+
70+
* **Provide {% data variables.product.prodname_copilot_short %} with helpful context**:
71+
* If you are using {% data variables.product.prodname_copilot_short %} in your IDE, open relevant files and close irrelevant files.
72+
* In {% data variables.product.prodname_copilot_chat_short %}, if a particular request is no longer helpful context, delete that request from the conversation. Alternatively, if none of the context of a particular conversation is helpful, start a new conversation.
73+
* If you are using {% data variables.product.prodname_copilot_chat_dotcom_short %}, provide specific repositories, files, symbols, and more as context. See "[AUTOTITLE](/enterprise-cloud@latest/copilot/using-github-copilot/asking-github-copilot-questions-in-githubcom){% ifversion fpt %}" in the {% data variables.product.prodname_ghe_cloud %} documentation.{% else %}."{% endif %}
74+
* If you are using {% data variables.product.prodname_copilot_chat_short %} in your IDE, use keywords to focus {% data variables.product.prodname_copilot_short %} on a specific task or piece of context. See "[AUTOTITLE](/copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide#using-keywords-in-your-prompt)."
75+
* **Rewrite your prompts to generate different responses.** If {% data variables.product.prodname_copilot_short %} is not providing a helpful response, try rephrasing your prompt, or even breaking your request down into multiple smaller prompts.
76+
* **Pick the best available suggestion.** When you are using code completions, {% data variables.product.prodname_copilot_short %} might offer more than one suggestion. You can use keyboard shortcuts to quickly look through all available suggestions. For the default keyboard shortcuts for your operating system, see "[AUTOTITLE](/copilot/managing-copilot/configure-personal-settings/configuring-github-copilot-in-your-environment#keyboard-shortcuts-for-github-copilot)."
77+
* **Provide feedback to improve future suggestions.** You can provide feedback in many ways:
78+
* For code completions, accept or reject {% data variables.product.prodname_copilot_short %}'s suggestion.
79+
* For individual responses in {% data variables.product.prodname_copilot_chat_short %}, click the thumbs up or thumbs down icons next to the response.
80+
* For {% data variables.product.prodname_copilot_chat_short %} in your IDE, see "[AUTOTITLE](/copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide#sharing-feedback)" for instructions specific to your environment.
81+
* For {% data variables.product.prodname_copilot_chat_dotcom_short %}, leave a comment on the [feedback discussion](https://github.com/orgs/community/discussions/110314).
82+
83+
## Stay up-to-date on {% data variables.product.prodname_copilot_short %}'s features
84+
85+
New features are regularly added to {% data variables.product.prodname_copilot_short %} to create new abilities, build on existing features, and improve the user experience. To stay up-to-date with {% data variables.product.prodname_copilot_short %}'s features, see the [changelog](https://github.blog/changelog/label/copilot/).

content/copilot/using-github-copilot/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ versions:
77
topics:
88
- Copilot
99
children:
10+
- /best-practices-for-using-github-copilot
1011
- /getting-code-suggestions-in-your-ide-with-github-copilot
1112
- /asking-github-copilot-questions-in-your-ide
1213
- /asking-github-copilot-questions-in-githubcom

content/copilot/using-github-copilot/using-extensions-to-integrate-external-tools-with-copilot-chat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ After you install a {% data variables.product.prodname_copilot_extension_short %
5151
1. To start using a {% data variables.product.prodname_copilot_extension_short %}, open any of the following {% data variables.product.prodname_copilot_chat_short %} interfaces:
5252
* {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vscode %}. See "[AUTOTITLE](/copilot/github-copilot-chat/copilot-chat-in-ides/using-github-copilot-chat-in-your-ide?tool=vscode#asking-your-first-question)."
5353
* {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vs %}. See "[AUTOTITLE](/copilot/github-copilot-chat/copilot-chat-in-ides/using-github-copilot-chat-in-your-ide?tool=visualstudio#asking-your-first-question-1)."{% ifversion ghec %}
54-
* {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_dotcom_the_website %} (if you have a {% data variables.product.prodname_copilot_enterprise_short %} subscription). See "[AUTOTITLE](/copilot/github-copilot-chat/copilot-chat-in-github/using-github-copilot-chat-in-githubcom#asking-a-general-question-about-software-development)."{% endif %}
54+
* {% data variables.product.prodname_copilot_chat_dotcom_short %} (if you have a {% data variables.product.prodname_copilot_enterprise_short %} subscription). See "[AUTOTITLE](/copilot/github-copilot-chat/copilot-chat-in-github/using-github-copilot-chat-in-githubcom#asking-a-general-question-about-software-development)."{% endif %}
5555
1. To see a list of all {% data variables.product.prodname_copilot_extensions_short %} available in your {% data variables.product.prodname_copilot_chat_short %} conversation, in the {% data variables.product.prodname_copilot_chat_short %} text box, type `@`.
5656

5757
> [!NOTE] If you are using {% data variables.product.prodname_copilot_chat_short %} in an IDE, and you or your organization owner install a {% data variables.product.prodname_copilot_extension_short %} while your IDE is open, you need to restart your IDE to begin using the {% data variables.product.prodname_copilot_extension_short %}.

data/reusables/copilot/copilot-enterprise-enable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
1313
1. Next to "Give {% data variables.product.prodname_copilot_short %} access to Bing," click the dropdown menu and select the policy you want to enforce. By default, Bing is disabled at the organization level.
1414

15-
> [!NOTE] Bing search integration into {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_dotcom_the_website %}, {% data variables.product.prodname_vscode_shortname %}, and {% data variables.product.prodname_vs %} is currently in beta and is subject to change.
15+
> [!NOTE] Bing search integration into {% data variables.product.prodname_copilot_chat_dotcom_short %}, {% data variables.product.prodname_vscode_shortname %}, and {% data variables.product.prodname_vs %} is currently in beta and is subject to change.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
* {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vs %}
22
* {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vscode %}
3-
* {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_dotcom_the_website %} (with a {% data variables.product.prodname_copilot_enterprise_short %} subscription)
3+
* {% data variables.product.prodname_copilot_chat_dotcom_short %} (with a {% data variables.product.prodname_copilot_enterprise_short %} subscription)

0 commit comments

Comments
 (0)