From harness-claude
Guides implementation of the Adapter pattern to integrate incompatible interfaces, such as legacy APIs or third-party libraries, by wrapping them with a translation layer.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:js-adapter-patternThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Convert the interface of a class into another interface that clients expect
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
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeWraps incompatible interfaces (Object Adapter via composition, async/promise adaptation, two-way adaptation) to make them work together without modifying source code. Useful when integrating third-party libraries or legacy components.
Converts incompatible class interfaces so they work together, wrapping legacy or third-party code without modifying it. Useful when integrating code with mismatched APIs.
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.