Loading...
Loading...
Audits code for SOLID principle violations — Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion. Identifies classes and methods that violate these principles and generates fix prompts. Trigger phrases: "SOLID check", "solid review", "SRP violation", "dependency inversion".
npx skill4agent add nishilbhave/codeprobe-claude codeprobe-solid../codeprobe/shared-preamble.md../codeprobe/references/full| ID Prefix | Signal | How to Detect | Severity |
|---|---|---|---|
| Class has 5+ public methods doing unrelated things | Count public methods. If 5+ exist, check whether they cluster around a single responsibility or span multiple concerns (e.g., authentication + email + database). Look for method name prefixes that suggest different domains. | Major |
| Method exceeds 30 LOC doing multiple concerns | Count lines in each method (excluding blank lines and comments). If > 30 LOC, check whether the method handles multiple distinct steps (validation, transformation, persistence, notification) that could be extracted. | Minor |
| Class name is vague | Flag classes named | Minor |
| Constructor takes 5+ dependencies | Count constructor parameters or injected dependencies. 5+ dependencies suggest the class has too many responsibilities. Check whether dependencies serve different domains. | Major |
| ID Prefix | Signal | How to Detect | Severity |
|---|---|---|---|
| Switch/if-else chains on type or status | Look for | Major |
| No extension point where variants are likely to grow | When a switch/if-else on type is found, check whether there is an interface, abstract class, strategy pattern, or plugin mechanism that would allow adding new variants without modifying the existing code. If absent, flag it. | Minor |
| ID Prefix | Signal | How to Detect | Severity |
|---|---|---|---|
| Subclass overrides method but changes semantics | Check overridden methods: does the subclass return a fundamentally different type, change the meaning of the return value, or produce side effects the parent does not? Compare method signatures and doc comments. | Major |
| Subclass throws exception parent doesn't declare | Look for overridden methods that throw exceptions not present in the parent's throws clause or documented contract. In dynamic languages, look for | Major |
| Subclass ignores or no-ops parent behavior | Look for overridden methods with empty bodies, | Minor |
| | Search for | Major |
| ID Prefix | Signal | How to Detect | Severity |
|---|---|---|---|
| Interface has 8+ methods | Count methods declared in each interface/abstract class/protocol. If 8+, the interface is likely too broad. Check whether the methods cluster into distinct groups. | Minor |
| Class implements interface but leaves methods empty or throwing | Look for interface implementations where one or more methods are empty, return null, throw | Major |
| Multiple unrelated method groups in one interface | Analyze the interface's methods: do they fall into 2+ distinct responsibility groups (e.g., read operations + write operations + notification methods)? If so, the interface should be split. | Major |
| ID Prefix | Signal | How to Detect | Severity |
|---|---|---|---|
| | Search for direct instantiation ( | Major |
| High-level module imports from infrastructure layer directly | Check import statements: does a domain/business logic module import directly from database drivers, HTTP clients, file system libraries, or third-party SDKs without an abstraction layer? Look for patterns like | Major |
| No constructor injection — static method calls to concrete dependencies | Look for static method calls like | Minor |
SRP-OCP-LSP-ISP-DIP-SRP-001SRP-002OCP-001src/OrderService.phpPaymentServicePaymentServiceOrderServicecalculateTotal()applyDiscount()processPayment()$typeNotificationSenderNotificationChannelsend(Message $message)EmailChannelSmsChannelPushChannelNotificationChannelFactoryUserRepository.phpnew MySqlConnection()DatabaseConnectionInterface $connection