From harness-claude
Teaches the Bridge design pattern to decouple abstraction from implementation, useful when avoiding class combinatorial explosion or supporting swappable backends.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:js-bridge-patternThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Decouple abstraction from implementation so both can vary independently
Decouple abstraction from implementation so both can vary independently
// Implementation interface
class Renderer {
renderCircle(radius) {
throw new Error('Not implemented');
}
}
class SVGRenderer extends Renderer {
renderCircle(radius) {
return `<circle r="${radius}"/>`;
}
}
class CanvasRenderer extends Renderer {
renderCircle(radius) {
return `ctx.arc(0,0,${radius},0,2*PI)`;
}
}
// Abstraction
class Shape {
constructor(renderer) {
this.renderer = renderer;
}
}
class Circle extends Shape {
constructor(radius, renderer) {
super(renderer);
this.radius = radius;
}
draw() {
return this.renderer.renderCircle(this.radius);
}
}
The Bridge pattern separates an abstraction from its implementation so that the two can evolve independently. Without Bridge, combining M abstractions with N implementations requires M*N classes. With Bridge, it requires M + N.
Trade-offs:
When NOT to use:
https://patterns.dev/javascript/bridge-pattern
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeImplements the Bridge pattern to separate abstraction from implementation, enabling independent variation along two dimensions (e.g., shape+renderer, notification+channel).
Decouple an abstraction from its implementation so both can vary independently, avoiding exponential class hierarchies that result from combining them through inheritance. Best for structural design patterns in OOP.
Generates Bridge pattern for PHP 8.4 projects, creating abstraction, refined abstraction, implementor interface, concrete implementors, and unit tests in Domain/Infrastructure structure. For decoupling with multiple variation dimensions or runtime switching.