Skill: Craft Registry
"A registry knows who handles what. Nothing more."
The Standard
- Interface Contract: All handlers implement same interface.
- Registration: Handlers register by key (provider name, type, etc.).
- Resolution: Registry returns correct handler for key.
- Fail Loud: Throw on unknown key. No silent nulls.
The Anti-Patterns
| ❌ Don't | ✅ Do | Why |
|---|---|---|
| Switch statements | Registry lookup | Open for extension |
| Return null | Throw on missing | Fail fast, debug easy |
| Hard-coded handlers | Register via config/tagged | Configurable, testable |
| God class | Handlers do the work | Registry only dispatches |
Real-World Examples
See examples/.