Agent skill · software engineering · affaan-m

dotnet-patterns

Idiomatic C# and .NET patterns, conventions, dependency injection, async/await, and best practices for building robust, maintainable .NET applications. Use when writing or reviewing C# / .NET code — DI, async, or general conventions.

Why this skill is useful

Provides idiomatic C# and .NET patterns that enhance the AI's ability to generate maintainable and robust .NET applications.

What it needs

About 4k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.

What this skill does

.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. 2. Explicit Over Implicit Be clear about nullability, access modifiers, and intent. 3. Depend on Abstractions Use interfaces for service boundaries. Register via DI container. Async/Await Patterns Proper Async Usage Parallel Async Operations Options Pattern Bind configuration sections to strongly-typed objects. Result Pattern Return explicit success/failure instead of throwing for expected failures. Repository Pattern with EF Core Middleware and Pipeline Minimal API Patterns Guard Clauses Anti-Patterns to Avoid Anti-Pattern Fix --- --- async void methods Return Task (except event handlers) .Result or .Wait() Use await catch (Exception) { } Handle or rethrow with context new Service() in constructors Use constructor injection public fields Use properties with appropriate accessors dynamic in business logic Use generics or explicit types Mutable static state Use DI scoping or ConcurrentDictionary string.Format in loops Use StringBuilder or interpolated string handlers

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/dotnet-patterns--8172af

View the source on GitHub

Browse the @skills marketplace