solid
Skill22 starsChanged 9 months agoMITView on GitHub
SOLID principles for object-oriented design with multi-language examples (PHP, Java, Python, TypeScript, C++). Use when the user asks to review SOLID compliance, fix a SOLID violation, evaluate class design, reduce coupling, improve extensibility, or apply Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, or Dependency Inversion principles. Covers motivation, violation detection, refactoring fixes, and real-world trade-offs for each principle.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- vercel-labs/json-rendertheir own version, first seen Sep 23, 2026
- Gusen1453/creedtheir own version, first seen Sep 18, 2026
- vladcheck/skillstheir own version, first seen Jun 29, 2026
- joabgonzalez/ai-agents-skillstheir own version, first seen Jun 8, 2026
- DGouron/review-flowtheir own version, first seen May 14, 2026
- JordanCoin/codingskillstheir own version, first seen Feb 28, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- vercel-labs/json-render★ 18ksame name
- ramziddin/solid-skills★ 606same name
- DGouron/review-flow★ 44same name
- JordanCoin/codingskills★ 10same name
- joabgonzalez/ai-agents-skills★ 9same name
- Gusen1453/creed★ 3same name
- vladcheck/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- cicdSkill
- clean-architectureSkill
- database-designSkill
- debuggingSkill
- design-patternsSkill
- dispatching-parallel-agentsSkill
- git-workflowSkill
- microservicesSkill
- performanceSkill
- refactoringSkill
- scrumSkill
- securitySkill
- subagent-driven-developmentSkill
- testingSkill
- verification-before-completionSkill
- composer-dependenciesSkill
- finishing-branchSkill
- php-upgradeSkill
- ticket-deliverySkill
- worktree-opsSkill
- architectSkill
- backend-devSkill
- frontend-devSkill
- product-managerSkill
- project-managerSkill
- qa-engineerSkill
- scrum-masterSkill
- agent-creatorSkill
- agentic-rules-writerSkill
- agent-teamsSkill
- brainstormingSkill
- dispatching-agent-teamsSkill
- image-annotateSkill
- plugin-creatorSkill
- pr-message-writerSkill
- report-writerSkill
- stakeholder-update-writerSkill
- ticket-writerSkill
- using-ecosystemSkill
- web-screenshotSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 127
Treat SOLID as a diagnostic tool: when code resists change, check which principle is being violated
- Distinctive: line 129
Write tests first — TDD naturally steers designs toward SOLID compliance
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SOLID Principles
Five core principles of object-oriented design that lead to systems which are simpler to maintain, test, and extend. Robert C. Martin (Uncle Bob) formalized these ideas, and Michael Feathers coined the SOLID acronym.
Principle Index
| Principle | Summary | Reference |
| S — Single Responsibility | A class should have only one reason to change | reference |
| O — Open/Closed | Open for extension, closed for modification | reference |
| L — Liskov Substitution | Subtypes must be substitutable for their base types | reference |
| I — Interface Segregation | Prefer many specific interfaces over one general-purpose interface | reference |
| D — Dependency Inversion | Depend on abstractions, not concretions | reference |
Why SOLID Matters
Without SOLID, codebases gradually develop these problems:
- Rigidity — one change ripples through many unrelated modules
- Fragility — modifying one area breaks another seemingly unconnected area
- Immobility — components are so intertwined that extracting them for reuse is impractical
- Viscosity — doing things correctly is harder than hacking around the design
SOLID tackles each of these by defining clear boundaries, explicit contracts, and flexible points for extension.
Quick Decision Guide
| Symptom | Likely Violated Principle | Fix |
| Class does too many things | SRP | Split into focused classes |
| Adding a feature requires editing existing classes | OCP | Introduce polymorphism or strategy |
| Subclass breaks when used in place of parent | LSP | Fix inheritance hierarchy or use composition |
| Classes forced to implement unused methods | ISP | Break interface into smaller ones |
| High-level module imports low-level details | DIP | Introduce an abstraction layer |
Quick Examples
SRP — Before and After
// BEFORE: Class handles both user data AND email sending
class UserService {
public function createUser(string $name, string $email): void { /* ... */ }
public function sendWelcomeEmail(string $email): void { /* ... */ }
}
// AFTER: Each class has one responsibility
class UserService {
public function __construct(private UserNotifier $notifier) {}
public function createUser(string $name, string $email): void {
// persist user...
$this->notifier->welcomeNewUser($email);
}
}
class UserNotifier {
public function welcomeNewUser(string $email): void { /* ... */ }
}OCP — Extend Without Modifying
interface DiscountPolicy {
public function calculate(float $total): float;
}
class PercentageDiscount implements DiscountPolicy {
public function __construct(private float $rate) {}
public function calculate(float $total): float {
return $total * $this->rate;
}
}
// Adding a new discount type requires NO changes to existing code
class FlatDiscount implements DiscountPolicy {
public function __construct(private float $amount) {}
public function calculate(float $total): float {
return min($this->amount, $total);
}
}DIP — Depend on Abstractions
// High-level policy depends on abstraction, not on database details
interface OrderRepository {
public function save(Order $order): void;
}
class PlaceOrderHandler {
public function __construct(private OrderRepository $repository) {}
public function handle(PlaceOrderCommand $cmd): void {
$order = Order::create($cmd->items);
$this->repository->save($order);
}
}Relationships Between Principles
The five principles complement and reinforce one another:
- SRP + ISP: Both narrow the surface area of a class or interface to a single, focused concern
- OCP + DIP: Abstractions are the mechanism that enables extension without modification
- LSP + OCP: Correct substitutability is essential for polymorphic extension to work
- ISP + DIP: Well-segregated interfaces make it easier to depend on precisely the right abstraction
Common Misconceptions
- "One method per class" — SRP means one reason to change, not one method. A class can contain many methods as long as they all serve the same responsibility.
- "Never modify existing code" — OCP does not prohibit bug fixes. It means new behavior should be introducible without changing existing working code.
- "Always use interfaces" — DIP calls for depending on abstractions. Sometimes a well-crafted base class is the appropriate abstraction. Do not create interfaces for classes that will never have a second implementation.
- "Inheritance is bad" — LSP does not discourage inheritance. It establishes rules for correct inheritance so that subtypes remain safely substitutable.
Best Practices
- Adopt SOLID incrementally — do not refactor everything in one pass
- Treat SOLID as a diagnostic tool: when code resists change, check which principle is being violated
- Pair with design patterns — Strategy (OCP), Adapter (DIP), and Decorator (OCP) are direct implementations of SOLID ideas
- Write tests first — TDD naturally steers designs toward SOLID compliance
- Target PHP 8.3+ with strict typing, readonly classes, and enums
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

