solid-principles-ai-kit

Refactor .NET/C# object-oriented designs using SOLID principles.

Updated May 11, 2026
One-click install
npx skills add https://github.com/ducthang-hub/nw-ai-kit --skill solid-principles-ai-kit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solid-principles-ai-kit
Source: https://github.com/ducthang-hub/nw-ai-kit/tree/main/.agents/skills/solid-principles-ai-kit
Command: npx skills add https://github.com/ducthang-hub/nw-ai-kit --skill solid-principles-ai-kit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

SOLID principles help you fix tangled object-oriented designs by making responsibilities clear, reducing coupling, and improving extensibility without repeatedly breaking existing code.

Core Features & Use Cases

  • SRP (Single Responsibility): Spot god classes and methods doing multiple jobs, then split responsibilities into cohesive services and collaborators.
  • OCP (Open/Closed): Replace fragile if/else or “modify existing code” patterns with extension via abstractions (e.g., strategies, polymorphism).
  • LSP/ISP/DIP (Substitution, Segregation, Inversion): Improve inheritance correctness, avoid fat interfaces with unneeded methods, and inject dependencies through interfaces to make code easier to test and mock.
  • Use Cases: Refactoring bloated services, designing feature growth without regressions, setting up .NET dependency injection correctly, and stabilizing unit tests that are brittle and hard to mock.

Quick Start

Ask the AI: “Refactor my C# class that does too many things using SOLID (SRP, OCP, LSP, ISP, DIP). Suggest an improved design and show how I should register dependencies with .NET DI, then outline how to write more reliable unit tests for it.”

Frequently Asked Questions about solid-principles-ai-kit

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

FAQPage Schema
How do I refactor a god class in C# to follow SOLID principles?

To refactor a god class in C# using SOLID principles, you split its multiple responsibilities into cohesive services and collaborators based on the Single Responsibility Principle, then inject those dependencies through interfaces to reduce coupling and improve testability.

What is the best way to extend C# behavior without modifying existing code?

The best way to extend C# behavior without modifying existing code is applying the Open/Closed Principle, which replaces fragile if/else patterns with abstractions like strategies and polymorphism to add features safely without breaking existing logic.

How do I fix inheritance misuse and fat interfaces in .NET?

Fix .NET inheritance misuse and fat interfaces by applying LSP and ISP SOLID principles, ensuring derived classes properly substitute base classes and splitting bloated interfaces so clients only depend on the specific methods they actually use.

Can I use dependency injection to make brittle C# unit tests easier to mock?

Yes, you can use .NET dependency injection to make brittle C# unit tests easier to mock by applying the Dependency Inversion Principle, injecting dependencies through interfaces rather than concrete implementations to isolate system behavior during testing.

Does this SOLID refactoring approach work for setting up .NET dependency injection correctly?

Yes, this SOLID refactoring approach works for setting up .NET dependency injection correctly by mapping design symptoms to SOLID principles and offering actionable C# DI patterns that stabilize unit tests and reduce system brittleness.

When should I not use the Open/Closed Principle for C# refactoring?

You should avoid using the Open/Closed Principle for C# refactoring when simpler direct modifications suffice without introducing premature abstraction complexity, as applying strategies and polymorphism unnecessarily can overcomplicate straightforward feature growth.