$npx -y skills add github/awesome-copilot --skill dotnet-design-pattern-reviewReview the C#/.NET code for design pattern implementation and suggest improvements.
| 1 | # .NET/C# Design Pattern Review |
| 2 | |
| 3 | Review the C#/.NET code in ${selection} for design pattern implementation and suggest improvements for the solution/project. Do not make any changes to the code, just provide a review. |
| 4 | |
| 5 | ## Required Design Patterns |
| 6 | |
| 7 | - **Command Pattern**: Generic base classes (`CommandHandler<TOptions>`), `ICommandHandler<TOptions>` interface, `CommandHandlerOptions` inheritance, static `SetupCommand(IHost host)` methods |
| 8 | - **Factory Pattern**: Complex object creation service provider integration |
| 9 | - **Dependency Injection**: Primary constructor syntax, `ArgumentNullException` null checks, interface abstractions, proper service lifetimes |
| 10 | - **Repository Pattern**: Async data access interfaces provider abstractions for connections |
| 11 | - **Provider Pattern**: External service abstractions (database, AI), clear contracts, configuration handling |
| 12 | - **Resource Pattern**: ResourceManager for localized messages, separate .resx files (LogMessages, ErrorMessages) |
| 13 | |
| 14 | ## Review Checklist |
| 15 | |
| 16 | - **Design Patterns**: Identify patterns used. Are Command Handler, Factory, Provider, and Repository patterns correctly implemented? Missing beneficial patterns? |
| 17 | - **Architecture**: Follow namespace conventions (`{Core|Console|App|Service}.{Feature}`)? Proper separation between Core/Console projects? Modular and readable? |
| 18 | - **.NET Best Practices**: Primary constructors, async/await with Task returns, ResourceManager usage, structured logging, strongly-typed configuration? |
| 19 | - **GoF Patterns**: Command, Factory, Template Method, Strategy patterns correctly implemented? |
| 20 | - **SOLID Principles**: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion violations? |
| 21 | - **Performance**: Proper async/await, resource disposal, ConfigureAwait(false), parallel processing opportunities? |
| 22 | - **Maintainability**: Clear separation of concerns, consistent error handling, proper configuration usage? |
| 23 | - **Testability**: Dependencies abstracted via interfaces, mockable components, async testability, AAA pattern compatibility? |
| 24 | - **Security**: Input validation, secure credential handling, parameterized queries, safe exception handling? |
| 25 | - **Documentation**: XML docs for public APIs, parameter/return descriptions, resource file organization? |
| 26 | - **Code Clarity**: Meaningful names reflecting domain concepts, clear intent through patterns, self-explanatory structure? |
| 27 | - **Clean Code**: Consistent style, appropriate method/class size, minimal complexity, eliminated duplication? |
| 28 | |
| 29 | ## Improvement Focus Areas |
| 30 | |
| 31 | - **Command Handlers**: Validation in base class, consistent error handling, proper resource management |
| 32 | - **Factories**: Dependency configuration, service provider integration, disposal patterns |
| 33 | - **Providers**: Connection management, async patterns, exception handling and logging |
| 34 | - **Configuration**: Data annotations, validation attributes, secure sensitive value handling |
| 35 | - **AI/ML Integration**: Semantic Kernel patterns, structured output handling, model configuration |
| 36 | |
| 37 | Provide specific, actionable recommendations for improvements aligned with the project's architecture and .NET best practices. |