← ClaudeAtlas

solid-review-checklistlisted

Apply SOLID principles concretely to C# code review - real smells, thresholds, and refactors rather than abstract definitions. Use when reviewing class design, service structure, or interface changes in C#.
Sarmkadan/dotnet-senior-skills · ★ 0 · Code & Development · score 72
Install: claude install-skill Sarmkadan/dotnet-senior-skills
# SOLID Review Checklist (C#, applied) SOLID violations are found in diffs, not definitions. Review with these concrete triggers. ## Single Responsibility Trigger questions: how many reasons does this class change for, and who asks for each change? Concrete smells: - Constructor takes 6+ dependencies. That is 6 collaborators' worth of reasons to change; split the use cases. - Method groups with disjoint dependency usage: if `ImportUsers` uses `_csv` and `_repo`, while `SendDigest` uses `_email` and `_clock`, you have two classes cohabiting. - Names containing `Manager`, `Helper`, `Util`, `Processor` plus a 500-line body. The name is vague because the responsibility is. Do not over-apply: a class with three methods around one aggregate is fine. SRP violations are proven by change history (this file appears in every PR), not by line count alone. ## Open/Closed The practical form: adding a new case should not require editing a switch that already shipped. Trigger: the same `switch (type)` appears in 2+ places. ```csharp // SMELL: every new export format edits this switch and its twin in ValidateFormat public byte[] Export(string format) => format switch { "csv" => ExportCsv(), "xlsx" => ExportXlsx(), _ => throw new NotSupportedException() }; // REFACTOR: strategy resolved from DI public interface IExporter { string Format { get; } byte[] Export(ReportData d); } // registration: services.AddSingleton<IExporter, CsvExporter>(); ... resolve IEnumerable<IExporter> ``` On