neo-csharplisted
Install: claude install-skill Benknightdark/neo-skills
# Modern C# (10+) Expert Skill
## Trigger On
- The user asks to write, debug, refactor, or review C# code.
- The project directory contains `*.cs`, `*.csproj`, or single-file C# scripts.
- The target framework is .NET 6.0 (LTS) and above.
- Code modernization is needed (e.g., converting legacy nested namespaces to File-scoped namespaces).
## Workflow
1. **Perceive (Version Awareness):**
- Check `.csproj` to identify `TargetFramework` and determine the syntax upper limit:
- `net6.0`: C# 10 (File-scoped namespaces, Global usings).
- `net7.0`: C# 11 (Raw string literals, Required members).
- `net8.0`: C# 12 (Primary Constructors, Collection Expressions).
- `net9.0`: C# 13 (`params` collections, `Lock` object).
- `net10.0`: C# 14 (Extension members, `field` keyword).
2. **Reason (Planning Phase):**
- Evaluate the modernization level of the current code to determine the refactoring strategy.
- In lower version environments (like .NET 6), avoid using higher version syntax (like Primary Constructors), but prioritize using File-scoped namespaces.
- In higher version environments, actively adopt new features to reduce boilerplate code.
3. **Act (Execution Phase):**
- Write high-quality code, prioritizing "syntactic sugar" to improve readability.
- Implement strong typing and immutable data structures (`record`, `record struct`).
- Utilize **Interpolated string handlers** and **Span<T>** to optimize performance-sensitive paths.
4. **Valid