What does this skill do?

The .NET Skill Pattern provides a set of coding conventions in C# and .NET for building robust, efficient, and maintainable applications. It covers everything from immutability using records and init-only properties to the proper handling of asynchrony with CancellationToken, repositories with EF Core, and Minimal APIs with route groups.

Reviewing Pull Requests
Apply idiomatic patterns when reviewing new C# code, detecting anti-patterns such as `async void` or `.Result`.
Refactoring .NET Apps
Modernize existing applications by migrating to records, constructor injection, and the Options Pattern.
ASP.NET Core Service Design
Define service architectures with explicit dependencies, EF Core repositories, and Minimal APIs.
Correct Asynchrony
Implement async/await with CancellationToken propagation and parallelization using Task.WhenAll.

Usage examples

📝 Review PR
Take a look at this C# pull request and let me know if there are any anti-patterns, such as `async void`, `.Result`, or tightly coupled dependencies.
🔄 Refactor the service
Refactor this UserService class to use constructor injection, records, and CancellationToken in all async methods.
🏗️ Create Minimal API
Create a Minimal API endpoint with route groups for /api/orders that uses an injected repository and returns TypedResults.
⚡ Optimize async
I have a method that loads a dashboard using three sequential calls. Parallelize it using Task.WhenAll and propagate the CancellationToken.

Features

Immutability with Records Immutable data models using records, init-only properties, and required members in C# 12.
Explicit Dependency Injection Services with constructor dependencies, explicit nullability, and registration in the DI container.
Correct use of async/await Propagation of CancellationToken, avoiding .Result/.Wait(), and parallelization with Task.WhenAll.
Repositories with EF Core Repository pattern using AsNoTracking, selective include, and SaveChangesAsync with cancellation.
Table of Anti-Patterns Quick reference to common errors and their solutions: `async void`, public fields, mutable static variables, and more.

Frequently asked questions

It is built for .NET 8 or later, taking advantage of features such as records, required members, and Minimal APIs with route groups.
No. The skill is a guide to patterns and conventions that Claude applies when generating or reviewing C# code. It does not require any additional configuration.
Yes. The skill specifically covers patterns for ASP.NET Core services, repositories using Entity Framework Core, and Minimal APIs.
Sí. La skill recomienda devolver resultados explícitos con Result<T> para fallos esperados en lugar de lanzar excepciones.
.NET Patterns — Idiomatic and Robust C# Code with Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.