dotnet-best-practices

Review .NET/C# code for best practices in architecture, DI, async, and security.

Updated Dec 20, 2023
One-click install
npx skills add https://github.com/Thiago-Cruz-eng/Hibrygame --skill dotnet-best-practices-thiago-cruz-eng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-best-practices
Source: https://github.com/Thiago-Cruz-eng/Hibrygame/tree/main/.claude/skills/dotnet-best-practices
Command: npx skills add https://github.com/Thiago-Cruz-eng/Hibrygame --skill dotnet-best-practices-thiago-cruz-eng

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you write .NET/C# code that consistently follows best practices for maintainability, correctness, security, and long-term scalability.

Core Features & Use Cases

  • Documentation & structure: Enforces XML documentation and a consistent namespace structure for public APIs.
  • Architecture & patterns: Guides dependency injection patterns, command handler architecture, and common design patterns like factories and interface segregation.
  • Reliability, performance & security: Covers async/await usage, error handling with structured logging, secure input handling, and performance-minded modern C#/.NET guidance.
  • Testing & configuration: Recommends MSTest with FluentAssertions, AAA test structure, Moq mocking, and strongly-typed configuration with validation attributes.
  • Semantic Kernel integration: Ensures proper Microsoft.SemanticKernel setup and structured output patterns for dependable AI responses.

Quick Start

Review the C# code in your selection and rewrite it to follow the specified .NET best practices, including XML docs, DI patterns, async conventions, structured logging, and secure coding recommendations.

Frequently Asked Questions about dotnet-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor existing C# code to follow .NET best practices?

To refactor C# code for .NET best practices, enforce XML documentation, apply dependency injection patterns, correct async/await usage, and implement structured logging. Rewrite selections to ensure maintainability, secure input handling, and robust testing standards across enterprise applications.

What's the best way to structure async/await and dependency injection in .NET services?

The best way to structure async/await and dependency injection in .NET services is using command handler architecture and interface segregation. Apply proper DI patterns for maintainability and ensure async conventions are followed for reliable, production-ready performance.

Does this .NET best practices guidance cover Semantic Kernel AI integration?

Yes, this .NET guidance covers Semantic Kernel AI integration. It ensures proper Microsoft.SemanticKernel setup and structured output patterns, validating configuration to deliver dependable AI responses within your enterprise application architecture.

What testing standards should I use for .NET code review?

For .NET code review, testing standards should include MSTest with FluentAssertions, an AAA test structure, and Moq mocking. Validate that tests follow robust conventions to ensure correctness and maintainability across your services and handlers.

Why do I need strongly-typed configuration and XML documentation in C# public APIs?

You need strongly-typed configuration and XML documentation in C# public APIs to enforce validation attributes and maintain consistent namespace structure. This ensures long-term scalability, correctness, and clear API contracts for enterprise .NET applications.

Can I use these .NET best practices for validating secure coding and error handling?

Yes, you can use these .NET best practices for validating secure coding and error handling. The guidance covers secure input handling and structured logging with error handling to ensure production-ready, reliable services across your solution architecture.