modern-csharp-coding-standards

Guide C# refactoring toward C# 12+ patterns with records and Span<T>.

1.1k|101|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill modern-csharp-coding-standards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-csharp-coding-standards
Source: https://github.com/Aaronontheweb/dotnet-skills/tree/main/skills/csharp-coding-standards
Command: npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill modern-csharp-coding-standards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill standardizes and accelerates C# development by providing guidance on modern patterns, strong typing, and high-performance practices to reduce bugs and improve API design.

Core Features & Use Cases

  • Immutability by default with records and init-only properties.
  • Modern pattern matching and value object patterns for cleaner domain models.
  • Performance-focused API design using Span<T>, Memory<T>, and zero-allocation strategies.
  • Async/await best practices including cancellation, streaming, and safety considerations.
  • Guidance for refactoring toward C# 12+ features with practical examples.

Quick Start

Use this skill to guide refactoring of a codebase toward C# 12+ features, with concrete patterns and example-driven recommendations.

Frequently Asked Questions about modern-csharp-coding-standards

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

FAQPage Schema
How do I use records and init-only properties to make C# domain models immutable?

To make C# domain models immutable, use records and init-only properties to enforce immutability by default, which reduces side effects and bugs. This skill provides concrete patterns for refactoring models toward these modern C# standards.

What is the best way to use Span<T> and Memory<T> for high-performance C# API design?

The best way to use Span<T> and Memory<T> for high-performance C# API design is applying zero-allocation strategies. This skill guides developers through performance-focused API design using these modern memory management patterns.

How do I handle cancellation and streaming with async/await best practices in C#?

Handling cancellation and streaming with async/await best practices in C# requires proper safety considerations and cancellation tokens. This skill provides guidance on asynchronous programming patterns including these critical safety measures.

When should I use modern pattern matching in C# 12 for domain modeling?

You should use modern pattern matching in C# 12 for domain modeling when you need cleaner value object patterns and more expressive type checking. This skill guides developers on applying these patterns for clearer domain models.

Can I refactor an existing codebase toward C# 12+ features with this guidance?

Yes, you can refactor an existing codebase toward C# 12+ features using this skill. It provides example-driven recommendations and practical patterns for migrating legacy code to modern, high-performance C# standards.

Does this C# coding standards guidance apply to API design and performance optimization?

Yes, this C# coding standards guidance applies to API design and performance optimization. It standardizes C# development by providing strong typing and high-performance practices to reduce bugs and improve API design.