dotnet-solid-principles

Apply SOLID and DRY principles to refactor C# class design.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-solid-principles-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-solid-principles
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-solid-principles
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-solid-principles-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more robust, scalable, and maintainable C# code by adhering to fundamental design principles like SOLID and DRY, reducing bugs and simplifying future modifications.

Core Features & Use Cases

  • SOLID Principles: Understand and apply Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion principles with practical C# examples.
  • DRY Principle: Learn when and how to apply Don't Repeat Yourself, distinguishing between code and knowledge duplication.
  • Use Case: Refactor a large, complex class that handles multiple unrelated tasks into smaller, focused classes, making the codebase easier to understand and test.

Quick Start

Explain the Single Responsibility Principle with a C# example.

Frequently Asked Questions about dotnet-solid-principles

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

FAQPage Schema
How do I apply the Single Responsibility Principle in C# to refactor a god class?

To apply the Single Responsibility Principle in C#, refactor large god classes into smaller, focused classes that each handle one specific task. This refactoring simplifies dependency management and makes the codebase easier to understand, test, and maintain.

What is the best way to replace switch statements on types in C#?

The best way to replace switch statements on types in C# is by using the strategy pattern and abstraction-based solutions. This design pattern approach eliminates type-checking anti-patterns, improving code maintainability and adhering to the Open/Closed Principle.

How do I use the DRY principle to distinguish between code and knowledge duplication?

Using the DRY principle involves identifying and eliminating knowledge duplication rather than just identical code. By extracting shared logic into single, authoritative components, you reduce redundant business rules and simplify future code modifications.

How to refactor fat controllers in C# for better dependency management?

Refactoring fat controllers in C# involves extracting business logic into separate service classes and using dependency inversion for dependency management. This class design approach reduces controller bloat and significantly improves overall code maintainability.

When do I need interface segregation in C# class design?

You need interface segregation in C# when classes are forced to implement methods they do not use. By splitting large interfaces into smaller, focused ones, you prevent fat interfaces and ensure that clients only depend on the specific methods they actually call.

Does applying SOLID principles work with existing C# codebases that have anti-patterns?

Applying SOLID principles works effectively with existing C# codebases by using targeted refactoring techniques. You can incrementally address anti-patterns like god classes and fat controllers, gradually improving design and scalability without a full rewrite.