dotnet-patterns

Apply idiomatic C# and .NET patterns to ASP.NET Core services with async workflows.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/llmh333/employee_management_spring --skill dotnet-patterns-llmh333
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-patterns
Source: https://github.com/llmh333/employee_management_spring/tree/main/.gemini/skills/dotnet-patterns
Command: npx skills add https://github.com/llmh333/employee_management_spring --skill dotnet-patterns-llmh333

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps developers avoid common C# and .NET pitfalls by providing idiomatic patterns for writing maintainable, robust services with correct async behavior and clean architecture.

Core Features & Use Cases

  • Immutable-by-default modeling: Use records and init-only properties to reduce bugs from shared mutable state, especially in DTOs and value objects.
  • DI-friendly, abstraction-based design: Structure services and repositories behind interfaces and register them via the built-in dependency injection container.
  • Production-grade async and API patterns: Apply correct async/await usage with cancellation tokens, plus practical patterns like options binding, guard clauses, and minimal API route grouping.

Quick Start

Use the dotnet-patterns skill to refactor an ASP.NET Core service by applying immutability, explicit nullability, dependency injection interfaces, and correct async/await with cancellation tokens.

Frequently Asked Questions about dotnet-patterns

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

FAQPage Schema
How do I structure an ASP.NET Core service with dependency injection correctly?

To structure an ASP.NET Core service with dependency injection, define services behind interfaces and register them via the built-in DI container to ensure maintainable, abstraction-based application code.

What's the best way to handle async/await in minimal APIs?

The best way to handle async/await in minimal APIs is to apply correct async/await usage with CancellationToken, ensuring robust production-grade API workflows and avoiding common async pitfalls.

Why should I use records for DTOs in C#?

You should use records for DTOs in C# to enforce immutability-by-default modeling, which reduces bugs from shared mutable state by utilizing init-only properties and explicit nullability.

How to configure options binding and guard clauses in .NET?

To configure options binding and guard clauses in .NET, apply practical patterns that validate inputs explicitly, ensuring robust and maintainable application code while avoiding common anti-patterns.

Can I refactor an existing ASP.NET Core service to use minimal API route grouping?

Yes, you can refactor an existing ASP.NET Core service to use minimal API route grouping by applying immutability, explicit nullability, and dependency injection interfaces alongside correct async workflows.