Clean oop design
Enforces clean Object-Oriented Programming (OOP) principles when writing or refactoring TypeScript code, ensuring high readability, testability, and maintainability. Trigger when writing new classes or modifying existing methods.From its SKILL.md
npx -y skills add pawel-up/lupa --skill clean-oop-designAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.9 KB, 370 tokens by cl100k_base, as published. Nobody here has run it
Clean OOP Design Principles
When writing or refactoring Object-Oriented code in this workspace, you MUST adhere to the following principles to maintain readability and clarity:
1. Single Responsibility Principle (SRP)
- Classes and methods should have one primary reason to change.
- A method should do exactly one thing. If a method exceeds ~20-30 lines, consider breaking it down.
- Avoid large monolithic methods (like "God functions" or massive
exec()loops).
2. Extract Methods for Clarity
- If a block of code within a method can be conceptually grouped (e.g., executing a specific list mode vs test mode, or collecting configuration), extract it into a dedicated
protectedorprivatehelper method. - Name the extracted method descriptively so that it acts as its own documentation.
3. Encapsulation & Access Modifiers
- Use
private(or#in modern JS/TS) for internal state and helpers that should not be exposed. - Use
protectedfor methods that subclasses might need to override or access. - Only expose
publicmethods that form the core API contract of the class.
4. Push Logic to Data Owners
- Instead of an external manager reaching into an object's internal state to serialize or filter it, push that logic into the object itself (e.g., adding a
toJSON()method to the data-holding class instead of mapping it externally).
5. Favor Getters for Derived State
- Instead of evaluating complex boolean checks inline (e.g.,
typeof window !== 'undefined' && !!window.__lupa__?.config?.list), extract them into explicit getters (e.g.,get isList(): boolean) to improve legibility.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.