skills/fundamentals/oop-pillars/SKILL.md
Design software using the four OOP pillars: Abstraction, Encapsulation, Inheritance, and Polymorphism. Trigger: When evaluating class design, replacing switch statements with polymorphism, or designing class hierarchies.
npx skillsauth add johnnystefan/test-saas-business fundamentals/oop-pillarsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables the agent to evaluate and design software using the four pillars of OOP: abstraction, encapsulation, inheritance, and polymorphism. These pillars are the foundation for achieving flexibility, reuse, and long-term maintainability.
private or protected.Cat and Dog) and extract them into a common base class (e.g., Animal).switch or if-else blocks that check for object types.// BAD: Switch checking types manually
function makeSound(animal: { type: string }) {
switch (animal.type) {
case 'cat':
return 'meow';
case 'dog':
return 'woof';
}
}
// GOOD: Polymorphism — each class knows how to make its sound
interface Animal {
makeSound(): string;
}
class Cat implements Animal {
makeSound() {
return 'meow';
}
}
class Dog implements Animal {
makeSound() {
return 'woof';
}
}
const animals: Animal[] = [new Cat(), new Dog()];
animals.forEach((a) => console.log(a.makeSound()));
// BAD: Direct field access — external code can corrupt state
class BankAccount {
public balance: number = 0;
}
// GOOD: State protected behind a controlled interface
class BankAccount {
private balance: number = 0;
deposit(amount: number): void {
if (amount <= 0) throw new Error('Amount must be positive');
this.balance += amount;
}
getBalance(): number {
return this.balance;
}
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.