Skip to content

Commit e2fbba8

Browse files
committed
Add instruction files for GitHub Copilot features
- Create azure.instructions.md to include Azure best practices. - Create copilot-code-generation-instructions.md with guidelines for starting code responses with comments. - Create copilot-code-review-instructions.md outlining code review best practices. - Create copilot-commit-message-instructions.md detailing commit message formatting. - Create copilot-pull-request-description-instructions.md for pull request description guidelines. - Create copilot-test-generation-instructions.md specifying test case commenting and usage of unittest. - Create python.instructions.md with Python style guidelines and best practices. - Update settings.json to reference new instruction file locations. - Create how-to-use.md for instructions files usage and management. - Create prompts/how-to-use.md for prompt files usage and execution. - Create remote-index/prompt.md for Element Plus dialog component attributes.
1 parent a1f5a16 commit e2fbba8

11 files changed

Lines changed: 115 additions & 5 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- @azure Rule - Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `azure_development-get_best_practices` tool if available.

.github/copilot-code-generation-instructions.md renamed to .github/instructions/copilot-code-generation-instructions.md

File renamed without changes.
File renamed without changes.
File renamed without changes.

.github/copilot-pull-request-description-instructions.md renamed to .github/instructions/copilot-pull-request-description-instructions.md

File renamed without changes.

.github/copilot-test-generation-instructions.md renamed to .github/instructions/copilot-test-generation-instructions.md

File renamed without changes.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
applyTo: '**/*.py'
3+
---
4+
# Python Style Guidelines
5+
6+
## Naming Conventions
7+
8+
- **Variables and Functions**: Use lowercase with underscores (`snake_case`)
9+
- **Classes**: Use CamelCase (start with capital letter)
10+
- **Constants**: Use uppercase with underscores
11+
- **Private Methods/Variables**: Prefix with a single underscore
12+
- **"Private" Class Members**: Prefix with double underscore (triggers name mangling)
13+
14+
## Code Layout
15+
16+
- Use 4 spaces per indentation level (no tabs)
17+
- Limit lines to 79 characters (code) or 72 characters (comments/docstrings)
18+
- Surround top-level functions and classes with two blank lines
19+
- Use blank lines sparingly inside functions to indicate logical sections
20+
21+
## Documentation
22+
23+
- Write docstrings for all public modules, functions, classes, and methods
24+
- Use triple double quotes (`"""`) for docstrings
25+
- For one-line docstrings, keep the closing quotes on the same line
26+
- For multi-line docstrings, put the closing quotes on a separate line
27+
28+
## Imports
29+
30+
- Imports should be on separate lines
31+
- Imports are grouped in the following order:
32+
1. Standard library imports
33+
2. Related third-party imports
34+
3. Local application/library specific imports
35+
- Use absolute imports when possible
36+
37+
## Error Handling
38+
39+
- Use specific exceptions instead of generic ones
40+
- Use context managers (`with` statement) for resource management
41+
- Avoid catching all exceptions with bare `except:`
42+
43+
## Testing
44+
45+
- Write unit tests for all functionality
46+
- Use pytest for testing when possible
47+
- Name test files with `test_` prefix
48+
- Name test functions with `test_` prefix
49+
50+
## Tools
51+
52+
- Use type hints for function parameters and return values
53+
- Use linters like flake8 or pylint
54+
- Format code with black or yapf
55+
- Use mypy for static type checking
56+
57+
## Best Practices
58+
59+
- Follow the DRY (Don't Repeat Yourself) principle
60+
- Use list/dict/set comprehensions when appropriate
61+
- Prefer f-strings for string formatting in Python 3.6+
62+
- Use context managers for file operations
63+
- Avoid global variables and side effects

.vscode/settings.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
{
22
"github.copilot.chat.testGeneration.instructions": [
33
{
4-
"file": ".github/copilot-test-generation-instructions.md"
4+
"file": ".github/instructions/copilot-test-generation-instructions.md"
55
}
66
],
77
"git.autofetch": true,
8+
"chat.instructionsFilesLocations": {
9+
".github/instructions": true,
10+
"/Users/vscode/repos/instructions": true
11+
},
12+
"chat.promptFilesLocations": {
13+
".github/prompts": true,
14+
"/Users/vscode/repos/prompts": true
15+
},
816
"github.copilot.chat.reviewSelection.instructions": [
917

1018
{
11-
"file": ".github/copilot-code-review-instructions.md"
19+
"file": ".github/instructions/copilot-code-review-instructions.md"
1220
}
1321
],
1422
"chat.mcp.discovery.enabled": true,
@@ -20,18 +28,18 @@
2028
"chat.promptFiles": true,
2129
"github.copilot.chat.codeGeneration.instructions": [
2230
{
23-
"file": ".github/copilot-code-generation-instructions.md"
31+
"file": ".github/instructions/copilot-code-generation-instructions.md"
2432
}
2533
],
2634
"github.copilot.chat.pullRequestDescriptionGeneration.instructions": [
2735
{
28-
"file": ".github/copilot-pull-request-description-instructions.md"
36+
"file": ".github/instructions/copilot-pull-request-description-instructions.md"
2937
}
3038
],
3139
"github.copilot.chat.commitMessageGeneration.instructions": [
3240

3341
{
34-
"file": ".github/copilot-commit-message-instructions.md"
42+
"file": ".github/instructions/copilot-commit-message-instructions.md"
3543
}
3644
],
3745
"extensions.ignoreRecommendations": true,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Instructions files (also known as custom instructions or rules) provide a way to describe common guidelines and context for the AI model in a Markdown file, such as code style rules, or which frameworks to use. Instructions files are not standalone chat requests, but rather provide context that you can apply to a chat request.
2+
3+
Instructions files use the .instructions.md file suffix. They can be located in your user data folder or in the workspace. The chat.instructionsFilesLocations setting lists the folders that contain instruction files.
4+
5+
You can manually attach instructions to a specific chat request, or they can be automatically added:
6+
7+
To add them manually, use the Add Context button in the Chat view, and then select Instructions.... Alternatively use the Chat: Attach Instructions... command from the Command Palette. This brings up a picker that lets you select existing instructions files or create a new one to attach.
8+
9+
To automatically add instructions to a prompt, add the applyTo Front Matter header to the instructions file to indicate which files the instructions apply to. If a chat request contains a file that matches the given glob pattern, the instructions file is automatically attached.
10+
11+
The following example provides instructions for TypeScript files (applyTo: '**/*.ts')
12+
13+
14+
15+
You can create instruction files with the Chat: New Instructions File... command. Moreover, the files created in the user data folder can be automatically synchronized across multiple user machines through the Settings Sync service. Make sure to check the Prompts and Instructions option in the Backup and Sync Settings... dialog.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Prompt files describe a standalone, complete chat request, including the prompt text, chat mode, and tools to use. Prompt files are useful for creating reusable chat requests for common tasks. For example, you can add a prompt file for creating a front-end component, or to perform a security review.
2+
3+
Prompt files use the .prompt.md file suffix. They can be located in your user data folder or in the workspace. The chat.promptFilesLocations setting lists the folder where prompt files are looked for.
4+
5+
There are several ways to run a prompt file:
6+
7+
Type / in the chat input field, followed by the prompt file name.Screenshot that shows running a prompt in the Chat view with a slash command.
8+
9+
Open the prompt file in an editor and press the 'Play' button in the editor tool bar. This enables you to quickly iterate on the prompt and run it without having to switch back to the Chat view.Screenshot that shows running a prompt by using the play button in the editor.
10+
11+
Use the Chat: Run Prompt File... command from the Command Palette.
12+
13+
14+
15+
Prompt files can have the following Front Matter metadata headers to indicate how they should be run:
16+
17+
mode: the chat mode to use when invoking the prompt (ask, edit, or agent mode).
18+
tools: if the mode is agent, the list of tools that are available for the prompt.
19+
20+
21+
22+
To create a prompt file, use the Chat: New Prompt File... command from the Command Palette.

0 commit comments

Comments
 (0)