Android Dependency Injection (Hilt)
Enforce Hilt best practices for dependency injection, including annotations, modules, and component usage.
Install
mkdir -p .claude/skills/android-dependency-injection-hilt && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10528" && unzip -o skill.zip -d .claude/skills/android-dependency-injection-hilt && rm skill.zipInstalls to .claude/skills/android-dependency-injection-hilt
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Standards for Hilt Setup, Scoping, and ModulesKey capabilities
- →Annotate `Application` class with `@HiltAndroidApp`
- →Annotate Activities/Fragments with `@AndroidEntryPoint`
- →Use `@Binds` for module binding when possible
- →Explicitly define `InstallIn` for modules
- →Prefer constructor injection over field injection
- →Use `@AssistedInject` for runtime parameters
How it works
The skill applies Hilt standards by annotating application components, configuring modules with `@Binds` and `InstallIn`, and preferring constructor injection for dependencies.
Inputs & outputs
When to use Android Dependency Injection (Hilt)
- →Setting up Hilt
- →Refactoring DI modules
- →Validating dependency injection code
About this skill
Android Dependency Injection (Hilt)
Priority: P0
Implementation Guidelines
Setup
- App: Must annotate
Applicationclass with@HiltAndroidApp. - Entries: Annotate Activities/Fragments with
@AndroidEntryPoint.
Modules
- Binding: Use
@Binds(abstract class) over@Provideswhen possible (smaller generated code). - InstallIn: Be explicit (
SingletonComponent,ViewModelComponent).
Construction
- Constructor Injection: Prefer over Field Injection (
@Inject constructor(...)). - Assisted Injection: Use for runtime parameters (
@AssistedInject).
Anti-Patterns
- Component Manual Creation:
**No Manual Dagger**: Use Hilt Standard. - Field Inject in Logic:
**No Field Inject**: Only in Android Components.
References
When not to use it
- →When manually creating Dagger components
- →When performing field injection in logic classes
- →When the project does not use Hilt for dependency injection
Limitations
- →Discourages manual Dagger component creation
- →Restricts field injection to Android components only
- →Focuses specifically on Hilt implementation guidelines
How it compares
This skill enforces specific Hilt best practices and anti-patterns, guiding developers to write more efficient and maintainable DI code compared to ad-hoc Dagger implementations.
Compared to similar skills
Android Dependency Injection (Hilt) side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| Android Dependency Injection (Hilt) (this skill) | 0 | 5mo | No flags | Beginner |
| flowmvi | 1 | 6mo | No flags | Advanced |
| kotlin-multiplatform | 32 | 3mo | Review | Advanced |
| backend-microservice-development | 2 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by li-lance
View all by li-lance →You might also like
flowmvi
respawn-app
FlowMVI usage guidance. Use when working with FlowMVI stores/containers, plugin pipelines, composing stores, decorators, or authoring plugins.
kotlin-multiplatform
vitorpamplona
Platform abstraction decision-making for Amethyst KMP project. Guides when to abstract vs keep platform-specific, source set placement (commonMain, jvmAndroid, platform-specific), expect/actual patterns. Covers primary targets (Android, JVM/Desktop, iOS) with web/wasm future considerations. Integrates with gradle-expert for dependency issues. Triggers on: abstraction decisions ("should I share this?"), source set placement questions, expect/actual creation, build.gradle.kts work, incorrect placement detection, KMP dependency suggestions.
backend-microservice-development
TencentBlueKing
后端微服务开发规范,涵盖目录结构、分层架构(API/Service/DAO)、依赖注入、配置管理、Spring Boot 最佳实践。当用户进行后端开发、创建新微服务、编写 Kotlin/Java 代码或设计服务架构时使用。
kotlin-coroutines
vitorpamplona
Advanced Kotlin coroutines patterns for AmethystMultiplatform. Use when working with: (1) Structured concurrency (supervisorScope, coroutineScope), (2) Advanced Flow operators (flatMapLatest, combine, merge, shareIn, stateIn), (3) Channels and callbackFlow, (4) Dispatcher management and context switching, (5) Exception handling (CoroutineExceptionHandler, SupervisorJob), (6) Testing async code (runTest, Turbine), (7) Nostr relay connection pools and subscriptions, (8) Backpressure handling in event streams. Delegates to kotlin-expert for basic StateFlow/SharedFlow patterns. Complements nostr-expert for relay communication.
extensions-api-migration
JetBrains
Migrates IdeaVim extensions from the old VimExtensionFacade API to the new @VimPlugin annotation-based API. Use when converting existing extensions to use the new API patterns.
trail-sense-database-persistence
kylecorry31
Add new Room database persistence to Trail-Sense Android app. Use when the user asks to create, add, or implement database persistence for a model, including Entity, DAO, Repository, and AppDatabase migration. Covers entity-to-model mapping, index configuration, and standard CRUD operations.