yonatankarp/software-design-skills

gof-facade

Use when simplifying access to a complex subsystem — phrases like "Facade pattern", "home theater example", "make this subsystem easier to use", "hide the complexity behind one method", "high-level interface to many classes".

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/yonatankarp/software-design-skills --skill gof-facade

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

One-line summary

Provide a unified, simplified interface to a set of interfaces in a subsystem — making the subsystem easier to use without preventing direct access for power users.

When to use this skill

  • A subsystem has many parts and most callers only want a small, common combination of operations on them.
  • Onboarding new code into a complex codebase — Facade gives the new code one clean entry point.
  • Wrapping a legacy or third-party library whose internal complexity should not leak everywhere.
  • The canonical example: a "watch a movie" facade that turns on the TV, dims the lights, lowers the screen, switches the receiver to the right input, queues the popcorn maker, and starts the DVD — instead of having every caller orchestrate those steps.

When NOT to use this skill

  • You're trying to replace the subsystem rather than offer a simpler entry point — that's a refactor of the subsystem.
  • You're trying to change the interface of a single class — that's gof-adapter.
  • The subsystem is genuinely small and a Facade would only add a layer of indirection.
  • Callers actually need the full control the subsystem offers; a Facade that hides too much forces them to bypass it.

Core content

A Facade is a class that holds references to the subsystem classes it orchestrates and exposes a small set of high-level methods. Each method on the Facade composes multiple lower-level operations into a coherent unit of meaning at the level the caller cares about.

Key principle of Facade: it does not prevent access to the subsystem. Callers that need finer control can still reach in directly. The Facade is a convenience, not a wall.

Related principle that HFDP attaches to Facade: the Principle of Least Knowledge (the Law of Demeter). Facade methods talk to a small number of close collaborators rather than reaching deep into the subsystem from afar.

Decision heuristics

  • A Facade method should read like a unit of user intent ("watchMovie", "shutdownProperly", "settleOrder") — not like a thin pass-through to one subsystem call.
  • Keep the Facade itself stateless when possible; it should be orchestration, not state ownership.
  • If you find yourself adding many setters to the Facade, it has stopped being a Facade.

Anti-patterns

  • Facade that forbids direct subsystem access — a Facade is convenience, not a fortress.
  • Facade with one method per subsystem method, named identically — that's a pass-through, not a Facade.
  • Facade that grows to know every subsystem detail — at some point it stops being "high-level" and becomes a god class.
  • Multiple Facades over the same subsystem, each adding a slightly different convenience — usually a sign that the underlying subsystem needs refactoring instead.

See also

  • gof-adapter — when wrapping one class to a different interface; Facade wraps many classes into a simpler interface.
  • gof-mediator (not covered here, GoF original) — Facade is one-directional (caller → subsystem); Mediator is bidirectional coordination between peers.
  • gof-kotlin-idioms — top-level functions and extension functions in Kotlin often serve as lightweight facades without needing a class.

References

  • Head First Design Patterns (2nd ed), Ch. 7 ("Being Adaptive: the Adapter and Facade Patterns") — the home theater example is the canonical illustration.

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills
yonatankarp
커뮤니티

arch-adr

Use when recording an architectural decision so future maintainers know why — phrases like "ADR", "architecture decision record", "why did we pick X", "lightweight architecture documentation", "decision log", "should this be an ADR", "tribal knowledge", "we chose this two years ago and now nobody remembers why". Defines the ADR as a short, structured document capturing what was decided, why, alternatives considered, and consequences — written at the time of the decision and kept in the repo.

설치 수
2
GitHub Stars
1
업데이트
5월 19일
yonatankarp
커뮤니티

arch-fitness-functions

Use when enforcing architectural characteristics through automation — phrases like "architecture fitness function", "evolutionary architecture", "architecture tests", "ArchUnit", "dependency rules in CI", "automated architecture checks", "guardrails", "drift detection". Defines fitness functions as automated checks that verify architectural characteristics on every change, catching drift before it accumulates.

설치 수
2
GitHub Stars
1
업데이트
5월 19일
yonatankarp
커뮤니티

arch-microservices

Use when designing or reviewing a microservices architecture — phrases like "microservices", "should we split this service", "service boundaries", "bounded context per service", "API gateway", "backend for frontend", "BFF", "service mesh", "microservices vs monolith", "database per service", "data ownership". Defines microservices as independently deployable services aligned with business capabilities — and the discipline of resisting the style until the monolith proves inadequate.

설치 수
2
GitHub Stars
1
업데이트
5월 19일
yonatankarp
커뮤니티

arch-strangler-fig

Use when migrating a legacy system incrementally — phrases like "strangler fig", "strangler pattern", "incremental migration", "monolith to microservices", "rewrite without big bang", "replace legacy in place", "facade in front of the legacy system", "anticorruption layer". Defines Fowler's Strangler Fig as the migration discipline of gradually replacing legacy functionality behind a stable facade, never doing a big-bang rewrite.

설치 수
2
GitHub Stars
1
업데이트
5월 19일