fundamentals/oop-design-principles

Refactor TypeScript class hierarchies into interface-driven composition and delegation.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill fundamentals-oop-design-principles
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fundamentals/oop-design-principles
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/fundamentals/oop-design-principles
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill fundamentals-oop-design-principles

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures object-oriented systems avoid brittle hierarchies, tightly coupled dependencies, and hard-coded variability by codifying the three core principles described in the instructions.

Core Features & Use Cases

  • Encapsulate What Varies: Identify volatile logic such as tax calculations, payment gateways, or export formats and move it into dedicated helpers or classes.
  • Program to an Interface, Not an Implementation: Replace direct class dependencies with interface contracts so each role relies on abstractions and can accept new collaborators.
  • Favor Composition Over Inheritance: Prefer delegating behavior to interchangeable components instead of proliferating subclasses with combinatorial features.
  • Use Case: While refactoring a multi-tenant platform, apply these steps to isolate provider differences, define interface layers, and swap inheritance hierarchies with composition strategies.

Quick Start

Review a subsystem, separate the changing logic into dedicated collaborators, and swap direct inheritance with interface-driven composition.

Frequently Asked Questions about fundamentals/oop-design-principles

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor brittle class hierarchies in TypeScript services?

Encapsulate what varies by extracting volatile logic like tax calculations or payment gateways into dedicated helper classes, keeping stable system components decoupled from frequent changes.

What is the best way to reduce tight coupling across object-oriented classes?

Reduce tight coupling by programming to an interface rather than a direct implementation, ensuring system roles rely on abstraction contracts that accept new interchangeable collaborators.

Why does inheritance cause combinatorial feature explosion in object-oriented design?

Apply these object-oriented design principles when building extensible architectures or evaluating coupling across classes, particularly in multi-tenant platforms requiring extensible provider integrations.

Can I use interface-driven composition for multi-tenant platform refactoring?

Yes, interface-driven composition isolates provider differences in multi-tenant platforms by defining abstraction layers and swapping direct inheritance dependencies with flexible delegation strategies.

When should I not use inheritance spirals for extensible architecture?

Avoid inheritance spirals when subsystems require frequent variability updates; replace them with composition strategies and interface contracts to prevent combinatorial subclass proliferation.