csharp-best-practices

Applies version-aware C# best practices to codebases.

1|1|Updated Jan 3, 2026
One-click install
npx skills add https://github.com/mcj-coder/development-skills --skill csharp-best-practices-mcj-coder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-best-practices
Source: https://github.com/mcj-coder/development-skills/tree/main/skills/csharp-best-practices
Command: npx skills add https://github.com/mcj-coder/development-skills --skill csharp-best-practices-mcj-coder

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill ensures your C# code adheres to modern best practices, automatically adapting to the project's specific C# language version and .NET target framework.

Core Features & Use Cases

  • Version-Aware Guidance: Detects the effective C# version (e.g., C# 10, 11, 12) and applies the newest supported features.
  • Progressive Reference Loading: Consults best practices incrementally from C# 10 upwards, prioritizing the latest version's guidance.
  • Optional Analyzer Governance: Pauses to clarify before applying contentious or optional analyzer rules, preventing unintended churn.
  • Use Case: When refactoring a legacy .NET 6 project to leverage newer C# features, this Skill will guide you on which C# 10+ patterns are safe and beneficial to apply, respecting the project's target framework.

Quick Start

Apply C# best practices to the current project, respecting its effective language version.

Frequently Asked Questions about csharp-best-practices

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

FAQPage Schema
How do I apply modern C# best practices when refactoring an older .NET project?

To apply modern C# best practices during refactoring, this Skill detects the effective language version from csproj or Directory.Build.props and incrementally loads guidance from C# 10 upwards, prioritizing the newest features safe for your target framework.

How does C# version detection work for .NET projects without explicit language versions?

C# version detection checks csproj and Directory.Build.props for explicit settings, then infers the effective version from the Target Framework Moniker, ensuring best practices align with the actual compiler capabilities of your .NET project.

Can I enforce analyzer rules globally across my C# codebase without causing unintended churn?

You can avoid unintended code churn when enforcing analyzer rules because this Skill pauses to request user clarification before applying contentious or optional rules globally, preventing widespread unintended modifications.

What is the best way to upgrade legacy C# code to use newer language features safely?

The best way to upgrade legacy C# code safely is to progressively consult best practices from C# 10 upwards, respecting the detected target framework and ensuring only beneficial, version-appropriate patterns are applied.

Does this C# refactoring guidance support projects targeting older .NET frameworks?

Yes, this C# refactoring guidance supports older .NET frameworks by inferring the effective language version from the Target Framework Moniker and adapting recommendations to use only the features supported by that specific framework version.