What problem does it solve?
This skill codifies a repeatable, repo-wide convention for wiring Hexagonal (Ports & Adapters) architecture using InversifyJS so teams avoid inconsistent bindings, accidental adapter-to-adapter coupling, and runtime container mistakes when adding packages, ports, or adapters.
Core Features & Use Cases
- Clear package roles: explains core-, -driving-, -driven-, helper-, and types responsibilities to prevent incorrect dependencies.
- Port pattern: prescribes the dual identifier pattern (TypeScript interface + Symbol) for input and output ports so tokens are injectable and type-safe.
- Container factories & binding order: specifies createCore<Name>Container conventions, default singleton scope, adapter setupContainer static registration, and the required wiring order for app composition roots.
- Recipes & examples: step-by-step recipes for defining ports, implementing driven and driving adapters, composing app containers, and handling per-runtime bootstrap for MV2/MV3 browser extension runtimes.
- Gotchas & decision guidance: highlights common pitfalls like multi-token aliasing, Symbol vs Symbol.for, and no shared containers across extension runtimes.
Quick Start
Create a new core package with Foo input and output ports, implement a FooDrivenAdapter that exposes setupContainer, and wire them in apps/<app>/src/services/container.ts by calling createCoreFooContainer then registering FooDrivenAdapter.setupContainer(container, FooOutputPort).