modern-csharp-coding-standards

Enforce modern C# coding standards for immutability, type safety, and performance.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers write modern, high-performance C# code by enforcing best practices for immutability, type safety, pattern matching, async operations, and zero-allocation techniques.

Core Features & Use Cases

  • Modern C# Patterns: Leverages C# 12+ features like records, pattern matching, and expression-bodied members.
  • Performance Optimization: Guides users on using Span<T>, Memory<T>, and async/await effectively.
  • API Design: Provides principles for creating robust and maintainable APIs.
  • Use Case: Refactor an existing C# class to use record types for immutability and improve its performance by adopting Span<T> for string manipulation.

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 refactor C# code to use modern coding standards and pattern matching?

To refactor C# code with modern coding standards, apply C# 12+ features like expression-bodied members and pattern matching to improve type safety and code expressiveness. This transition enhances maintainability while enforcing functional-style programming principles.

What is the best way to optimize C# performance using Span<T> and Memory<T>?

The best way to optimize C# performance using Span<T> and Memory<T> is to apply zero-allocation techniques for critical code paths and string manipulation. This method minimizes garbage collection overhead and significantly boosts execution speed.

When do I need to use record types for immutability in C#?

You need to use record types for immutability in C# when designing public APIs or refactoring existing data models. Records enforce immutable data structures natively, ensuring robust state management and preventing accidental data modification.

How do I design robust public APIs in C# 12+?

To design robust public APIs in C# 12+, enforce strict type safety, leverage immutability through record types, and apply modern coding standards. This approach creates maintainable interfaces and prevents unintended state mutations in distributed systems.

Can I use async patterns effectively to improve C# application performance?

Yes, you can use async patterns effectively to improve C# performance by properly implementing async/await operations. Following modern C# coding standards ensures asynchronous execution runs efficiently without causing thread starvation or deadlocks.