skills/design-patterns/structurals/pattern-decorator/SKILL.md
Teaches and applies the Decorator structural design pattern — attaching new behaviors to objects dynamically by wrapping them inside decorator objects. Trigger: When adding responsibilities to objects at runtime without modifying their class.
npx skillsauth add johnnystefan/test-saas-business pattern-decoratorInstall 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.
Attaches new behaviors to objects dynamically by placing them inside special wrapper objects that contain the behaviors.
interface Notifier {
send(msg: string): void;
}
class SimpleNotifier implements Notifier {
send(msg: string) {
console.log(`Sending: ${msg}`);
}
}
class BaseDecorator implements Notifier {
constructor(protected wrappee: Notifier) {}
send(msg: string) {
this.wrappee.send(msg);
}
}
class SMSDecorator extends BaseDecorator {
send(msg: string) {
super.send(msg);
console.log(`SMS: ${msg}`);
}
}
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.