Skip to content

Commit 239d591

Browse files
authored
Merge pull request #204 from microsoft/advanced-usage-2026-q1
Updated advanced module to be about Code Review
2 parents 0d3a86e + a855156 commit 239d591

File tree

3 files changed

+35
-78
lines changed

3 files changed

+35
-78
lines changed

Using-Advanced-GitHub-Copilot-Features/README.md

Lines changed: 35 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,71 @@
22

33
# Using Advanced GitHub Copilot Features
44

5-
GitHub Copilot offers much more than just code suggestions. As a Software Engineer, you often need to understand existing code and improve it with documentation, tests, and automation.
5+
In this module, you'll learn how to leverage GitHub Copilot's advanced capabilities to provide automated code reviews and generate complex code autonomously and asynchronously.
66

7-
In this module, you’ll explore the advanced features of GitHub Copilot, enabling you to interactively work with your code while applying suggestions and insights more effectively.
7+
This module will be updated periodically to include new general availability features and improvements. Currently, this module can be completed in about 20 minutes.
88

9-
Using a Python-based HTTP API, you’ll make modifications, fix bugs, create documentation, and write tests for a new endpoint that you’ll implement.
109
</header>
1110

11+
By the end of this module, you’ll be able to:
1212

13-
- **Who this is for**: Developers, DevOps Engineers, Software development managers, Testers.
14-
- **What you'll learn**: Using Advanced GitHub Copilot features to test, document, and work with code.
15-
- **What you'll build**: A new HTTP API route, along with documentation and tests to verify its correctness.
16-
- **Prerequisites**: GitHub Copilot is available to use for free, sign up for [GitHub Copilot](https://gh.io/copilot).
17-
- **Timing**: This module can be completed in under an hour.
13+
- Assign GitHub Copilot as a reviewer for fast feedback on your code changes.
1814

19-
By the end of this module, you'll acquire the skills to be able to:
15+
## 📖 Prerequisite reading
2016

21-
- Use advanced GitHub Copilot features like inline chat, slash commands, and agents.
22-
- Interact with GitHub Copilot with deeper context on your project and ask questions about it.
23-
24-
## Prerequisite reading:
2517
- [Introduction to prompt engineering with GitHub Copilot](https://learn.microsoft.com/training/modules/introduction-prompt-engineering-with-github-copilot//?WT.mc_id=academic-113596-abartolo)
26-
- [Using advanced GitHub Copilot features](https://learn.microsoft.com/training/modules/advanced-github-copilot/?WT.mc_id=academic-113596-abartolo)
18+
- [Using GitHub Copilot with JavaScript](https://learn.microsoft.com/training/modules/introduction-copilot-javascript/?WT.mc_id=academic-113596-abartolo)
2719

28-
## Requirements
20+
## 📋 Requirements
2921

3022
1. Enable your [GitHub Copilot service](https://github.com/github-copilot/signup)
31-
1. Open [this repository with Codespaces](https://codespaces.new/MicrosoftDocs/mslearn-advanced-copilot)
32-
33-
## 💪🏽 Exercise
23+
1. Open [this repository with Codespaces](https://codespaces.new/github-samples/node-recipe-app?quickstart=1)
3424

3525
**Right click the following Codespaces button to open your Codespace in a new tab**
36-
37-
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MicrosoftDocs/mslearn-copilot-codespaces-python)
38-
39-
The current API is not exposing country/{country} which needs to be implemented to list cities. The route should allow only GET HTTP requests with a JSON response providing information from the historical high and low for that country, city, and given month.
40-
41-
As with any implementation, this addition should include at least one test function to work with the pytest runner and test framework.
42-
43-
### 🛠 Step 1: Add a new route
44-
In our first exercise we will create a new route in our API. Go to the main.py file, and by using the inline chat with the following command `ctrl` + `i` (on Windows) or `cmd` + `i`(on Mac) ask GitHub Copilot to help you create a new API that shows you the cities of a country.
4526

46-
Use the following prompt in inline-chat:
27+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/github-samples/node-recipe-app?quickstart=1)
4728

48-
```
49-
Create a new route that exposes the cities of a country.
50-
```
29+
_Note: if you have an existing Codespace with this project, please create a new one for this module._
5130

52-
This prompt should give you something similar like this:
31+
This application is a recipe app that allows users to create, edit, and read recipes. By default, there are notable missing features including the ability to delete and search recipes.
5332

33+
## 🧑‍💻 Section 1: Copilot Code Review
5434

55-
```python
56-
# Create a new route that exposes the cities of a country:
57-
@app.get('/countries/{country}')
58-
def cities(country: str):
59-
return list(data[country].keys())
35+
**🎯 Learning Goals**
6036

61-
```
37+
- Be able to trigger code reviews in your code editor.
38+
- Request code reviews on GitHub.com.
6239

63-
> [!NOTE]
64-
> Try your new route and refine your prompt until the result is as desired.
40+
Once your Codespace launches, you'll have a fully functional development environment with the entire repository preloaded.
6541

66-
### 🔎 Step 2: Create a test
67-
Now that you have created a new route, let's create a test with Copilot Chat for this route that uses Spain as the country. Remember to select your code and ask Copilot Chat to help you with this specific API that we just have created.
42+
Open the `src/routes.js` file. Just above the final line where the router is exported, add the following code:
6843

69-
Use the following prompt with GitHub Copilot Chat:
70-
71-
```
72-
/tests help me to create a new test for this route that uses Spain as the country.
44+
```js
45+
router.get('/recipes/random', async (req, res) => {
46+
const db = await getDbConnection()
47+
const recipes = db.all('SELECT * FROM recipes')
48+
const randomIndex = Math.floor(Math.random() * recipes.length)
49+
const recipe = recipes[randomIndex]
50+
res.render('recipe', { recipe })
51+
})
7352
```
7453

75-
![Copilot Chat image example](https://raw.githubusercontent.com/MicrosoftDocs/mslearn-advanced-copilot/main/images/ideascopilot.png)
76-
77-
78-
Once Copilot has helped you to create your test, try it. If this is not functioning as expected, feel free to share those details with Copilot in the chat. For example:
79-
80-
```
81-
This test is not quite right, it is not including cities that doesn't exist. Only Seville is part of the API.
82-
```
83-
84-
It should give you another solution. Keep trying until you achieve the desired result.
85-
86-
### 🐍 Step 3: Use an agent to write the project
87-
During this step we will be using an agent (workspace) to write the project documentation on how to run this project. In the GitHub Copilot Chat, we will try the following prompt:
88-
89-
`> @workspace help me to use an agent to write the project documentation on how to run it .`
90-
91-
Finally, verify the new endpoint is working by trying it out by going to the `/docs` endpoint and confirming that the endpoint shows up.
54+
_Note: this code has at least one logic bug and at least one area where it is inefficient. That's ok! Copilot should help us identify these improvements._
9255

56+
Open your source control sidebar and then request a code review from Copilot in your IDE. After a few seconds, Copilot will create inline comments, if any, in your editor.
9357

94-
### 💡 Step 4: Using Slash Commands
58+
![Click source control icon in activity bar and then the code review button above the commit message box.](./images/request-ccr-ide.png)
9559

96-
Now that you've used GitHub Copilot to generate and explain code, you can also explore some other alternative approaches to perform developer tasks. These extra challenges will help you dive deeper into other GitHub Copilot features in addition to the ones you already know. For these extra challenges, you will use the Chat interface. Click on the GitHub Copilot Chat icon on the left sidebar if you don't have it open yet.
60+
You can choose to apply the suggested change directly, or discard it if preferred. In this case, Copilot has 2 different comments for this piece of code — applying or discarding will load the second comment. You can also toggle between them using the arrow icons in the top-right of the comment box.
9761

98-
🚀 Congratulations, through the exercise, you have used GitHub Copilot with many different features that will allow you to work better with different projects. You interactively used some features to write tests, documentation, and find out more about existing code.
62+
![Copilot inline comments in the editor showing a suggested change for efficiency. There is an "Apply and Go to Next" button and a a button fir discard. Visible is comment 1 of 2.](./images/ccr-ide-comment.png)
9963

100-
## Legal Notices
64+
Remember, Copilot is nondeterministic so you may have different suggestions. Apply all changes and commit your work.
10165

102-
Microsoft and any contributors grant you a license to the Microsoft documentation and other content
103-
in this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode),
104-
see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the
105-
[LICENSE-CODE](LICENSE-CODE) file.
66+
### Copilot Code Review on web and mobile
10667

107-
Microsoft, Windows, Microsoft Azure, and/or other Microsoft products and services referenced in the documentation
108-
may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries.
109-
The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks.
110-
Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.
68+
Copilot can also be assigned as a reviewer for pull requests on the GitHub website and via the GitHub mobile app. This allows you to get feedback on your code changes from Copilot directly in the context of your pull request. This feature requires a [paid license for GitHub Copilot](https://github.com/features/copilot#pricing).
11169

112-
Privacy information can be found at https://privacy.microsoft.com/en-us/
70+
## 📖 Discover more
11371

114-
Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents,
115-
or trademarks, whether by implication, estoppel, or otherwise.
72+
GitHub Copilot is constantly evolving with new features and improvements. To stay updated on the latest developments, check out the [GitHub Changelog](https://github.blog/changelog/?label=copilot). This module will be updated as new features enter general availability.
118 KB
Loading
318 KB
Loading

0 commit comments

Comments
 (0)