awesome-copilot/prompts/dotnet_design_pattern_review.prompt.md
Daniel Scott-Raynsford 8229a03986 feat: Add comprehensive documentation prompts for OO components, specifications, and .NET best practices
- Introduced a prompt for creating standardized documentation for object-oriented components, adhering to industry best practices and architectural standards.
- Added a prompt for generating new specification files optimized for Generative AI consumption, including best practices for AI-ready specifications.
- Created a prompt for reviewing .NET/C# code against best practices, focusing on documentation, design patterns, dependency injection, and error handling.
- Developed a prompt for reviewing design pattern implementations in .NET/C# code, providing a checklist and improvement focus areas.
- Implemented a prompt for updating Azure Verified Modules in Bicep files to the latest versions, including a breaking change policy.
- Added a prompt for updating existing implementation plans with new requirements or updates to existing code.
- Created a prompt for updating the llms.txt file to reflect changes in documentation or specifications.
- Developed a prompt for updating markdown file sections with an index/table of files from specified folders.
- Introduced a prompt for updating existing object-oriented component documentation based on current implementation.
- Added a prompt for updating existing specifications based on new requirements or code updates.
2025-07-06 11:01:46 +12:00

41 lines
3.0 KiB
Markdown

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