gof-decorator

Installation
SKILL.md

One-line summary

Wrap an object in another object that shares its interface and adds responsibility — at runtime, in any combination, without modifying the original.

When to use this skill

  • A class needs N orthogonal extensions (a coffee gets milk, sugar, foam, syrup … any combination). Subclassing yields N! variants; Decorator yields N small wrappers.
  • Java I/O Streams (BufferedReader(InputStreamReader(FileInputStream(...)))) is the textbook real-world example.
  • Adding cross-cutting concerns (logging, caching, validation, rate-limiting) around an existing object without touching its code.

When NOT to use this skill

  • The extensions interact non-orthogonally (sugar must be added before milk, etc.) — Decorator gives unordered composition; if order matters, you have hidden coupling.
  • Only one extension exists and no second is in sight — subclassing or a flag is simpler.
  • The wrapping changes the interface, not just behavior — that's gof-adapter.

Core content

Installs
19
GitHub Stars
1
First Seen
Jul 13, 2026
gof-decorator — yonatankarp/software-design-skills