modern-csharp-coding-standards

Guides creation of modern C# code using records, pattern matching, and zero-allocation techniques.

57|7|Updated Aug 6, 2025
One-click install
npx skills add https://github.com/seiggy/lucia-dotnet --skill modern-csharp-coding-standards-seiggy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-csharp-coding-standards
Source: https://github.com/seiggy/lucia-dotnet/tree/main/.github/skills/csharp-coding-standards
Command: npx skills add https://github.com/seiggy/lucia-dotnet --skill modern-csharp-coding-standards-seiggy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides developers in writing modern, efficient, and maintainable C# code by leveraging advanced language features and best practices, reducing bugs and improving performance.

Core Features & Use Cases

  • Immutability: Enforces immutable data structures using records and init-only properties.
  • Type Safety: Promotes robust code through nullable reference types and value objects.
  • Modern Patterns: Encourages the use of pattern matching, async/await, and zero-allocation techniques.
  • Use Case: Refactor a legacy C# codebase to adopt modern patterns, making it more readable, testable, and performant, especially for I/O-bound operations and data manipulation.

Quick Start

Use the modern-csharp-coding-standards skill to refactor the provided C# code snippet to use records for immutable data.

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 legacy C# code to use modern patterns?

Refactoring legacy C# code involves adopting modern patterns like records for immutable data, init-only properties, and pattern matching to improve readability, testability, and performance for I/O-bound operations and data manipulation.

What is the best way to enforce immutability in C# 12?

The best way to enforce immutability in C# 12 is by using records and init-only properties. This approach ensures robust, immutable data structures, reducing side effects and potential bugs in your codebase.

How do I achieve zero-allocation performance in C#?

Achieving zero-allocation performance in C# requires using Span<T> and Memory<T> alongside advanced async/await patterns. These techniques minimize memory overhead and optimize data manipulation operations.

Does modern C# coding standards support nullable reference types?

Modern C# coding standards fully support nullable reference types to promote robust type safety. Combining them with value objects helps enforce strict data contracts and significantly reduces runtime null reference exceptions.

When should I use pattern matching in C#?

Use pattern matching in C# to write highly readable, functional-style code for complex data structures. It simplifies conditional logic and type checks, making your codebase more maintainable and easier to test.

How do I design high-performance APIs in C#?

Designing high-performance APIs in C# involves applying modern API design patterns, leveraging async/await for I/O-bound operations, and utilizing zero-allocation techniques like Span<T> to optimize data processing throughput.