kmp-di

Wire Kotlin Multiplatform dependencies with Koin DSL and parametersOf.

1|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/niltsiar/kotlin_multiplatform_pokedex --skill kmp-di-niltsiar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp-di
Source: https://github.com/niltsiar/kotlin_multiplatform_pokedex/tree/main/.agents/kmp-di
Command: npx skills add https://github.com/niltsiar/kotlin_multiplatform_pokedex --skill kmp-di-niltsiar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Kotlin Multiplatform projects often struggle to keep production code DI-agnostic while orchestrating dependency wiring across shared and platform-specific layers. This skill provides a clear approach to using Koin's DSL to define feature wiring modules, resolve dependencies, and enable parametric injection with parametersOf, all while promoting testability and clean architecture.

Core Features & Use Cases

  • Pure Kotlin DI wiring with Koin module DSL (factory, single, viewModel)
  • Parametric injection with parametersOf for dynamic runtime data
  • ViewModel wiring and navigation integration via koinInject in Compose
  • Keeps production classes DI-agnostic and easy to test

Quick Start

Build Koin wiring modules in common and platform-specific layers, then resolve ViewModels in Compose using koinInject.

Frequently Asked Questions about kmp-di

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

FAQPage Schema
How do I wire ViewModels in Kotlin Multiplatform using Koin?

Keep production classes DI-agnostic by isolating all Koin DSL definitions like factory, single, and viewModel inside dedicated wiring modules within shared and platform-specific layers.

How do I pass dynamic runtime parameters to dependencies with Koin?

Use parametersOf during dependency resolution to inject dynamic runtime data into your Koin definitions, keeping production classes clean and DI-agnostic.

Does Koin dependency injection work well with Compose Multiplatform?

Koin dependency injection integrates with Compose Multiplatform by resolving ViewModels and dependencies directly within the UI layer using the koinInject function.

What is the best way to structure Koin modules for a KMP project?

Structure Koin modules for a KMP project by separating feature wiring modules and core DI configuration across common and platform-specific layers to maintain clean architecture.

Can I keep my production classes DI-agnostic while using Koin for wiring?

You can keep production classes DI-agnostic while using Koin by isolating all dependency injection DSL definitions strictly within dedicated wiring modules rather than the production classes themselves.