/csharp-dotnet-development:dotnet-best-practicesfrom csharp-dotnet-development
Reviews and improves .NET/C# code against solution best practices covering documentation, architecture, DI, async, tests, configuration, Semantic Kernel, logging, performance, security, SOLID, and code quality.
Ships in csharp-dotnet-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Evaluate selected .NET/C# code or a project area, identify gaps against the solution's conventions, and return actionable refactoring guidance or code changes that preserve behavior while improving maintainability, testability, security, and consistency.
Use the active solution/project. conventions as the source of truth when they are more specific than general .NET guidance.
{Core|Console|App|Service}.{Feature} structure when that convention exists in the solution.| Area | Prefer | Avoid |
|---|---|---|
| Construction | Primary constructor syntax such as public class MyClass(IDependency dependency) for dependency injection. | Service location or mutable public dependencies. |
| Handlers | Command Handler pattern with generic base classes such as CommandHandler<TOptions>. | Large orchestration methods that mix parsing, validation, and execution. |
| Interfaces | Interface segregation with I-prefixed names for test seams. | One broad interface with unrelated responsibilities. |
| Factories | Factory pattern for complex object creation. | Repeated ad hoc object graphs in callers. |
| Lifetimes | Register services as Singleton, Scoped, or Transient based on state and dependency lifetime. | Capturing scoped services in singletons. |
| Validation | Constructor null checks with ArgumentNullException. | Late null failures deep in execution. |
Use Microsoft.Extensions.DependencyInjection patterns and register service interfaces for testability.
ResourceManager.LogMessages and ErrorMessages resource files._resourceManager.GetString("MessageKey") with a named key, not inline display text.IConfiguration and appsettings.json.Required and NotEmptyOrWhitespace when values are mandatory.| Concern | Rule |
|---|---|
| Async/Await I/O | Use async/await (async/await) for I/O and long-running tasks; return Task or Task<T>. |
| Context capture | Use ConfigureAwait(false) where appropriate for library code that does not require a captured context. |
| Exceptions | Throw specific exceptions with descriptive messages; use try-catch blocks only for expected failure scenarios. |
| Logging | Use structured logging through Microsoft.Extensions.Logging and scopes with meaningful context. |
| Data access | Use parameterized queries for database operations. |
| Input | Validate and sanitize external input, especially AI/ML prompts and tool outputs. |
| Disposal | Implement proper disposal patterns for owned resources. |
Microsoft.SemanticKernel with explicit kernel configuration and service registration.Singleton for speed: lifetime must match state and dependencies.ConfigureAwait(false) blindly in application UI or request code: apply it where context capture is unnecessary.## .NET best-practices review
**Status:** pass | fixes recommended | blocked
**Scope:** `<selection/project/path>`
| Area | Finding | Severity | Recommendation |
| --- | --- | --- | --- |
| Dependency injection | <evidence> | High/Medium/Low | <specific fix> |
### Refactoring plan or changes
1. <small, behavior-preserving step>
2. <test or validation step>
### Validation
- `<command or inspection>`: pass | fail | not run, <reason>
LogMessages, ErrorMessages, and configuration binding were checked where relevant.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/aspnet-minimal-api-openapiCreate or review ASP.NET Minimal API endpoints with typed results, DTO validation, endpoint groups, filters, ProblemDetails, and OpenAPI documentation. Use this skill when asked to add Minimal APIs, document endpoints with Swagger/OpenAPI, use .NET 9 built-in OpenAPI, or design request and response types./csharp-asyncReview, design, and fix C# async code using Task, Task<T>, ValueTask<T>, cancellation, ConfigureAwait, async streams, and TAP conventions. Use when the user asks for C# async best practices, deadlock fixes, async method naming, parallel awaits, or replacing .Wait(), .Result, and async void./csharp-mstestApply modern MSTest 3.x/4.x testing practices for C# projects. Use when asked to write or review MSTest unit tests, choose assertion APIs, convert ExpectedException tests, design data-driven tests, use TestContext, configure lifecycle hooks, add categories or work items, or run dotnet test for MSTest./csharp-nunitDesign, write, and review NUnit tests for .NET projects, including standard tests, data-driven tests, assertions, setup/teardown, categories, and isolation with mocks. Use this skill when the user asks for NUnit best practices, `dotnet test`, `[TestCase]`, `[TestCaseSource]`, or C# unit test structure./csharp-tunitWrite, review, or migrate C# unit tests using TUnit. Use when the user asks for TUnit best practices, .NET test project setup, TUnit assertions, lifecycle hooks, data-driven tests, parallel execution, retries, categories, or xUnit-to-TUnit migration./csharp-xunitApply xUnit best practices for C# unit tests, including test project setup, Fact and Theory structure, data-driven tests, assertions, fixtures, mocking, categorization, diagnostics, and dotnet test execution. Use when asked for xUnit guidance or to write .NET unit tests.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin csharp-dotnet-developmentOther plugins' skills for the same job