skills/fundamentals/solid-principles/SKILL.md
Evaluate and apply SOLID principles: SRP, OCP, LSP, ISP, DIP. Trigger: When reviewing architecture for maintainability, designing new modules, or refactoring toward cleaner dependencies.
npx skillsauth add johnnystefan/test-saas-business fundamentals/solid-principlesInstall 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 equips the agent with the SOLID principles framework to evaluate software architecture and guide refactoring processes toward more maintainable, flexible, and scalable code.
switch or if-else block.// BAD: Class manages data AND printing
class Employee {
constructor(public name: string) {}
getEmployeeData() {
/* ... */
}
printTimeSheetReport() {
/* UI concern — wrong place */
}
}
// GOOD: Responsibilities separated
class Employee {
constructor(public name: string) {}
}
class TimeSheetReport {
print(employee: Employee) {
/* ... */
}
}
// BAD: Adding a shipping method requires modifying this class
class Order {
getShippingCost(method: string) {
if (method === 'ground') return 10;
if (method === 'air') return 20;
return 0;
}
}
// GOOD: Strategy pattern — extend without modifying
interface Shipping {
getCost(): number;
}
class GroundShipping implements Shipping {
getCost() {
return 10;
}
}
class AirShipping implements Shipping {
getCost() {
return 20;
}
}
class Order {
getShippingCost(shipping: Shipping) {
return shipping.getCost();
}
}
// BAD: ReadOnlyDocument breaks when save is called
class Document {
save() {
console.log('Saved');
}
}
class ReadOnlyDocument extends Document {
save() {
throw new Error('Cannot save a read-only document');
}
}
// GOOD: Hierarchy reflects actual capabilities
class Document {
/* common props */
}
class WritableDocument extends Document {
save() {
console.log('Saved');
}
}
// BAD: Simple storage forced to implement unrelated server logic
interface CloudProvider {
storeFile(): void;
getServers(): void;
}
// GOOD: Smaller, specific interfaces
interface FileStorage {
storeFile(): void;
}
interface ServerManager {
getServers(): void;
}
class Dropbox implements FileStorage {
storeFile() {
/* ... */
}
}
// BAD: High-level class depends on a concrete MySQL database
class BudgetReport {
private database = new MySQLDatabase();
open() {
this.database.connect();
}
}
// GOOD: High-level class depends on an interface
interface IDatabase {
connect(): void;
}
class MySQLDatabase implements IDatabase {
connect() {
/* ... */
}
}
class BudgetReport {
constructor(private database: IDatabase) {}
open() {
this.database.connect();
}
}
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.