From harness-claude
Implements Abstract Factory pattern in JavaScript to create families of related objects without specifying concrete classes. Useful for runtime-swappable sets like UI themes with buttons and inputs.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Create families of related objects without specifying their concrete classes
Implements GOF Abstract Factory pattern in TypeScript for creating families of related objects via factory interfaces without concrete coupling. Use for swappable UI themes or product suites like DB+cache pairs.
Generates reusable UI patterns like card sections, grids, lists, forms, and chart wrappers from StyleSeed Toss primitives for consistent layouts across pages.
Audits PHP Abstract Factory pattern implementations for family consistency, product hierarchy completeness, factory method coverage, and cross-family compatibility issues.
Share bugs, ideas, or general feedback.
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