modern-csharp-coding-standards

Enforce modern C# coding standards for .NET 6+ APIs and domain models.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/luongnguyenminhan/EmployeeDemoCS --skill modern-csharp-coding-standards-luongnguyenminhan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-csharp-coding-standards
Source: https://github.com/luongnguyenminhan/EmployeeDemoCS/tree/main/.github/skills/csharp-coding-standards
Command: npx skills add https://github.com/luongnguyenminhan/EmployeeDemoCS --skill modern-csharp-coding-standards-luongnguyenminhan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Modern C# coding standards establish a clear, reusable blueprint that improves readability, safety, and performance across projects.

Core Features & Use Cases

  • Immutability by default with records and init properties to prevent unintended mutations.
  • Value objects via readonly record structs for strong typing and zero-allocation semantics.
  • Advanced pattern matching and API design guidance to produce expressive, maintainable code.
  • Performance-oriented practices including Span<T> and Memory<T> usage, and high-throughput patterns.

Quick Start

Apply these standards by refactoring a sample domain model to utilize records for data shapes, readonly structs for value objects, and pattern matching for control flow.

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 enforce modern C# coding standards for high-performance and maintainable code?

Modern C# coding standards are enforced by applying immutability with records, readonly structs for value objects, and pattern matching for control flow across .NET 6+ projects. This blueprint improves readability, safety, and performance by preventing unintended mutations and reducing allocations.

What is the best way to use records and readonly structs for C# domain models?

Records and readonly structs provide immutability and zero-allocation semantics for C# domain models. Records define data shapes preventing unintended mutations, while readonly record structs create strongly typed value objects that enhance performance and maintainability.

When should I use Span<T> and Memory<T> in C# for high-throughput applications?

Span<T> and Memory<T> are used in C# for high-throughput applications to achieve performance-oriented practices with zero-allocation semantics. They provide safe, efficient memory manipulation over contiguous regions without the overhead of traditional array copying.

Does this C# coding standards guidance support older .NET frameworks or only .NET 6+?

This C# coding standards guidance targets .NET 6+ or newer exclusively. It leverages modern language features like init properties, advanced pattern matching, and Span<T> optimizations that are not fully supported in older .NET framework versions.

How do I refactor existing C# code to use pattern matching and clean API design?

Refactoring C# code to use pattern matching and clean API design involves replacing complex control flow with expressive pattern matching syntax and applying immutability patterns. This process upgrades existing domain models and libraries to modern, maintainable standards.

What are the limitations of using readonly record structs for C# value objects?

Readonly record structs offer zero-allocation semantics and strong typing for C# value objects, but require careful API design to avoid boxing. They enforce immutability strictly, meaning any necessary state changes require creating new instances rather than mutating existing ones.