modern-csharp

Write version-aware modern C# code compatible with the repo's target framework and LangVersion.

Updated May 22, 2026
One-click install
npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill modern-csharp-viniciuscs84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-csharp
Source: https://github.com/viniciuscs84/sdd-toolkit/tree/main/skills/modern-csharp
Command: npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill modern-csharp-viniciuscs84

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Choosing which C# language features are safe to use is error-prone: teams accidentally adopt preview syntax, set machine-dependent LangVersion values, or miss modernization opportunities when upgrading .NET targets. This Skill detects the repo's real language ceiling and guides feature selection across C# 8 through C# 14. ## Core Features & Use Cases - Language Ceiling Detection: Inspects TargetFramework, LangVersion, and installed SDKs to determine which C# features the repo actually supports. - Version-Aware Modernization: Applies idiomatic patterns such as primary constructors, collection expressions, records, raw string literals, and C# 13/14 features only when the target framework supports them. - Migration Guidance: Provides phased before/after migration paths from older C# versions to C# 12, 13, and 14 with validation steps. - Use Case: When upgrading a service to .NET 9, ask which C# 13 features are safe to adopt and get concrete refactors like System.Threading.Lock and params collections without breaking the build. ## Quick Start Ask the AI to review this repository for C# 13 or C# 14 modernization opportunities that are compatible with its target framework.

Frequently Asked Questions about modern-csharp

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

FAQPage Schema
How do I know which C# features my .NET project supports?

Check the TargetFramework and LangVersion in your .csproj or Directory.Build files, since the default C# version follows the target framework. For example, .NET 9 maps to C# 13 and .NET 10 maps to C# 14.

How to migrate older C# code to modern syntax?

Migrate incrementally: start with non-breaking syntax updates like expression bodies, then modernize types with records and primary constructors, then update collections and patterns. Verify each phase with dotnet build, dotnet test, and analyzer checks.

What new features does C# 14 add on .NET 10?

C# 14 adds extension members, null-conditional assignment, the field keyword for field-backed properties, nameof with unbound generic types, more implicit Span conversions, and partial events and constructors. It is the stable language version for .NET 10.

Should I set LangVersion to latest in my csproj?

No, setting LangVersion to latest makes builds machine-dependent because results vary with the installed SDK. Use an explicit version matching your target framework, and only use preview when the repo intentionally opts in.

When should I not use primary constructors in C#?

Avoid primary constructors when you need multiple overloads with complex logic, significant parameter validation, explicit field visibility, or constructor chaining in base classes. Traditional constructors remain clearer in those cases.