← ClaudeAtlas

modern-csharplisted

Modern C# language features for .NET 10 and C# 14. Covers primary constructors, collection expressions, the field keyword, extension members, records, pattern matching, spans, and raw string literals. Load this skill when writing any new C# code, reviewing existing code for modernization, using "modern C#", "C# 14", "primary constructor", "collection expression", "records", "pattern matching", "span", "field keyword", or "extension members".
lamuniercosta/dotnet-agent-harness · ★ 0 · AI & Automation · score 72
Install: claude install-skill lamuniercosta/dotnet-agent-harness
# Modern C# Adapted from [codewithmukesh/dotnet-claude-kit](https://github.com/codewithmukesh/dotnet-claude-kit) (MIT). **Check the language version first.** Every repo targets the SDK and `LangVersion` pinned in its `Directory.Build.props` / `global.json`. Treat any feature needing a newer compiler (the `field` keyword, `extension` blocks) as aspirational until that version supports it — read the file, don't assume the latest. **Repo conventions win over every example below.** The `coding-conventions` rule mandates `sealed` by default, file-scoped namespaces, interface-in-same-file, naming by functionality rather than vendor, and **no explanatory comments**. Where a repo's own `CLAUDE.md`/`AGENTS.md` or `.editorconfig` disagrees with this skill, the repo is right. ## Core Principles 1. **Use the newest stable features** — C# 14 is the target. Prefer language-level constructs over library workarounds. 2. **Readability over cleverness** — Pattern matching and expression-bodied members improve readability when used appropriately; deeply nested patterns do not. 3. **Value types where possible** — Prefer `record struct`, `Span<T>`, and stack allocation to reduce GC pressure. 4. **Immutability by default** — Use `record`, `readonly`, `init`, and `required` to make illegal states unrepresentable. ## Patterns ### Well-Known Features Quick Reference | Feature | Usage | Example | |---------|-------|---------| | Primary constructors | DI injection, eliminate field assignments |