{"kind":"Skill","metadata":{"namespace":"community","name":"dotnet-best-practices","version":"0.1.0"},"spec":{"description":"Ensure .NET/C# code meets best practices for the solution/project.","files":{"SKILL.md":"---\nname: dotnet-best-practices\ndescription: 'Ensure .NET/C# code meets best practices for the solution/project.'\n---\n\n# .NET/C# Best Practices\n\nYour task is to ensure .NET/C# code in ${selection} meets the best practices specific to this solution/project. This includes:\n\n## Documentation \u0026 Structure\n\n- Create comprehensive XML documentation comments for all public classes, interfaces, methods, and properties\n- Include parameter descriptions and return value descriptions in XML comments\n- Follow the established namespace structure: {Core|Console|App|Service}.{Feature}\n\n## Design Patterns \u0026 Architecture\n\n- Use primary constructor syntax for dependency injection (e.g., `public class MyClass(IDependency dependency)`)\n- Implement the Command Handler pattern with generic base classes (e.g., `CommandHandler\u003cTOptions\u003e`)\n- Use interface segregation with clear naming conventions (prefix interfaces with 'I')\n- Follow the Factory pattern for complex object creation.\n\n## Dependency Injection \u0026 Services\n\n- Use constructor dependency injection with null checks via ArgumentNullException\n- Register services with appropriate lifetimes (Singleton, Scoped, Transient)\n- Use Microsoft.Extensions.DependencyInjection patterns\n- Implement service interfaces for testability\n\n## Resource Management \u0026 Localization\n\n- Use ResourceManager for localized messages and error strings\n- Separate LogMessages and ErrorMessages resource files\n- Access resources via `_resourceManager.GetString(\"MessageKey\")`\n\n## Async/Await Patterns\n\n- Use async/await for all I/O operations and long-running tasks\n- Return Task or Task\u003cT\u003e from async methods\n- Use ConfigureAwait(false) where appropriate\n- Handle async exceptions properly\n\n## Testing Standards\n\n- Use MSTest framework with FluentAssertions for assertions\n- Follow AAA pattern (Arrange, Act, Assert)\n- Use Moq for mocking dependencies\n- Test both success and failure scenarios\n- Include null parameter validation tests\n\n## Configuration \u0026 Settings\n\n- Use strongly-typed configuration classes with data annotations\n- Implement validation attributes (Required, NotEmptyOrWhitespace)\n- Use IConfiguration binding for settings\n- Support appsettings.json configuration files\n\n## Semantic Kernel \u0026 AI Integration\n\n- Use Microsoft.SemanticKernel for AI operations\n- Implement proper kernel configuration and service registration\n- Handle AI model settings (ChatCompletion, Embedding, etc.)\n- Use structured output patterns for reliable AI responses\n\n## Error Handling \u0026 Logging\n\n- Use structured logging with Microsoft.Extensions.Logging\n- Include scoped logging with meaningful context\n- Throw specific exceptions with descriptive messages\n- Use try-catch blocks for expected failure scenarios\n\n## Performance \u0026 Security\n\n- Use C# 12+ features and .NET 8 optimizations where applicable\n- Implement proper input validation and sanitization\n- Use parameterized queries for database operations\n- Follow secure coding practices for AI/ML operations\n\n## Code Quality\n\n- Ensure SOLID principles compliance\n- Avoid code duplication through base classes and utilities\n- Use meaningful names that reflect domain concepts\n- Keep methods focused and cohesive\n- Implement proper disposal patterns for resources\n"},"import":{"commit_sha":"541b7819d8c3545c6df122491af4fa1eae415779","imported_at":"2026-05-18T20:05:35Z","license_text":"MIT License\n\nCopyright GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","owner":"github","repo":"github/awesome-copilot","source_url":"https://github.com/github/awesome-copilot/tree/541b7819d8c3545c6df122491af4fa1eae415779/plugins/csharp-dotnet-development/skills/dotnet-best-practices"}},"content_hash":[215,6,231,133,195,188,11,109,228,72,37,208,128,73,238,177,116,53,12,145,238,76,106,230,217,255,20,1,2,142,234,22],"trust_level":"unsigned","yanked":false}
