From harness-claude
Implements the Abstract Factory creational pattern in JavaScript to create families of related objects (e.g., UI themes) without specifying concrete classes. Useful when product families must be swapped at runtime.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:js-abstract-factory-patternThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Create families of related objects without specifying their concrete classes
Create families of related objects without specifying their concrete classes
// Abstract Factory (interface defined by convention)
class LightThemeFactory {
createButton() {
return { color: 'white', text: 'dark' };
}
createInput() {
return { background: '#f0f0f0', border: '1px solid #ccc' };
}
}
class DarkThemeFactory {
createButton() {
return { color: '#333', text: 'white' };
}
createInput() {
return { background: '#222', border: '1px solid #555' };
}
}
function renderUI(factory) {
const button = factory.createButton();
const input = factory.createInput();
return { button, input };
}
const ui = renderUI(new DarkThemeFactory());
The Abstract Factory is a creational pattern that sits one level of abstraction above the Factory pattern. Where a Factory creates one type of product, an Abstract Factory creates an entire suite of related products.
Trade-offs:
When NOT to use:
new is sufficienthttps://patterns.dev/javascript/abstract-factory-pattern
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeImplements the GOF Abstract Factory pattern to create families of related objects (e.g., UI themes, cloud SDKs) without coupling to concrete types.
Centralizes object creation for families of related objects, enabling easy swapping of product families without client code changes. Based on the GoF pattern.
Covers 26 Gang of Four design patterns with PHP 8.3+ implementations, UML diagrams, and practical use cases.