From harness-claude
Applies JavaScript Adapter pattern to convert incompatible class interfaces for third-party libraries, legacy APIs, API migrations, or data normalization.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Convert the interface of a class into another interface that clients expect
Implements GOF Adapter pattern in TypeScript to wrap incompatible interfaces like third-party loggers or legacy callback APIs without modifying originals.
Generates Adapter pattern for PHP 8.4 to convert incompatible interfaces, wrap legacy code or external libraries like Stripe/AWS SDKs. Includes target interfaces, adapters, and unit tests.
Guides modern JavaScript (ES6+) patterns for refactoring legacy code, functional programming, async operations, performance optimization, and maintainable code.
Share bugs, ideas, or general feedback.
Convert the interface of a class into another interface that clients expect
// Legacy API returns { firstName, lastName }
class LegacyUser {
constructor(data) {
this.firstName = data.firstName;
this.lastName = data.lastName;
}
}
// Modern code expects { name, email }
class UserAdapter {
constructor(legacyUser) {
this.legacyUser = legacyUser;
}
get name() {
return `${this.legacyUser.firstName} ${this.legacyUser.lastName}`;
}
get email() {
return '';
} // field not available in legacy
}
const adapt = (legacy) => ({ name: legacy.firstName + ' ' + legacy.lastName }).The Adapter pattern (also called Wrapper) lets classes with incompatible interfaces work together. In JavaScript, this often takes the form of a thin translation layer between an external API and your internal types.
Trade-offs:
When NOT to use:
https://patterns.dev/javascript/adapter-pattern