modern-csharp

Modernize C# source code with C# 14 features for .NET 10 projects.

640|145|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/codewithmukesh/dotnet-claude-kit --skill modern-csharp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-csharp
Source: https://github.com/codewithmukesh/dotnet-claude-kit/tree/main/skills/modern-csharp
Command: npx skills add https://github.com/codewithmukesh/dotnet-claude-kit --skill modern-csharp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers update and maintain C# codebases by replacing outdated patterns with C# 14 language features to improve readability, correctness, and performance across .NET 10 projects.

Core Features & Use Cases

  • Language Modernization: Guidance for primary constructors, collection expressions, the field keyword, extension members, records, pattern matching, Span<T>, and raw string literals to modernize APIs and internals.
  • Code Review & Refactoring: Practical recommendations for replacing manual backing fields, tuples-for-domain-types, and legacy collection initialization during reviews or automated refactors.
  • Performance & Safety: Promote readonly record structs, stack-friendly value types, and zero-allocation slicing with Span to reduce GC pressure and enforce immutability and initialization safety.

Quick Start

Ask the modern-csharp skill to modernize the provided C# file by applying C# 14 idioms such as primary constructors, collection expressions, records, field usage, and spans.

Frequently Asked Questions about modern-csharp

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

FAQPage Schema
How do I modernize C# code to use primary constructors and collection expressions in .NET 10?

To modernize C# code for .NET 10, replace manual backing fields and legacy collection initialization with primary constructors, collection expressions, and records. This refactoring improves readability, correctness, and performance across DTOs, services, and view models.

What is the best way to reduce GC pressure in C# using Span<T> and readonly record structs?

Using Span<T> and readonly record structs reduces GC pressure by promoting stack-friendly value types and zero-allocation slicing. This enforces immutability and initialization safety for performance-sensitive value types in modern C#.

Can I use C# 14 features like the field keyword and extension members during code review?

Yes, you can apply C# 14 features like the field keyword and extension members during code review. This provides practical recommendations for replacing outdated patterns, manual backing fields, and tuples-for-domain-types to modernize APIs.

When should I use raw string literals and required members in C#?

Use raw string literals and required members in C# when you need to enforce initialization safety and improve code readability. These C# 14 idioms ensure required properties are initialized during object creation without boilerplate validation.

Does refactoring to C# 14 idioms work for existing .NET 10 projects?

Yes, refactoring to C# 14 idioms works for existing .NET 10 projects during authoring and refactoring tasks. You can update outdated patterns in DTOs, services, and view models to adopt modern language features seamlessly.