di-graph-strategist

Plan and refactor dependency-injection graphs for Android and KMP projects using Hilt or Koin.

Updated Jan 2, 2024
One-click install
npx skills add https://github.com/Mithrandir21/game-deals-app --skill di-graph-strategist-mithrandir21
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: di-graph-strategist
Source: https://github.com/Mithrandir21/game-deals-app/tree/main/.claude/skills/di-graph-strategist
Command: npx skills add https://github.com/Mithrandir21/game-deals-app --skill di-graph-strategist-mithrandir21

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dependency injection becomes a tax when modules are too granular, scopes are wrong, or the framework fights the codebase. This Skill helps you design, organize, and repair DI graphs so they provide clear boundaries, testable fakes, and correct lifecycles instead of god-modules and leaks. ## Core Features & Use Cases - Framework Selection: Choose between Hilt, Koin, or manual wiring based on project shape (pure Android, KMP-heavy, small app). - Module & Scope Design: Lay out one DI module per Gradle module, pick correct @InstallIn components or Koin scopes, and apply qualifiers, assisted injection, and lazy injection patterns. - Graph Diagnosis & KMP Strategy: Detect god modules, wrong scopes, circular dependencies, and Android-only Hilt usage in commonMain, then split into bounded contexts with a KMP-compatible wiring strategy. - Use Case: Your AppModule.kt has grown to 30+ @Provides methods and a ViewModel-scoped object is leaking Activity state. Use this Skill to split the graph by domain, fix the scoping, and add a checkModules() test to validate bindings. ## Quick Start Ask the assistant to review my Hilt module organization and propose a scoped, multi-module DI structure for my Android app.

Frequently Asked Questions about di-graph-strategist

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

FAQPage Schema
How do I choose between Hilt and Koin for an Android project?▼

Choose Hilt for pure Android projects with mixed Java/Kotlin and large teams, since it offers codegen and compile-time safety. Choose Koin for KMP-heavy projects needing one DI framework across platforms, or for small apps favoring simplicity.

How do I set up dependency injection in Kotlin Multiplatform shared code?▼

Hilt is Android-only, so for KMP either use manual wiring with a SharedGraph class in commonMain and Hilt on the Android side, or use Koin everywhere with startKoin called from both Android and iOS. Pick one approach and avoid mixing inside the shared module.

What is the difference between @Singleton and @ActivityScoped in Hilt?▼

@Singleton lives for the entire app lifetime and suits repositories, network clients, and databases. ActivityRetainedComponent-scoped objects survive configuration changes and are shared between an Activity and its ViewModels. Default to Singleton and use narrower scopes only with a clear reason.

Why does my Hilt graph have circular dependency errors?▼

Circular dependencies usually signal poor layer boundaries rather than a DI misconfiguration. Fix them by extracting a third type that both classes depend on, breaking the cycle at the architecture level instead of working around it with lazy injection.

When should I not inject a dependency?▼

Do not inject pure functions, stateless helpers, data class models, or small per-call values; import or construct them directly. If a class has more than about six constructor parameters, it is likely doing too much and should be split.