Use ManagedCode.Communication when a .NET application needs explicit result objects, structured errors, and predictable service or API boundaries instead of exception-driven…
Modern C# for .NET
Write modern, version-aware C# for .NET repositories. Use when choosing language features across C# versions, especially C# 13 and C# 14, while staying compatible with the repo's target framework and `LangVersion`.
Trigger On
- the repo wants more modern idiomatic C# code
- a change depends on language-version compatibility
- the team is upgrading or reviewing C# feature usage across versions
- you need to know whether a C# 13 or C# 14 feature is safe to use
Workflow
- Detect the real language ceiling from the repo's target framework and explicit
LangVersion. - Prefer stable features that the current repo actually supports.
- Use modern syntax when it reduces ceremony, improves correctness, or makes invariants clearer.
- Do not mass-rewrite a codebase into newer syntax unless the repo wants that churn.
- Treat preview features as opt-in only. Never assume preview because the current machine has a newer SDK.
- Pay special attention to C# 13 and C# 14:
- C# 13 is the stable language for .NET 9 - C# 14 is the stable language for .NET 10
- When feature selection changes architecture, style rules, or generated-code patterns, coordinate with:
- dotnet - analyzer-config - architecture
- After feature-driven refactors, run the repo's .NET quality pass through
dotnet.
Deliver
- modern C# code that fits the repo's real language version
- fewer obsolete patterns when a newer stable feature is clearer
- no accidental preview or unsupported-language drift
Validate
- the chosen syntax is supported by the repo's
TFMandLangVersion - the feature improves clarity, correctness, or maintainability
- preview-only features are used only when the repo explicitly opted in
- style and analyzer rules still agree with the new syntax
Load References
references/patterns.mdreferences/migration.mdreferences/csharp-modern-features.md
Related skills
Use ManagedCode.MimeTypes when a .NET application needs consistent MIME type detection, extension mapping, and content-type decisions for uploads, downloads, or HTTP responses.
Use the Microsoft.Extensions stack correctly across Generic Host, dependency injection, configuration, logging, options, HttpClientFactory, and other shared infrastructure…
Related agents
.NET Modernization
Modernization orchestration agent for upgrades, legacy migrations, compatibility planning, and staged adoption of modern .NET patterns.
Also works: dotnet agents install modernization