inversify-di

Standardize Inversify DI bindings with a shared TYPES symbol registry.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill inversify-di
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: inversify-di
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/inversify-di
Command: npx skills add https://github.com/recca0120/code-quest --skill inversify-di

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inversify dependency injection can become inconsistent and hard to test when service identifiers, bindings, scopes, and overrides are scattered across the codebase.

Core Features & Use Cases

  • Central TYPES Registry: Defines a consistent Symbol-based service identifier map for server dependencies.
  • Inline Container Bindings: Documents how the server binds core services directly in the container without ContainerModule, including singleton scopes.
  • Constructor Injection with Optional Dependencies: Shows a practical injectable service pattern using @injectable() and @inject(), including optional settings injection.
  • Testing-Friendly Overrides: Provides an approach for swapping bindings in a test container via container.rebindSync-style calls (and notes v8 changes).
  • Migration Guidance for Inversify v8: Calls out breaking API changes relevant to this project's current test container setup.

Quick Start

Use this guidance when updating apps/server/src/container.ts and apps/server/src/types.ts, especially if you are adding a new injectable service, changing binding scopes, or adjusting test-time dependency overrides.

Frequently Asked Questions about inversify-di

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a central TYPES symbol registry for Inversify dependency injection in TypeScript?

A central TYPES symbol registry defines consistent Symbol-based service identifiers for server dependencies. This prevents scattered bindings by providing a single map for all injectable services, ensuring type-safe and uniform resolution across the application.

What is the best way to override Inversify bindings in a test container?

The best way to override Inversify bindings in a test container is using container.rebindSync-style calls. This approach swaps production bindings with test mocks, though you should note Inversify v8 introduces breaking API changes to this test container setup.

How do I configure inline container bindings with singleton scopes in Inversify?

Configuring inline container bindings with singleton scopes involves binding core services directly in the container without using ContainerModule. This ensures services maintain a single shared instance throughout the server application's lifecycle.

Does Inversify support constructor injection with optional dependencies?

Inversify supports constructor injection with optional dependencies using @injectable() and @inject() decorators. This pattern allows practical service wiring, including optional settings injection, preventing brittle bindings when certain dependencies are not strictly required.

What are the breaking API changes when migrating to Inversify v8?

Migrating to Inversify v8 introduces breaking API changes specifically relevant to the project's test container setup. The migration guidance calls out these modifications to ensure existing test-time dependency overrides and rebindSync calls function correctly.

Why does my Inversify service container have inconsistent service identifiers?

Inconsistent service identifiers occur when Inversify dependency injection bindings, scopes, and overrides are scattered across the codebase. Standardizing patterns with a shared TYPES symbol registry prevents this brittleness and ensures uniform service resolution.