koin-module-wiring

Standardize Koin module aggregation and typed dependency bindings for AniTrend.

51|6|Updated Mar 10, 2019
One-click install
npx skills add https://github.com/AniTrend/anitrend-v2 --skill koin-module-wiring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: koin-module-wiring
Source: https://github.com/AniTrend/anitrend-v2/tree/main/.agents/skills/koin-module-wiring
Command: npx skills add https://github.com/AniTrend/anitrend-v2 --skill koin-module-wiring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the recurring problem of incorrectly wiring dependency injection across AniTrend v2 modules, which can cause ambiguous generic resolutions, misplaced bindings, and broken app startup composition.

Core Features & Use Cases

  • Standardized module aggregation: Guides how feature/data modules expose bindings via local Modules.kt and how the app-level aggregator loads them at startup through InjectorInitializer.
  • Cross-layer wiring guidance: Helps you place Android platform helpers in the owning :android:* modules and reference the layer example matrix for platform anchors.
  • Generic-safe binding patterns: Recommends explicit typed lookup for generic contracts (e.g., typed mapper/controller bindings) to avoid Koin inference ambiguity.
  • Module addition checklist + testing: Provides a wiring checklist including which aggregator/loader to update and how to add or update Koin resolution tests for the changed bindings.

Quick Start

Add your new module’s module { } provider in the appropriate .../koin/Modules.kt, bind all public dependencies via Koin using the exported alias types, register it in the nearest feature/data aggregator (and in the app core loader if it’s a new top-level data/feature module), then add a focused Koin resolution test that resolves the exact contract you changed.

Frequently Asked Questions about koin-module-wiring

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

FAQPage Schema
How do I fix ambiguous Koin generic resolutions when wiring ViewModels?

To fix ambiguous Koin generic resolutions, use explicit typed `get<ConcreteType>()` lookups when binding generic contracts like mappers or controllers. This prevents Koin from failing to infer the correct type during dependency injection.

What's the best way to structure Koin module aggregation across Android layers?

Structure Koin module aggregation by exposing bindings via local `Modules.kt` files and loading them at startup through `InjectorInitializer`. Place Android platform helpers in their owning `:android:*` modules for clean separation.

How do I add a new repository binding to Koin without breaking app startup?

Add new repository bindings by defining them in the appropriate `.../koin/Modules.kt`, using Koin `factory` defaults for data modules. Register the module in the nearest aggregator and the app core loader if it's top-level.

Do I need to write Koin resolution tests when adding new feature interactors?

Yes, you need to add focused Koin resolution tests that resolve the exact contract you changed. This verifies your new feature interactors are correctly wired and prevents broken app startup composition.

Why does Koin fail to resolve dependencies across different navigation layers?

Koin fails to resolve dependencies across navigation layers when module aggregation patterns are not followed or bindings are misplaced. Standardize how feature and data modules expose bindings to prevent broken app startup composition.

When should I use Koin factory defaults instead of singletons in data modules?

Use Koin `factory` defaults in data modules when adding repository bindings and data task flows. This ensures a new instance is provided on each resolution request, avoiding stale state across dependency injection.