The Adapter pattern allows incompatible interfaces to work together by wrapping an interface around an existing class.
Description
The Adapter pattern acts as a bridge between two incompatible interfaces, enabling classes with different interfaces to collaborate. It converts the interface of a class into another interface that clients expect.
1---2name: adapter-pattern3description: Adapter Pattern4---5# Adapter Pattern67**Category:** Software Architecture 8**Skill Level:** Intermediate 9**Domain:** programming, architecture1011## Overview1213The Adapter pattern allows incompatible interfaces to work together by wrapping an interface around an existing class.1415## Description1617The Adapter pattern acts as a bridge between two incompatible interfaces, enabling classes with different interfaces to collaborate. It converts the interface of a class into another interface that clients expect.1819## Prerequisites2021- Object-oriented programming fundamentals22- Interface design principles23- Understanding of SOLID principles2425## Core Competencies2627- Identifying when to use adapter pattern28- Implementing class and object adapters29- Working with existing library interfaces30- Maintaining single responsibility principle3132## Implementation3334```python35class Target:36 def request(self) -> str:37 return "Target: The default target's behavior."3839class Adaptee:40 def specific_request(self) -> str:41 return ".eetpadmae eht fo roivaheb laicepS"4243class Adapter(Target):44 def __init__(self, adaptee: Adaptee):45 self.adaptee = adaptee4647 def request(self) -> str:48 return f"Adapter: (TRANSLATED) {self.adaptee.specific_request()[::-1]}"49```5051## Use Cases5253- Integrating third-party libraries54- Legacy system integration55- Data format conversions56- API wrapper development5758## Artifacts5960- Adapter implementations for common interfaces61- Interface compatibility layers62- Legacy system wrappers6364## Related Skills6566- Bridge Pattern67- Decorator Pattern68- Facade Pattern
Run npx skillmds@latest add ffsshhttiikk/adapter-pattern in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Adapter Pattern It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
ffsshhttiikk (@ffsshhttiikk) published this skill. Their other Agent Skills are listed on their SkillMD profile.