One-click install
npx skills add https://github.com/mgreenly/ikigai --skill di
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: di
Source: https://github.com/mgreenly/ikigai/tree/main/.claude/library/di
Command: npx skills add https://github.com/mgreenly/ikigai --skill di

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dependency Injection eliminates hidden dependencies by forcing modules to receive their collaborators (config, DB connections, services) from the outside, improving predictability and testability.

Core Features & Use Cases

  • Explicit constructor injection to wire components with their dependencies.
  • Supports composition and testing by swapping mock implementations.
  • Use case: initialize a REPL or service by passing cfg, db, and llm into the core modules rather than having them instantiate internally.

Quick Start

Initialize your modules by passing the necessary dependencies (cfg, db, llm) from the composition root.

Frequently Asked Questions about di

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

FAQPage Schema
How does dependency injection improve testability in C projects?

Dependency injection improves testability in C projects by forcing modules to receive collaborators from the outside, eliminating hidden global state so mock implementations can be swapped during testing.

How do I wire dependencies at startup for a modular C service?

Wire dependencies at startup by passing required collaborators like config, database connections, and services from the composition root directly into your core modules during initialization.

Can I use explicit dependency passing to eliminate global state in a microkernel architecture?

Explicit dependency passing eliminates global state in microkernel architectures by enforcing lifecycle ownership through the caller's memory management, ensuring components are explicitly wired rather than relying on hidden internal instantiation.

What is the best way to initialize a REPL with external dependencies in C?

Initialize a C REPL with external dependencies by passing configuration, database, and LLM dependencies directly into the core modules from the composition root rather than having them instantiate internally.

When should I avoid dependency injection in modular software architecture?

Avoid dependency injection when your project lacks a clear composition root or when the overhead of explicitly passing collaborators outweighs the benefits of testability and modularity for small, simple scripts.