Modernize C# code using newer C# and .NET features when compatible. Use for refactoring older syntax, adopting records, pattern matching, nullable annotations, required members, collection expressions, modern BCL APIs, async improvements, and version-aware upgrades.
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Modernize C# code using newer C# and .NET features when compatible. Use for refactoring older syntax, adopting records, pattern matching, nullable annotations, required members, collection expressions, modern BCL APIs, async improvements, and version-aware upgrades.
metadata
{"short-description":"Modernize C# with newer features"}
C# Modernize
Use $csharp-tutor mode=modernize.
Treat all user text after $csharp-modernize as the code, project, or feature-modernization question. Use the main csharp-tutor skill as the source of truth.
Load these csharp-tutor references when useful:
references/modernization-map.md
references/modern-dotnet-patterns.md
references/migration-guidance.md
references/nullability-guidance.md
references/sourcegen-guidance.md
references/versioning-guidance.md
references/project-inspection.md
references/official-sources.md
references/verification-checklist.md
references/source-citation-rules.md
references/testing-guidance.md
Confirm or infer target C#/.NET version before suggesting newer features. Show before/after code and compatibility tradeoffs.
Standalone Guidance
Core rule: Keep the answer centered on the concrete modernize decision, failure mode, or contract.
Avoid: Giving generic C# advice without tying it to the modernize concern.
Minimal example: public sealed record CustomerDto(int Id, string Name);