skills/design-patterns/structurals/pattern-bridge/SKILL.md
Teaches and applies the Bridge structural design pattern — splitting a large class into two separate hierarchies (abstraction and implementation) that evolve independently. Trigger: When separating platform-independent abstractions from platform-specific implementations.
npx skillsauth add johnnystefan/test-saas-business pattern-bridgeInstall 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.
Splits a large class or a set of closely related classes into two separate hierarchies—abstraction and implementation—which can be developed independently.
// Implementation Interface
interface Device {
isEnabled(): boolean;
enable(): void;
disable(): void;
}
// Concrete Implementation
class TV implements Device {
private on = false;
isEnabled() {
return this.on;
}
enable() {
this.on = true;
}
disable() {
this.on = false;
}
}
// Abstraction
class RemoteControl {
constructor(protected device: Device) {}
togglePower() {
this.device.isEnabled() ? this.device.disable() : this.device.enable();
}
}
// Refined Abstraction
class AdvancedRemote extends RemoteControl {
mute() {
console.log('Device muted');
}
}
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.