General
329 installs
.NET/C# Best Practices
by github/awesome-copilot
Ensure .NET/C# code meets best practices for the solution/project.
Skill content
Validate .NET/C# code against comprehensive best practices for your solution and project.
- Covers 10+ practice areas including XML documentation, design patterns, dependency injection, async/await, testing standards, and error handling
- Enforces specific patterns: primary constructors for DI, Command Handler pattern with generics, interface segregation, and Factory pattern for object creation
- Includes resource management with ResourceManager for localization, structured logging via Microsoft.Extensions.Logging, and Semantic Kernel integration for AI operations
- Requires MSTest with FluentAssertions for testing, strongly-typed configuration with data annotations, and C# 12+ / .NET 8 feature adoption
.NET/C# Best Practices
Your task is to ensure .NET/C# code in ${selection} meets the best practices specific to this solution/project. This includes:
Documentation & Structure
- Create comprehensive XML documentation comments for all public classes, interfaces, methods, and properties
- Include parameter descriptions and return value descriptions in XML comments
- Follow the established namespace structure: {Core|Console|App|Service}.{Feature}
Design Patterns & Architecture
- Use primary constructor syntax for dependency injection (e.g., public class MyClass(IDependency dependency))
- Implement the Command Handler pattern with generic base classes (e.g., CommandHandler<TOptions>)
- Use interface segregation with clear naming conventions (prefix interfaces with 'I')
- Follow the Factory pattern for complex object creation.
Dependency Injection & Services