|
1 | 1 | # Copilots |
2 | 2 |
|
3 | | -There are a number of AI tools that can improve the developer experience. This article will discuss tooling that is available as well as advice on when it might be appropriate to use such tooling. |
| 3 | +There are a number of AI tools that can improve the developer experience. This article will discuss tooling that is available as well as advice on when it might be appropriate to use such tooling and how to attribute AI-generated code. |
4 | 4 |
|
5 | | -## GitHub Copilot |
| 5 | +## AI-Assisted Coding Tools |
6 | 6 |
|
7 | | -The current version of GitHub Copilot can provide code completion in many popular IDEs. For instance, the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) that can be installed from the VS Code Marketplace. It requires a GitHub account to use. For more information about what IDEs are supported, what languages are supported, cost, features, etc., please checkout out the information on [Copilot](https://github.com/features/copilot) and [Copilot for Business](https://resources.github.com/copilot-for-business/). |
| 7 | +### GitHub Copilot Extension |
| 8 | + |
| 9 | +GitHub Copilot is an extension that adds AI-assisted coding capabilities to an IDE. For instance, the [GitHub Copilot for VS Code extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) can be installed from the VS Code Marketplace. It requires a GitHub account to use. For more information about what IDEs are supported, what languages are supported, cost, features, etc., please checkout out the information on [Copilot](https://github.com/features/copilot) and [Copilot for Business](https://resources.github.com/copilot-for-business/). |
8 | 10 |
|
9 | 11 | Some example use-cases for GitHub Copilot include: |
10 | 12 |
|
| 13 | +- **Code Completion**. Copilot can provide code completion suggestions as you type. If you want Copilot to write something useful for you, try writing a comment that describes what your code is going to do - it can often take it from there. |
| 14 | + |
11 | 15 | - **Write Documentation**. For example, the above paragraph was written using Copilot. |
12 | 16 |
|
13 | 17 | - **Write Unit Tests**. Given that setup and assertions are often consistent across unit tests, Copilot tends to be very accurate. |
14 | 18 |
|
15 | | -- **Unblock**. It is often hard start writing when staring at a blank page, Copilot can fill the space with something that may or may not be what you ultimately want to do, but it can help get you in the right head space. |
16 | | - |
17 | | -If you want Copilot to write something useful for you, try writing a comment that describes what your code is going to do - it can often take it from there. |
18 | | - |
19 | | -## GitHub Copilot Labs |
20 | | - |
21 | | -Copilot has a [GitHub Copilot labs extension](https://githubnext.com/projects/copilot-labs/) that offers additional features that are not yet ready for prime-time. For VS Code, you can install it from the VS Code Marketplace. These features include: |
| 19 | +- **Unblock**. It is often hard to start writing when staring at a blank page.. Copilot can fill the space with something that may or may not be what you ultimately want to do, but it can help get you in the right headspace. |
22 | 20 |
|
23 | 21 | - **Explain**. Copilot can explain what the code is doing in natural language. |
24 | 22 |
|
25 | | -- **Translate**. Copilot can translate code from one language to another. |
26 | | - |
27 | | -- **Brushes**. You can select code that Copilot then modifies inline based on a "brush" you select, for example, to make the code more readable, fix bugs, improve debugging, document, etc. |
28 | | - |
29 | | -- **Generate Tests**. Copilot can generate unit tests for your code. Though currently this is limited to JavaScript and TypeScript. |
| 23 | +- **Generate Tests**. Copilot can generate unit tests for your code. |
30 | 24 |
|
31 | | -## GitHub Copilot X |
32 | | - |
33 | | -The next version of Copilot offers a number of new use-cases beyond code completion. These include: |
34 | | - |
35 | | -- **Chat**. Rather than just providing code completion, Copilot will be able to have a conversation with you about what you want to do. It has context about the code you are working on and can provide suggestions based on that context. Beyond just writing code, consider using chat to: |
| 25 | +You can also chat with Copilot to ask it to edit your code, including across multiple files. Beyond just writing code, consider using chat to: |
36 | 26 |
|
37 | 27 | - **Build SQL Indexes**. Given a query, Copilot can generate a SQL index that will improve the performance of the query. |
38 | 28 |
|
39 | 29 | - **Write Regular Expressions**. These are notoriously difficult to write, but Copilot can generate them for you if you give some sample input and describe what you want to extract. |
40 | 30 |
|
41 | 31 | - **Improve and Validate**. If you are unsure of the implications of writing code a particular way, you can ask questions about it. For instance, you might ask if there is a way to write the code that is more performant or uses less memory. Once it gives you an opinion, you can ask it to provide documentation validating that assertion. |
42 | 32 |
|
43 | | -- **Explain**. Copilot can explain what the code is doing in natural language. |
44 | | - |
45 | 33 | - **Write Code**. Given prompting by the developer it can write code that you can one-click deploy into existing or new files. |
46 | 34 |
|
47 | 35 | - **Debug**. Copilot can analyze your code and propose solutions to fix bugs. |
48 | 36 |
|
49 | | -It can do most of what Labs can do with "brushes" as "topics", but whereas Labs changes the code in your file, the chat functionality just shows what it would change in the window. However, there is also an "inline mode" for GitHub Copilot Chat that allows you to make changes to your code inline which does not have this same limitation. |
| 37 | +You can also use configuration files and extensions to customize and extend Copilot's capabilities. For example: |
50 | 38 |
|
51 | | -## GitHub Copilot Agent |
| 39 | +- **Custom instruction files.** You can create [custom instructions files](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#about-repository-custom-instructions-for-copilot) that provide Copilot with additional context about your project, such as coding conventions, preferred libraries, or specific patterns you want it to follow. |
52 | 40 |
|
53 | | -The [GitHub Copilot Coding Agent](https://docs.github.com/en/copilot/how-tos/agents/copilot-coding-agent) is an AI software development agent that can be assigned to work on issues within the GitHub work management system such as bugs or development tasks. The bot analyzes the work item, creates a branch, starts a virtual environment to execute and test the code iteratively, writes commits, and finally opens a pull request for review. |
| 41 | +- **Prompt files.** You can create [prompt files](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#enabling-and-using-prompt-files) to store reusable prompts or templates that can be easily accessed from the Copilot chat interface. |
54 | 42 |
|
55 | | -## ChatGPT / Bing Chat |
| 43 | +- **MCP Servers.** You can use [MCP servers](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) to expand the capabilities of Copilot by providing it access to external tools or services, such as connecting to a project management system (such as Jira or Azure DevOps) or custom APIs (such as the Azure resource manager API). |
56 | 44 |
|
57 | | -For coding, generic AI chat tools such as ChatGPT and Bing Chat are less useful, but they still have their place. GitHub Copilot will only answer "questions about coding" and it's interpretation of that rule can be a little restrictive. Some cases for using ChatGPT or Bing Chat include: |
| 45 | +### GitHub Copilot Coding Agent |
58 | 46 |
|
59 | | -- **Write Documentation**. Copilot can write documentation, but using ChatGPT or Bing Chat, you can expand your documentation to include business information, use-cases, additional context, etc. |
| 47 | +The [GitHub Copilot Coding Agent](https://docs.github.com/en/copilot/how-tos/agents/copilot-coding-agent) is an AI software development agent that can be assigned to work on issues within the GitHub work management system such as fixing bugs or implementing new features. Once an issue has been assigned to the Copilot Agent, the bot analyzes the work item, creates a branch, starts a virtual environment to execute and test the code iteratively, authors commits, and opens a pull request for review. |
60 | 48 |
|
61 | | -- **Change Perspective**. ChatGPT can impersonate a persona or even a system and answer questions from that perspective. For example, you can ask it to explain what a particular piece of code does from the perspective of a user. You might have ChatGPT imagine it is a database administrator and ask it to explain how to improve a particular query. |
| 49 | +### ChatGPT / Copilot Chat |
| 50 | + |
| 51 | +For coding, generic AI chat tools such as ChatGPT and Copilot chat are less useful, but they still have their place. GitHub Copilot will only answer "questions about coding" and it's interpretation of that rule can be a little restrictive. Some cases for using ChatGPT, Copilot chat, or M365 Researcher include: |
62 | 52 |
|
63 | | -When using Bing Chat, experiment with modes, sometimes changing to Creative Mode can give the results you need. |
| 53 | +- **Write Documentation**. Copilot can write documentation, but using ChatGPT or Copilot chat, you can expand your documentation to include business information, use-cases, additional context, etc. |
64 | 54 |
|
65 | | -## Prompt Engineering |
| 55 | +- **Change Perspective**. ChatGPT can impersonate a persona or even a system and answer questions from that perspective. For example, you can ask it to explain what a particular piece of code does from the perspective of a user. You might have ChatGPT imagine it is a database administrator and ask it to explain how to improve a particular query. |
66 | 56 |
|
67 | | -Chat AI tools are only as good as the prompts you give them. The quality and appropriateness of the output can vary greatly depending on the prompt. In addition, many of these tools restrict the number of prompts you can send in a given amount of time. To learn more about prompt engineering, you might review some open source documentation [here](https://github.com/brexhq/prompt-engineering). |
| 57 | +### Prompt Engineering |
68 | 58 |
|
69 | | -## Considerations |
| 59 | +Chat AI tools are only as good as the prompts you give them. The quality and appropriateness of the output can vary greatly depending on the prompt. In addition, many of these tools restrict the number of prompts you can send in a given amount of time. To learn more about prompt engineering, you might review some [background open source prompt engineering documentation](https://github.com/brexhq/prompt-engineering) and how it applies to [crafting prompts for Copilot chat](https://code.visualstudio.com/docs/copilot/chat/prompt-crafting). |
70 | 60 |
|
71 | | -If you make use of AI tools, consider the following: |
| 61 | +### Considerations |
72 | 62 |
|
73 | | -* It is important when using AI tools to understand how the data (including private or commercial code) might be used by the system. Read more about how GitHub Copilot handles your data and code [here](https://resources.github.com/copilot-for-business/). |
| 63 | +If you make use of AI tools, it is important to understand how the data (including private or commercial code) might be used by the system. You can read more about how GitHub copilot handles your data and code at the [GitHub Copilot Privacy FAQ](https://github.com/features/copilot/#faq) and how to [manage Copilot policies](https://docs.github.com/en/copilot/how-tos/manage-your-account/manage-policies). |
74 | 64 |
|
75 | | -* You may want to consider how you will handle [attribution of AI-generated code](../source-control/git-guidance/README.md#ai-assisted-code-authorship) for accountability, code review, and auditing purposes. |
0 commit comments