modern-csharp-coding-standards

Document modern C# coding standards for .NET 8+ projects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Modern C# projects often suffer from inconsistent patterns, brittle APIs, and performance pitfalls. This skill provides a standardized, opinionated guide to enforce safe, high-performance coding practices using records, pattern matching, value objects, async/await, Span<T>/Memory<T>, and modern API design.

Core Features & Use Cases

  • Immutability by default with records and init-only properties.
  • Value objects as readonly record structs with explicit conversions.
  • Advanced pattern matching and nullability best practices.
  • Async-all-the-way design with cancellation support and zero-allocation patterns.
  • Guidance for high-performance API design and memory-safe code in .NET 8+/C# 12+.

Quick Start

Review the guide and start applying the immutability, pattern matching, and Span<T>/Memory<T> patterns to a current project's codebase.

Frequently Asked Questions about modern-csharp-coding-standards

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

FAQPage Schema
What are modern C# coding standards for immutability and value objects?

Modern C# coding standards enforce immutability by default using records and init-only properties. Value objects are implemented as readonly record structs with explicit conversions, ensuring safer and more predictable API design across .NET projects.

How do I apply pattern matching and nullability best practices in C# 12?

Apply pattern matching and nullability best practices in C# 12 by using advanced pattern matching expressions and strict nullable reference types. This approach prevents runtime null references and creates safer, more readable conditional logic.

Does this C# coding standards guide work with .NET 8 and older frameworks?

This guide specifically targets projects using C# 12+ and .NET 8+. It applies to new and refactoring work, emphasizing features like Span<T> and Memory<T> that require modern framework support for memory-safe APIs and performance optimization.

What's the best way to design async patterns in .NET for high performance?

The best way to design high-performance async patterns in .NET is an async-all-the-way design with cancellation support and zero-allocation patterns. This ensures responsive applications without unnecessary memory overhead.

How do I use Span<T> and Memory<T> for memory-safe APIs in C#?

Use Span<T> and Memory<T> for memory-safe APIs in C# to achieve high-performance code with zero allocations. These modern structures enable direct memory access without copying, satisfying strict performance optimization requirements.

When should I refactor existing C# code to use records and init-only properties?

Refactor existing C# code to use records and init-only properties when you need to enforce immutability by default and prevent brittle APIs. This standardization solves issues with inconsistent patterns and performance pitfalls in modern .NET projects.