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: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@
2
2
3
3
This repository contains the project for a 1 hour guided workshop to explore GitHub Copilot Agent Mode and related features in Visual Studio Code. The project is a website for a fictional game crowd-funding company, with a [Flask](https://flask.palletsprojects.com/en/stable/) backend using [SQLAlchemy](https://www.sqlalchemy.org/) and [Astro](https://astro.build/) frontend using [Svelte](https://svelte.dev/) for dynamic pages.
4
4
5
-
To begin the workshop, start at [docs/README.md](./docs/README.md)
5
+
## Start the workshop
6
+
7
+
**To begin the workshop, start at [docs/README.md](./docs/README.md)**
Copy file name to clipboardExpand all lines: docs/0-prereqs.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,16 @@
1
1
# Exercise 0: Prerequisites
2
2
3
-
Before we get started on the lab, there's a few tasks we need to complete to get everything ready. We need to get a copy of the repository which includes the code, then spin up a [codespace](https://github.com/features/codespaces) to use to create our code.
3
+
Before we get started on the lab, there's a few tasks we need to complete to get everything ready. We need to get a copy of the repository which includes the code, then spin up a [codespace][codespaces] to use to create our code.
4
4
5
5
## Setting up the Lab Repository
6
6
7
-
To create a copy of the repository for the code you'll create an instance from the [template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository). The new instance will contain all of the necessary files for the lab, and you'll use it as you work through the exercises.
7
+
To create a copy of the repository for the code you'll create an instance from the [template][template-repository]. The new instance will contain all of the necessary files for the lab, and you'll use it as you work through the exercises.
8
8
9
9
1. In a new browser window, navigate to the GitHub repository for this lab: `https://github.com/github-samples/agents-in-sdlc`.
10
10
2. Create your own copy of the repository by selecting the **Use this template** button on the lab repository page. Then select **Create a new repository**.
11
11
12
12

13
13
14
-
> [!IMPORTANT]
15
-
> If you are completing the workshop as part of an event being led by GitHub or Microsoft, follow the instructions provided by the mentors for naming the repository.
16
-
17
14
3. If you are completing the workshop as part of an event being led by GitHub or Microsoft, follow the instructions provided by the mentors. Otherwise, you can create the new repository in an organization where you have access to Copilot coding agent and can assign issues to Copilot.
18
15
19
16

@@ -22,7 +19,7 @@ To create a copy of the repository for the code you'll create an instance from t
22
19
23
20
## Creating a codespace
24
21
25
-
Next up, we will be using a codespace to complete the lab exercises. [GitHub Codespaces](https://github.com/features/codespaces) are a cloud-based development environment that allows you to write, run, and debug code directly in your browser. It provides a fully-featured IDE with support for multiple programming languages, extensions, and tools.
22
+
Next up, we will be using a codespace to complete the lab exercises. [GitHub Codespaces][codespaces] are a cloud-based development environment that allows you to write, run, and debug code directly in your browser. It provides a fully-featured IDE with support for multiple programming languages, extensions, and tools.
26
23
27
24
1. Navigate to your newly created repository.
28
25
2. Select the green **Code** button.
@@ -45,3 +42,6 @@ Congratulations, you have created a copy of the lab repository! You also began t
45
42
## Next step
46
43
47
44
Since we've got a few minutes, let's get Copilot working on some tasks asynchronously for us! We can do this by [creating issues and assigning them to Copilot coding agent](./1-copilot-coding-agent.md).
Copy file name to clipboardExpand all lines: docs/1-copilot-coding-agent.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,7 +149,7 @@ As has been highlighted, one of the great advantages of GitHub Copilot coding ag
149
149
- Before creating the PR, ensure all tests pass
150
150
```
151
151
152
-
7. Note the level of guidance being provided to Copilot to help set everyone up for success.
152
+
7. Note the level of guidance being provided to Copilot to help set everyone up for success. While Copilot could infer many of the points we added to the request, it helps to add them in explicitly. This limits the assumptions which need to be made, driving better code generation.
153
153
8. Scroll towards the bottom of the dialog box to locate the **Assignee** button.
154
154
9. Select **Assignee** to open the dialog box to select assignees.
Copy file name to clipboardExpand all lines: docs/2-mcp.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Popular existing MCP servers include:
31
31
32
32
-**[GitHub MCP Server][github-mcp-server]**: This server provides access to a set of APIs for managing your GitHub repositories. It allows the AI agent to perform actions such as creating new repositories, updating existing ones, and managing issues and pull requests.
33
33
-**[Playwright MCP Server][playwright-mcp-server]**: This server provides browser automation capabilities using Playwright. It allows the AI agent to perform actions such as navigating to web pages, filling out forms, and clicking buttons.
34
-
-**Additional reference servers**: There are many other MCP servers available that provide access to different tools and resources. Anthropic has [a list of MCP servers][anthropic-mcp-servers], including reference, third-party, and community implementations.
34
+
-**Additional reference servers**: There are many other MCP servers available that provide access to different tools and resources. GitHub hosts an [MCP registry][mcp-registry], listing including reference, third-party, and community implementations.
35
35
36
36
> [!IMPORTANT]
37
37
> With regard to security, treat MCP servers as you would any other dependency in your project. Before using an MCP server, carefully review its source code, verify the publisher, and consider the security implications. Only use MCP servers that you trust and be cautious about granting access to sensitive resources or operations.
@@ -209,10 +209,9 @@ Notice that the setup process is similar to the GitHub MCP server, but you do no
209
209
- [What the heck is MCP and why is everyone talking about it?][mcp-blog-post]
Copy file name to clipboardExpand all lines: docs/3-custom-instructions.md
+11-70Lines changed: 11 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,13 @@ Context is key across many aspects of life, and when working with generative AI.
7
7
8
8
In this exercise, you will learn how to:
9
9
10
-
- provide Copilot with project-specific context, coding guidelines and documentation standards using custom instructions **.github/copilot-instructions.md**.
11
-
-use instruction files to guide Copilot for repetitive or templated tasks.
10
+
- provide Copilot with project-specific context, coding guidelines and documentation standards using [repository custom instructions][repository-custom-instructions]**.github/copilot-instructions.md**.
11
+
-provide path instruction files to guide Copilot for repetitive or templated tasks on specific types of files.
12
12
- implement both repository-wide instructions and task-specific instructions.
13
13
14
+
> [!NOTE]
15
+
> There are other types of files which can be used to provide context or guidance to Copilot currently in preview. This workshop currently focused on generally available features.
16
+
14
17
## Scenario
15
18
16
19
As any good dev shop, Tailspin Toys has a set of guidelines and requirements for development practices. These include:
@@ -40,11 +43,13 @@ Custom instructions allow you to provide context and preferences to Copilot chat
40
43
41
44
There are two types of instructions files:
42
45
43
-
-**.github/copilot-instructions.md**, a single instruction file sent to Copilot for **every** chat prompt. This file should contain project-level information, context which is relevant for every message. This could include the tech stack being used, an overview of what's being built, or global guidance for Copilot.
46
+
-**.github/copilot-instructions.md**, a single instruction file sent to Copilot for **every** chat prompt for the repository. This file should contain project-level information, context which is relevant for most chat requests sent to Copilot. This could include the tech stack being used, an overview of what's being built and best practices, and other global guidance for Copilot.
44
47
-**\*.instructions.md** files can be created for specific tasks or file types. You can use **.instructions.md** files to provide guidelines for particular languages (like Python or TypeScript), or for tasks like creating a React component or a new instance of a repository pattern.
45
48
46
49
> [!NOTE]
47
50
> When working in your IDE, instructions files are only used for code generation in Copilot Chat, and not used for code completions or next edit suggestions.
51
+
>
52
+
> Copilot coding agent will utilize both repository and path instructions files when generating code.
48
53
49
54
## Use GitHub Copilot Chat before updating custom instructions
50
55
@@ -69,9 +74,9 @@ To see the impact of custom instructions, we will start by sending a prompt with
69
74
> [!IMPORTANT]
70
75
> As highlighted previously, GitHub Copilot and LLM tools are probabilistic, not deterministic. As a result, the exact code generated may vary, and there's even a chance it'll abide by our rules without us spelling it out! But to aid consistency in code we should always document anything we want to ensure Copilot should understand about how we want our code generated.
71
76
72
-
## Add global standards to copilot-instructions.md
77
+
## Add repository standards to copilot-instructions.md
73
78
74
-
As highlighted previously, `copilot-instructions.md` is designed to provide project-level information to Copilot. Let's ensure global coding standards are documented to improve code suggestions from Copilot chat.
79
+
As highlighted previously, `copilot-instructions.md` is designed to provide project-level information to Copilot. Let's ensure repository coding standards are documented to improve code suggestions from Copilot chat.
75
80
76
81
1. Return to your codespace.
77
82
2. Open `.github/copilot-instructions.md`.
@@ -155,68 +160,4 @@ We want to create a new endpoint to list all publishers, and to follow the same
155
160
156
161

157
162
158
-
13. Send the same prompt as before to generate the desired endpoint:
159
-
160
-
```plaintext
161
-
Create a new endpoint to return a list of all publishers. It should return the name and id for all publishers.
162
-
```
163
-
164
-
14. Note the **References** section and how it uses the **flask-endpoint.instructions.md** file to provide context. If you use instructions files with Copilot agent mode, you will notice that Copilot explores and reads the files referenced in the instructions file.
165
-
166
-

167
-
168
-
15. Copilot generates the files. Notice how it generates updates across multiple files, like **publishers.py** and **test_publishers.py**
169
-
170
-
> [!NOTE]
171
-
> Note that the code generated may diverge from some of the standards we set. AI tools like Copilot are non-deterministic, and may not always provide the same result. The other files in our codebase do not contain docstrings or comment headers, which could lead Copilot in another direction. Consistency is key, so making sure that your code follows the established patterns is important. You can always follow-up in chat and ask Copilot to follow your coding standards, which will help guide it in the right direction.
172
-
173
-
16. After reviewing the code, select **Keep** in Copilot Chat to accept the changes.
174
-
17. If you are prompted to run tests select **Cancel**; we'll perform this task later.
175
-
18. Open a terminal window by selecting <kbd>Ctl</kbd> + <kbd>\`</kbd>.
176
-
19. Run the tests by running the script with the following command:
177
-
178
-
```sh
179
-
./scripts/run-server-tests.sh
180
-
```
181
-
182
-
20. Once the code is correct, and all tests pass, open the **Source Control** panel on the left of the Codespace and review the changes made by Copilot.
183
-
184
-
> [!NOTE]
185
-
> If any tests fail, ask Copilot to suggest a fix. You can use `@terminal /explain` to give Copilot the context of your terminal window.
186
-
187
-
21. Stage the changes by selecting the **+** icon in the **Source Control** panel.
188
-
22. Generate a commit message using the **Sparkle** button.
189
-
190
-

191
-
192
-
23. Commit the changes to your repository by selecting **Commit**.
193
-
194
-
## Summary and next steps
195
-
196
-
Congratulations! You explored how to ensure Copilot has the right context to generate code following the practices your organization has set forth. This can be done at a repository level with the **.github/copilot-instructions.md** file, or on a task basis with instruction files. You explored how to:
197
-
198
-
- provide Copilot with project-specific context, coding guidelines and documentation standards using custom instructions (.github/copilot-instructions.md).
199
-
- use instruction files to guide Copilot for repetitive or templated tasks.
200
-
- implement both repository-wide instructions and task-specific instructions.
201
-
202
-
Next we'll use [agent mode to add functionality to the site][next-lesson].
203
-
204
-
## Resources
205
-
206
-
-[Instruction files for GitHub Copilot customization][instruction-files]
207
-
-[Best practices for creating custom instructions][instructions-best-practices]
208
-
-[Personal custom instructions for GitHub Copilot][personal-instructions]
0 commit comments