skills/code-smells/oo-abusers/SKILL.md
Detect and refactor OO Abusers — incorrect or incomplete application of OOP principles. Trigger: When identifying Switch Statements, Temporary Fields, Refused Bequest, or Alternative Classes with Different Interfaces.
npx skillsauth add johnnystefan/test-saas-business code-smells/oo-abusersInstall 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 identify "OO Abusers" — code structures that result from an incomplete or incorrect application of object-oriented programming principles. The agent will replace these structures with proper polymorphic behavior and cleaner class hierarchies.
switch operators or sequences of if statements that perform different actions based on an object's type or state.null otherwise.type code or class name.getTotal() vs calculateSum()).// BAD: Switch statement based on type
class Bird {
getSpeed(type: string) {
switch (type) {
case 'EUROPEAN':
return 10;
case 'AFRICAN':
return 15;
default:
return 0;
}
}
}
// GOOD: Replace with Polymorphism
interface Bird {
getSpeed(): number;
}
class European implements Bird {
getSpeed() {
return 10;
}
}
class African implements Bird {
getSpeed() {
return 15;
}
}
// BAD: A Chair is not an Animal, even if they both have legs
class Animal {
eat() {
console.log('Eating...');
}
}
class Chair extends Animal {
eat() {
throw new Error("Chairs don't eat!");
} // Refused Bequest
}
// GOOD: No false "is-a" relationship
class Chair {
legs: number = 4;
}
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.