Skip to content

Commit c1753aa

Browse files
Enhance navigation and clarity by adding reference links
1 parent dcc9e57 commit c1753aa

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

content/1-hour/3-copilot-instructions.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Providing custom instructions
22

3+
| [← Coding with GitHub Copilot][walkthrough-previous] | [Next: Add the filter feature →][walkthrough-next] |
4+
|:-----------------------------------|------------------------------------------:|
5+
36
There are always key pieces of information anyone generating code for your codebase needs to know - the technologies in use, coding standards to follow, project structure, etc. Since context is so important, as we've discussed, we likely want to ensure Copilot always has this information as well. Fortunately, we can provide this overview through the use of Copilot instructions.
47

58
## Scenario
@@ -21,8 +24,8 @@ Here are some guidelines to consider when creating a Copilot instructions file:
2124
- languages, frameworks and libraries in use.
2225
- required assets to be generated (such as unit tests) and where they should be placed.
2326
- any language specific rules such as:
24-
- utilize [type hints](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html) in Python.
25-
- use [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) rather than the `function` keyword in TypeScript.
27+
- utilize [type hints][type-hints] in Python.
28+
- use [arrow functions][arrow-functions] rather than the `function` keyword in TypeScript.
2629
- If you notice GitHub Copilot consistently provides an unexpected suggestion (e.g. using class components for React), add those notes to the instructions file.
2730

2831
## Create a Copilot instructions file
@@ -40,8 +43,8 @@ Let's create a Copilot instructions file. We'll start by asking Copilot to gener
4043
4144
5. Note the function signature is similar to `def validate_dog_age(age)` without type hints.
4245
43-
> [!NOTE]
44-
> Because LLMs are probabilistic rather than deterministic, the exact code will vary.
46+
> [!NOTE]
47+
> Because LLMs are probabilistic rather than deterministic, the exact code will vary.
4548
4649
6. Create a new file in the **.github** folder called **copilot-instructions.md**.
4750
7. Add the markdown to the file necessary which provides information about the project structure and requirements:
@@ -77,8 +80,8 @@ Whenever you make a call to Copilot chat, the references dialog indicates all fi
7780
Create a Python function to validate dog age. Ensure age is between 0 and 20. Throw an error if it is outside this range.
7881
```
7982
80-
> [!TIP]
81-
> You can use up arrow to resend previous prompts to Copilot chat.
83+
> [!TIP]
84+
> You can use up arrow to resend previous prompts to Copilot chat.
8285
8386
4. Note the references now includes the instructions file and provides information gathered from it.
8487
@@ -90,15 +93,23 @@ Whenever you make a call to Copilot chat, the references dialog indicates all fi
9093
def validate_dog_age(age: int):
9194
```
9295
93-
> [!NOTE]
94-
> The exact code generated will vary, but the new Python suggestion should now utilize type hints.
96+
> [!NOTE]
97+
> The exact code generated will vary, but the new Python suggestion should now utilize type hints.
9598
9699
## Summary and next steps
97100
98-
Copilot instructions improves the quality of suggestions, and ensures better alignment with the desired practices you have in place. With the groundwork in place, let's [add new functionality to our website](./4-add-feature.md)!
101+
Copilot instructions improves the quality of suggestions, and ensures better alignment with the desired practices you have in place. With the groundwork in place, let's [add new functionality to our website][walkthrough-next]!
99102
100103
## Resources
101104
102-
- [Adding repository custom instructions for GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
105+
- [Adding repository custom instructions for GitHub Copilot][custom-instructions]
106+
107+
108+
| [← Coding with GitHub Copilot][walkthrough-previous] | [Next: Add the filter feature →][walkthrough-next] |
109+
|:-----------------------------------|------------------------------------------:|
103110
104-
**NEXT:** [Add a new feature to your website](./4-add-feature.md)
111+
[arrow-functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
112+
[custom-instructions]: https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot
113+
[type-hints]: https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html
114+
[walkthrough-previous]: ./3-copilot-instructions.md
115+
[walkthrough-next]: ./4-add-feature.md

0 commit comments

Comments
 (0)