https://github.com/nikiforovall/dotnet-copilot-rules
A collection of GitHub Copilot AI rules for .NET development best practices.
https://github.com/nikiforovall/dotnet-copilot-rules
ai copilot github-copilot prompts
Last synced: about 1 year ago
JSON representation
A collection of GitHub Copilot AI rules for .NET development best practices.
- Host: GitHub
- URL: https://github.com/nikiforovall/dotnet-copilot-rules
- Owner: NikiforovAll
- License: apache-2.0
- Created: 2025-03-08T08:32:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T10:24:46.000Z (over 1 year ago)
- Last Synced: 2025-03-08T11:24:54.787Z (over 1 year ago)
- Topics: ai, copilot, github-copilot, prompts
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ค .NET GitHub Copilot Rules
A collection of [GitHub Copilot AI rules](https://code.visualstudio.com/docs/copilot/copilot-customization) for .NET development best practices.
> [!TIP]
> You can enhance Copilot's chat responses by providing it with contextual details about your team's workflow, tools, or project specifics.
## ๐ Customizations: Instructions, Prompts, MCPs, etc.
This set of rules is a good starting point and should be customized to fit your specific needs. You can add or remove rules as necessary.
### ๐ป .NET Development
Rules for writing clean, maintainable C# code:
- โจ Modern C# coding patterns
- ๐งช Testing best practices
- ๐ Code organization
- ๐ก๏ธ Error handling
- ๐ Dependency management
* Code-generation instructions - [csharp/coding-guidelines.md](.vscode/instructions/coding-guidelines.instructions.md), [csharp/coding-style.md](.vscode/instructions/coding-style.instructions.md)
* Test-generation instructions - [csharp/testing-xunit.md](.vscode/instructions/testing-xunit.instructions.md)
### โณ [Git](.vscode/git-message.instructions.md)
* Commit message generation instructions - [git-message.md](.vscode/git-message.instructions.md)
### Tools
Here is my top content extraction tools for GitHub Copilot:
* `#fetch` - fetch web page
* `#githubRepo` - fetch remote GitHub repository
* `#context7` - fetch docs
* `#codebase` - work with the code base
## How to Use This Repository
Copy the relevant instructions you want to use into your project's `.vscode/instructions` directory and configure `github.copilot.chat.codeGeneration.instructions` if needed.
Here is an example of how to set up your `.vscode/settings.json` file:
```json
{
"chat.promptFiles": true,
"chat.promptFilesLocations": {
".vscode/prompts": true
},
"chat.instructionsFilesLocations": {
".vscode/instructions": true
},
"github.copilot.chat.codeGeneration.instructions": [],
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"file": ".vscode/git-message.instructions.md"
}
],
"github.copilot.chat.reviewSelection.enabled": true,
"github.copilot.chat.reviewSelection.instructions": [
{
"file": ".vscode/instructions/coding-guidelines.instructions.md"
},
{
"file": ".vscode/instructions/coding-style.instructions.md"
}
],
"github.copilot.chat.testGeneration.instructions": [
{
"file": ".vscode/instructions/testing-xunit.instructions.md"
}
]
}
```
## ๐ Motivation
### Productivity
You can create reusable instructions and prompts for your team to handle common tasks and GenAI scenarios effectively.
### Coding with Agents in Mind
Shift your mindset from being a code typist to an AI operator when appropriate. Start with an instruction prompt and gather as much context as possible. Once you clearly understand the task, determine the level of AI assistance needed.
๐ก To stay in the "Productivity Zone", gain experience with various AI models.
### Treat AI as a Teammate
Building a successful, maintainable project requires clean, idiomatic, and consistent code. This is where *coding guidelines* are essential. They:
- Promote consistency, readability, and maintainability.
- Streamline collaboration and reduce technical debt.
- Provide context for AI tools, ensuring generated code aligns with project standards.
Without clear guidelines, AI contributions may introduce inconsistencies, increasing maintenance overhead.
### Documentation
Document your coding guidelines so it can be consumed by AI tools. Not only can it be used for additional context for code generation, but also now you can chat with LLMs about your coding guidelines. It becomes integral part of your project.
๐ก For example, you can ask Copilot to review your code, and it will refer to the guidelines you provided.
### Agent Mode
With the introduction of [Agent Mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode), clear guidelines are crucial. They ensure consistency and independence in AI-generated contributions.
## Changelog:
* New release introduces a better way to provide context to Copilot.
* Custom Instructions (user/workspace)
* Custom Prompts (user/workspace)
## Blogs
* https://nikiforovall.blog/productivity/2025/03/08/github-copilot-instructions-for-dotnet.html
* https://nikiforovall.blog/productivity/2025/04/19/github-copilot-prompt-engineering.html
* https://nikiforovall.blog/productivity/2025/05/03/github-copilot-prompt-engineering-code-review.html
## ๐ณ Credits
Inspired by