其他

dotnet-best-practices

github/awesome-copilot

Ensure .NET/C# code meets best practices for the solution/project.

  • 1.6万 次安装
  • 4.1万 星标
  • 收录于

安装命令

npx skills add https://github.com/github/awesome-copilot --skill dotnet-best-practices

要点

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

.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