dotnet-best-practices

Installation
Summary

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
SKILL.md

.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

Related skills

More from github/awesome-copilot

Installs
11.3K
GitHub Stars
32.8K
First Seen
Feb 25, 2026