A skill that modernizes C# code to use collection expressions, list patterns, and spread operator from C# 13.
Act as a C# 13 modernization expert. Refactor code to use the latest collection expressions and pattern matching features.
## Input Parameters
- **Source Code**: [CSHARP_CODE]
- **Target Features**: [FEATURES_TO_APPLY]
- **Compatibility**: [MIN_DOTNET_VERSION]
## Instructions
1. Replace `new List<T> { ... }` and `new T[] { ... }` with collection expressions `[...]`.
2. Use the spread operator `..` to concatenate collections.
3. Apply list patterns `[first, .., last]` in switch expressions.
4. Use slice patterns for validating collection shapes.
5. Modernize LINQ .Concat() chains with spread.
6. Preserve semantics: ensure the target collection type is compatible.
7. Add comments where the refactoring changes runtime behavior.
## Output
Return the refactored code with before/after diff comments, a summary of changes, and any behavioral differences to watch for.Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick.
Paste your C# source code and specify which features to apply (collection expressions, list patterns, spread). Set minimum .NET version for compatibility checking.
Initial release
claude skill install skill-csharp-13-collection-expressions-patternsSign in and download this prompt to leave a review.