solid-principles
Skill1 starsChanged 2 months agoMITView on GitHub
Use when designing classes or APIs to evaluate SOLID compliance — SRP, OCP, LSP, ISP, DIP. Covers what each principle means, how to diagnose violations by symptom, and how to refactor.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- decebals/claude-code-javatheir own version, first seen Nov 1, 2026
- TheBeardedBearSAS/claude-crafttheir own version, first seen Oct 29, 2026
- Khuirul-Huda/clean-principlestheir own version, first seen Oct 25, 2026
- nek1987/auto-agent-harnesstheir own version, first seen Oct 11, 2026
- robconery/koleatheir own version, first seen Aug 19, 2026
- KhaledSaeed18/dotclaudetheir own version, first seen Jul 4, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- decebals/claude-code-java★ 763same name
- TheBeardedBearSAS/claude-craft★ 108same name
- JeremyMorgan/code-review-skills★ 15same name
- robconery/kolea★ 7same name
- KhaledSaeed18/dotclaude★ 5same name
- nek1987/auto-agent-harness★ 4same name
- kayaman/skills★ 3same name
- kimtth/agent-skill-100-lines-or-less★ 2same name
- lucsedirae/agent_skill_library★ 2same name
- iCesofT/awesome-ai★ 1same name
1 more not listed
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 repository77 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/accessibility.mdcCursor rule
- .cursor/rules/agentharness-router.mdcCursor rule
- .cursor/rules/agentic-loops.mdcCursor rule
- .cursor/rules/api-design.mdcCursor rule
- .cursor/rules/audit-review-followup.mdcCursor rule
- .cursor/rules/big-work-plan-review.mdcCursor rule
- .cursor/rules/branching.mdcCursor rule
- .cursor/rules/clean-architecture.mdcCursor rule
- .cursor/rules/code-review-api.mdcCursor rule
- .cursor/rules/code-review-db.mdcCursor rule
- .cursor/rules/code-review.mdcCursor rule
- .cursor/rules/code-review-ui.mdcCursor rule
- .cursor/rules/committing.mdcCursor rule
- .cursor/rules/database-conventions.mdcCursor rule
- .cursor/rules/dependency-audit.mdcCursor rule
- .cursor/rules/dependency-injection.mdcCursor rule
- .cursor/rules/design-patterns.mdcCursor rule
- .cursor/rules/docker-conventions.mdcCursor rule
- .cursor/rules/error-handling.mdcCursor rule
- .cursor/rules/file-placement-policy.mdcCursor rule
- .cursor/rules/github-issue-triage.mdcCursor rule
- .cursor/rules/go-conventions.mdcCursor rule
- .cursor/rules/harness-feedback.mdcCursor rule
- .cursor/rules/logging.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/mutation-testing.mdcCursor rule
- .cursor/rules/performance-profiling.mdcCursor rule
- .cursor/rules/planning-with-files.mdcCursor rule
- .cursor/rules/port-agent-config.mdcCursor rule
- .cursor/rules/project-bootstrap.mdcCursor rule
- .cursor/rules/python-conventions.mdcCursor rule
- .cursor/rules/react-best-practices.mdcCursor rule
- .cursor/rules/refactoring.mdcCursor rule
- .cursor/rules/requirements-clarification.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/solid-principles.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/typescript-conventions.mdcCursor rule
- accessibilitySkill
- agentic-loopsSkill
- api-designSkill
- audit-review-followupSkill
- big-work-plan-reviewSkill
- branchingSkill
- clean-architectureSkill
- code-review-apiSkill
- code-review-dbSkill
- code-reviewSkill
- code-review-uiSkill
- committingSkill
- database-conventionsSkill
- dependency-auditSkill
- dependency-injectionSkill
- design-patternsSkill
- docker-conventionsSkill
- error-handlingSkill
- file-placement-policySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
Add behavior by adding code, not by editing existing code.
- Very specific: line 69
If B extends A, code using A must work with B without knowing the difference.
- Distinctive: line 92
Prefer many small interfaces over one large one.
“Common” is measured: kept by at least 6 in 10 of the 9 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 principles for writing code that's easy to change.
S — Single Responsibility Principle
A class should have one reason to change.
One class doing two unrelated things = two reasons to change it.
# Violation: UserService handles auth AND notifications
class UserService:
def login(self, email, password): ...
def send_welcome_email(self, user): ... # belongs elsewhere
# Better
class AuthService:
def login(self, email, password): ...
class UserNotifier:
def send_welcome(self, user): ...Signal: method names have unrelated verbs; the class imports from many unrelated modules.
O — Open/Closed Principle
Open for extension, closed for modification.
Add behavior by adding code, not by editing existing code.
// Violation: every new payment method requires editing
function processPayment(type: string, amount: number) {
if (type === 'card') { ... }
if (type === 'crypto') { ... } // keep adding ifs
}
// Better: polymorphism or strategy
interface PaymentProcessor {
process(amount: number): Promise<void>;
}
class CardProcessor implements PaymentProcessor { ... }
class CryptoProcessor implements PaymentProcessor { ... }Signal: feature additions require editing a switch/if-else chain in a stable class.
L — Liskov Substitution Principle
Subtypes must be substitutable for their supertypes.
If B extends A, code using A must work with B without knowing the difference.
# Violation: Square breaks Rectangle invariants
class Rectangle:
def set_width(self, w): self.width = w
def set_height(self, h): self.height = h
def area(self): return self.width * self.height
class Square(Rectangle):
def set_width(self, w):
self.width = w
self.height = w # breaks Rectangle callers who set W and H independentlySignal: overriding a method throws an exception, does nothing, or changes invariants the parent declares.
I — Interface Segregation Principle
Clients should not depend on methods they don't use.
Prefer many small interfaces over one large one.
// Violation: Printer forced to implement fax
interface Machine {
print(doc: Document): void;
scan(doc: Document): void;
fax(doc: Document): void; // not all machines fax
}
// Better
interface Printer { print(doc: Document): void; }
interface Scanner { scan(doc: Document): void; }Signal: a class implements an interface but leaves methods empty or throws NotImplementedError.
D — Dependency Inversion Principle
Depend on abstractions, not concretions. High-level modules must not depend on low-level modules; both should depend on abstractions.
# Violation: high-level OrderService knows about MySQL
from mysql_connector import MySQLDatabase
class OrderService:
def __init__(self):
self.db = MySQLDatabase() # low-level detail
# Better
class OrderRepository(Protocol):
def save(self, order: Order) -> None: ...
class OrderService:
def __init__(self, repo: OrderRepository) -> None:
self.repo = repoSee .claude/skills/dependency-injection/SKILL.md for the full DI pattern.
Quick Diagnosis
| Symptom | Likely principle violated |
| One class file is hundreds of lines | SRP |
| Every new feature requires editing many existing files | OCP |
Subclass throws NotImplementedError on some parent methods | LSP |
| Class implements an interface but leaves half the methods empty | ISP |
| Business logic imports database/framework classes directly | DIP |
See Also
patterns/solid-principles/README.md— pattern directory entry.claude/skills/dependency-injection/SKILL.md— DIP in practice.claude/skills/design-patterns/SKILL.md— patterns that implement SOLID
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.

