modern-csharp-coding-standards

Guide modern C# code using records, pattern matching, and async/await.

1|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/bbsbot/mac-md-win --skill modern-csharp-coding-standards-bbsbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-csharp-coding-standards
Source: https://github.com/bbsbot/mac-md-win/tree/main/.claude/skills/dotnet/skills/csharp-coding-standards
Command: npx skills add https://github.com/bbsbot/mac-md-win --skill modern-csharp-coding-standards-bbsbot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write modern, efficient, and maintainable C# code by leveraging advanced language features and best practices.

Core Features & Use Cases

  • Immutability: Emphasizes using record types and init-only properties for safer data handling.
  • Modern Patterns: Promotes the use of pattern matching, Span<T>, Memory<T>, and async/await for cleaner and more performant code.
  • API Design: Guides on creating robust and user-friendly APIs with clear contracts.
  • Use Case: Refactor existing C# code to use record struct for value objects, improving performance and type safety, or implement a new API endpoint using async/await and Span<T> for high throughput.

Quick Start

Apply modern C# coding standards to the provided C# code snippet.

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 C# records and pattern matching to write modern, maintainable code?

Use C# records and pattern matching to enforce immutability and express complex conditional logic cleanly. This approach leverages functional-style programming with C# 12+ features, improving type safety and overall code maintainability without sacrificing readability.

What's the best way to improve C# performance with Span<T> and Memory<T>?

The best way to improve C# performance using Span<T> and Memory<T> is to apply them for efficient memory management and high-throughput data processing. These constructs minimize allocations and enable safe, performant operations on contiguous memory regions.

How do I refactor existing C# code to use record struct for value objects?

Refactor existing C# code to use record struct for value objects by replacing mutable classes with immutable value types. This improves performance and type safety by ensuring value-based equality and reducing unnecessary heap allocations.

Does modern C# coding standards support high-performance API design with async/await?

Yes, modern C# coding standards support high-performance API design by combining async/await with clear API contracts. Implementing API endpoints using async/await alongside Span<T> ensures high throughput and responsive, scalable applications.

When should I use init-only properties instead of standard setters in C#?

Use init-only properties in C# instead of standard setters when you need safer data handling through immutability. This enforces that properties can only be set during object initialization, preventing accidental state mutations after creation.