patterns/adapter
Adapter (Wrapper) Pattern pattern for C development
$ 安裝
git clone https://github.com/mgreenly/ikigai /tmp/ikigai && cp -r /tmp/ikigai/.claude/library/patterns/adapter ~/.claude/skills/ikigai// tip: Run this command in your terminal to install the skill
SKILL.md
name: patterns/adapter description: Adapter (Wrapper) Pattern pattern for C development
Adapter (Wrapper) Pattern
Convert interface of one module to interface expected by another. Enables integration of incompatible interfaces without modifying either.
ikigai Application
wrapper.h: Adapts system calls to mockable interface:
posix_read_()wrapsread()curl_easy_perform_()wraps libcurlyyjson_read_file_()wraps yyjson
Purpose: Real implementations in production, mock implementations in tests via weak symbol linking.
LLM providers: Adapt different API formats (OpenAI, Anthropic) to unified internal message format.
Benefit: External dependencies isolated behind stable internal interface. Swap implementations without changing callers.
Testing: Inject failures, control responses, verify calls.
Repository

mgreenly
Author
mgreenly/ikigai/.claude/library/patterns/adapter
1
Stars
0
Forks
Updated4d ago
Added1w ago