Agent skill · software engineering · aaronontheweb

modern-csharp-coding-standards

Write modern, high-performance C# code using records, pattern matching, value objects, async/await, Span<T>/Memory<T>, and best-practice API design patterns. Emphasizes functional-style programming with C# 12+ features.

Why this skill is useful

Provides specific patterns and practices for modern C# coding that enhance performance and maintainability, which the AI may not generate on its own.

What it needs

About 5k tokens when loaded. Last updated 2026-07-03. 1,095 stars on the source repository.

What this skill does

Modern C# Coding Standards When to Use This Skill Use this skill when: Writing new C# code or refactoring existing code Designing public APIs for libraries or services Optimizing performance-critical code paths Implementing domain models with strong typing Building async/await-heavy applications Working with binary data, buffers, or high-throughput scenarios Reference Files value-objects-and-patterns.md: Full value object examples and pattern matching code performance-and-api-design.md: Span<T>/Memory<T> examples and API design principles composition-and-error-handling.md: Composition over inheritance, Result type, testing patterns anti-patterns-and-reflection.md: Reflection avoidance and common anti-patterns Core Principles 1. Immutability by Default - Use record types and init-only properties 2. Type Safety - Leverage nullable reference types and value objects 3. Modern Pattern Matching - Use switch expressions and patterns extensively 4. Async Everywhere - Prefer async APIs with proper cancellation support 5. Zero-Allocation Patterns - Use Span<T> and Memory<T> for performance-critical code 6. API Design - Accept abstractions, return appropriately specific types 7. Composition Over Inheritance - Avoid abstract base classes, prefer composition 8. Value Objects as Structs - Use readonly record struct for value objects --- Language Patterns Records for Immutable Data (C# 9+) Use record types for DTOs, messages, events, and domain entities. When to use record class vs record struct: record class (default): Reference types, use for entities, aggregates, DTOs with multiple properties record struct: Value types, use for value objects (see next section) Value Objects as readonly record struct Value objects should always be readonly record struct for performance and value semantics. Use explicit conversions, never implicit operators. …

How to use it

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

@skills aaronontheweb/csharp-coding-standards

View the source on GitHub

Browse the @skills marketplace