csharp-coding

Enforce modern C# patterns and idioms across .NET projects.

1|Updated Jun 1, 2025
One-click install
npx skills add https://github.com/rcdailey/dotfiles --skill csharp-coding-rcdailey
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-coding
Source: https://github.com/rcdailey/dotfiles/tree/main/home/dot_config/opencode/exact_skills/csharp-coding
Command: npx skills add https://github.com/rcdailey/dotfiles --skill csharp-coding-rcdailey

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The C# Coding Skill enforces modern C# patterns and idioms across codebases to prevent drift and ensure consistent quality when writing, editing, reviewing, or refactoring .NET projects.

Core Features & Use Cases

  • Enforces mandatory language features and idioms such as file-scoped namespaces, records for DTOs, init-only properties, and robust pattern matching to improve readability and safety.
  • Guides project configuration and version compatibility by inspecting the project files to determine the minimum C# version and providing safe fallbacks when a feature is unavailable.
  • Useful for updating existing codebases, adding new components for ASP.NET, Blazor, MAUI, WPF, or WinForms, and validating code for modern idiom compliance.

Quick Start

Apply the C# Coding Skill to start refactoring and coding tasks using the required patterns and idioms.

Frequently Asked Questions about csharp-coding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce modern C# idioms like file-scoped namespaces and records when refactoring a .NET project?

Enforce modern C# idioms by applying consistent guidelines across writing, editing, and refactoring tasks to prevent codebase drift. This ensures features like file-scoped namespaces, records for DTOs, and init-only properties are used correctly for readability and safety.

What are the best practices for modernizing C# code quality across ASP.NET, Blazor, and MAUI applications?

Modernize C# code quality by enforcing robust pattern matching and mandatory language features across .NET project types. Applying consistent idioms during development and code reviews prevents architectural drift and ensures reliable, maintainable code across different frameworks.

Does this C# coding guidance work with older TargetFramework versions or Directory.Build.props configurations?

Yes, it checks your TargetFramework and Directory.Build.props to determine the minimum C# language version available. It then provides safe fallbacks and specific guidance for feature usage when modern idioms are not supported in your current environment.

Can I apply modern C# patterns to interop scenarios and mixed file types like .razor and .cshtml?

Yes, you can apply modern C# patterns to interop scenarios across various file types including .cs, .csproj, .razor, and .cshtml. It enforces consistent idioms and guidelines regardless of the specific dotnet technology or UI framework being used.

Why should I use records for DTOs and init-only properties instead of traditional class structures in C#?

Records for DTOs and init-only properties improve code readability and safety by enforcing immutability and reducing boilerplate. Applying these modern C# patterns during development ensures consistent quality and prevents accidental state mutation across your applications.