affaan-m avatar

Dotnet Patterns

This is a comprehensive reference for writing production-quality C# code the way experienced .NET developers actually do it. It covers the patterns that matter: dependency injection with interfaces, async/await done right with CancellationToken threading, immutability with records, the options pattern for configuration, and proper repository implementations with EF Core. The examples are realistic, showing both good and bad approaches. Use this when you want Claude to write .NET code that follows modern conventions instead of generating the mutable-everything, sync-over-async antipatterns that plague a lot of codegen. The result pattern section alone is worth having loaded if you're tired of exception-driven control flow.

skills.sh installs
5.6K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill dotnet-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

.NET Development Patterns

Idiomatic C# and .NET patterns for building robust, performant, and maintainable applications.

When to Activate

  • Writing new C# code
  • Reviewing C# code
  • Refactoring existing .NET applications
  • Designing service architectures with ASP.NET Core

Core Principles

1. Prefer Immutability

Use records and init-only properties for data models. Mutability should be an explicit, justified choice.

// Good: Immutable value object
public sealed record Money(decimal Amount, string Currency);

// Good: Immutable DTO with init setters
public sealed class CreateOrderRequest
{
    public required string CustomerId { get; init; }
    public required IReadOnlyList<OrderItem> Items { get; init; }
}

// Bad: Mutable model with public setters
public class Order
{
    public string CustomerId { get; set; }
    public List<OrderItem> Items { get; set; }
}

2. Explicit Over Implicit

Be clear about nullability, access modifiers, and intent.

// Good: Explicit access modifiers and nullability
public sealed class UserService
{
    private readonly IUserRepository _repository;
    private readonly ILogger<UserService> _logger;

Sponsors

Details

Repository
github.com/affaan-m/ecc
Category
.NET & C#
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263

Recommended

More .NET & C#
1affaan-m avatarcsharp-testingaffaan-m/eccC# and .NET testing patterns with xUnit, FluentAssertions, mocking, integration tests, and test organization best practices.5.5Kskills.sh installs
2dotnet avatardotnet-webapidotnet/skillsGuides creation and modification of ASP.NET Core Web API endpoints with correct HTTP semantics, OpenAPI metadata, and error handling. USE FOR: adding new API en5.2Kskills.sh installs
3jeffallan avatarcsharp-developerjeffallan/claude-skillsUse when building C# applications with .NET 8+, ASP.NET Core APIs, or Blazor web apps. Builds REST APIs using minimal or controller-based routing, configures da5.1Kskills.sh installs
4openai avataraspnet-coreopenai/skillsBuild, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development. Use when working on Blazor Web App4.1Kskills.sh installs
5dotnet avatarconfiguring-opentelemetry-dotnetdotnet/skillsConfigure OpenTelemetry distributed tracing, metrics, and logging in ASP.NET Core using the .NET OpenTelemetry SDK. Use when adding observability, setting up OT3.4Kskills.sh installs
6getsentry avatarsentry-dotnet-sdkgetsentry/sentry-for-aiFull Sentry SDK setup for .NET. Use when asked to "add Sentry to .NET", "install Sentry for C#", or configure error monitoring, tracing, profiling, logging, or 2.3Kskills.sh installs