hilt-dependency-injection
Installation
SKILL.md
Prerequisites
- Project MUST use Jetpack Compose as its UI toolkit.
- Project MUST be configured with Dagger Hilt for Dependency Injection.
- Project MUST use Kotlin Symbol Processing (KSP) or Kapt for incremental annotation processing.
1. Clean Architecture Boundaries
To preserve strict layer isolation in the MeteoMartoCompose project, Hilt dependencies must conform to the following architectural rules:
- The
:domainModule: This module must remain completely agnostic of Hilt, Dagger, or any Android framework classes (such asContext). No DI annotations are allowed in this module. All domain entities, use-case contracts, and repository interfaces are defined here purely. - The
:usecasesModule: Business use cases or interactors must reside in this layer. They must resolve their domain repository dependencies purely via constructor injection using the@Injectannotation on the constructor. They are not allowed to declare modules or access Android context. - The
:dataModule: This module contains repository implementations, network service adapters (such as Retrofit/OkHttpClient), and local database architectures (such as Room). Hilt modules with@Bindsor@Providesreside in this module to wire repository interfaces to their concrete implementations. - The
:appModule: Serves as the central orchestrator that glues the entire application together. It defines the@HiltAndroidAppclass, registers application-level Android entry points (@AndroidEntryPointor@HiltViewModel), and initializes system components like background processes, WorkManager, and Firebase Cloud Messaging (FCM).