{"id":"219e572c-f795-48d9-ac75-4a9089bfe795","shortId":"RC9WZZ","kind":"skill","title":"dotnet-best-practices","tagline":"Ensure .NET/C# code meets best practices for the solution/project.","description":"# .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 & 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 & 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<TOptions>`)\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 & 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 & 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<T> 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 & 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 & 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 & 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 & 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","tags":["dotnet","best","practices","awesome","copilot","github","agent-skills","agents","custom-agents","github-copilot","hacktoberfest","prompt-engineering"],"capabilities":["skill","source-github","skill-dotnet-best-practices","topic-agent-skills","topic-agents","topic-awesome","topic-custom-agents","topic-github-copilot","topic-hacktoberfest","topic-prompt-engineering"],"categories":["awesome-copilot"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/github/awesome-copilot/dotnet-best-practices","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add github/awesome-copilot","source_repo":"https://github.com/github/awesome-copilot","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 33270 github stars · SKILL.md body (3,110 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:52:10.192Z","embedding":null,"createdAt":"2026-04-18T20:25:03.318Z","updatedAt":"2026-05-18T18:52:10.192Z","lastSeenAt":"2026-05-18T18:52:10.192Z","tsv":"'12':316 '8':320 'aaa':206 'access':162 'act':209 'ai':254,259,269,281 'ai/ml':341 'annot':237 'app':68 'applic':323 'appropri':132,191 'appsettings.json':249 'architectur':73 'argumentnullexcept':128 'arrang':208 'assert':204,210 'async':185,193 'async/await':167,170 'attribut':240 'avoid':349 'base':94,353 'best':3,9,15,28 'bind':245 'block':307 'c':315 'catch':306 'chatcomplet':272 'check':126 'class':46,83,95,234,354 'clear':102 'code':7,23,338,343,350 'cohes':368 'command':89 'commandhandl':97 'comment':42,60 'complex':114 'complianc':348 'comprehens':39 'concept':363 'configur':227,233,250,264 'configureawait':188 'consol':67 'constructor':76,121 'context':296 'convent':104 'core':66 'creat':38 'creation':116 'data':236 'databas':334 'depend':79,86,117,122,215 'descript':53,57,301 'design':71 'dispos':371 'document':36,41 'domain':362 'dotnet':2 'dotnet-best-practic':1 'duplic':351 'e.g':81,96 'embed':273 'ensur':5,21,345 'error':154,283 'errormessag':159 'establish':63 'etc':274 'except':194,299 'expect':309 'factori':111 'failur':220,310 'fals':189 'featur':70,317 'file':161,251 'fluentassert':202 'focus':366 'follow':61,109,205,336 'framework':200 'generic':93 'handl':192,268,284 'handler':90 'i/o':173 'iconfigur':244 'idepend':85 'implement':87,140,238,261,324,369 'includ':35,51,222,291 'inject':80,118,123 'input':326 'integr':255 'interfac':47,99,106,142 'keep':364 'kernel':253,263 'lifetim':133 'local':147,151 'log':285,288,293 'logmessag':157 'long':177 'long-run':176 'manag':146 'meaning':295,358 'meet':8,26 'messag':152,302 'messagekey':166 'method':48,186,365 'microsoft.extensions.dependencyinjection':138 'microsoft.extensions.logging':290 'microsoft.semantickernel':257 'mock':214 'model':270 'moq':212 'mstest':199 'myclass':84 'name':103,359 'namespac':64 'net':319 'net/c':6,14,22 'notemptyorwhitespac':242 'null':125,223 'object':115 'oper':174,260,335,342 'optim':321 'output':277 'paramet':52,224 'parameter':331 'pattern':72,91,112,139,168,207,278,372 'perform':312 'practic':4,10,16,29,339 'prefix':105 'primari':75 'principl':347 'proper':195,262,325,370 'properti':50 'public':45,82 'qualiti':344 'queri':332 'reflect':361 'regist':129 'registr':267 'reliabl':280 'requir':241 'resourc':145,160,163,374 'resourcemanag':149 'resourcemanager.getstring':165 'respons':282 'return':55,180 'run':178 'sanit':329 'scenario':221,311 'scope':135,292 'secur':313,337 'segreg':100 'select':25 'semant':252 'separ':156 'servic':69,119,130,141,266 'set':228,247,271 'singleton':134 'skill' 'skill-dotnet-best-practices' 'solid':346 'solution/project':13,33 'source-github' 'specif':30,298 'standard':197 'string':155 'strong':231 'strongly-typ':230 'structur':37,65,276,287 'success':218 'support':248 'syntax':77 'task':18,179,181,183 'test':196,216,226 'testabl':144 'throw':297 'topic-agent-skills' 'topic-agents' 'topic-awesome' 'topic-custom-agents' 'topic-github-copilot' 'topic-hacktoberfest' 'topic-prompt-engineering' 'transient':136 'tri':305 'try-catch':304 'type':232 'use':74,98,120,137,148,169,187,198,211,229,243,256,275,286,303,314,330,357 'util':356 'valid':225,239,327 'valu':56 'via':127,164 'xml':40,59","prices":[{"id":"89f13af8-dae1-4422-a2ac-053b1181a3bf","listingId":"219e572c-f795-48d9-ac75-4a9089bfe795","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"github","category":"awesome-copilot","install_from":"skills.sh"},"createdAt":"2026-04-18T20:25:03.318Z"}],"sources":[{"listingId":"219e572c-f795-48d9-ac75-4a9089bfe795","source":"github","sourceId":"github/awesome-copilot/dotnet-best-practices","sourceUrl":"https://github.com/github/awesome-copilot/tree/main/skills/dotnet-best-practices","isPrimary":false,"firstSeenAt":"2026-04-18T21:49:10.861Z","lastSeenAt":"2026-05-18T18:52:10.192Z"},{"listingId":"219e572c-f795-48d9-ac75-4a9089bfe795","source":"skills_sh","sourceId":"github/awesome-copilot/dotnet-best-practices","sourceUrl":"https://skills.sh/github/awesome-copilot/dotnet-best-practices","isPrimary":true,"firstSeenAt":"2026-04-18T20:25:03.318Z","lastSeenAt":"2026-05-07T22:40:16.333Z"}],"details":{"listingId":"219e572c-f795-48d9-ac75-4a9089bfe795","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"github","slug":"dotnet-best-practices","github":{"repo":"github/awesome-copilot","stars":33270,"topics":["agent-skills","agents","ai","awesome","custom-agents","github-copilot","hacktoberfest","prompt-engineering"],"license":"mit","html_url":"https://github.com/github/awesome-copilot","pushed_at":"2026-05-18T01:26:59Z","description":"Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.","skill_md_sha":"183d3beb113dd62a8bc6d2f2c9ea1b4fd8d3c5ed","skill_md_path":"skills/dotnet-best-practices/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/github/awesome-copilot/tree/main/skills/dotnet-best-practices"},"layout":"multi","source":"github","category":"awesome-copilot","frontmatter":{"name":"dotnet-best-practices","description":"Ensure .NET/C# code meets best practices for the solution/project."},"skills_sh_url":"https://skills.sh/github/awesome-copilot/dotnet-best-practices"},"updatedAt":"2026-05-18T18:52:10.192Z"}}