スキル一覧に戻る
pluginagentmarketplace

kotlin-di

by pluginagentmarketplace

Kotlin Development Plugin

2🍴 1📅 2026年1月20日
GitHubで見るManusで実行

SKILL.md


name: kotlin-di description: Dependency Injection - Hilt, Koin, scopes, testing version: "1.0.0" sasmp_version: "1.3.0" bonded_agent: 02-kotlin-android bond_type: SECONDARY_BOND

execution: timeout_ms: 30000 retry: max_attempts: 3 backoff: exponential initial_delay_ms: 1000

parameters: required: - name: framework type: string validation: "^(hilt|koin)$" optional: - name: platform type: string default: "android"

logging: level: info events: [skill_invoked, framework_loaded, error_occurred]

Kotlin DI Skill

Dependency Injection with Hilt and Koin.

Topics Covered

Hilt for Android

@HiltAndroidApp
class App : Application()

@Module
@InstallIn(SingletonComponent::class)
object AppModule {
    @Provides @Singleton
    fun provideDatabase(@ApplicationContext context: Context) =
        Room.databaseBuilder(context, AppDatabase::class.java, "app.db").build()

    @Provides
    fun provideUserDao(db: AppDatabase) = db.userDao()
}

@HiltViewModel
class UserViewModel @Inject constructor(
    private val repository: UserRepository
) : ViewModel()

Koin for Multiplatform

val appModule = module {
    single { HttpClient(getEngine()) }
    single { UserRepository(get()) }
    viewModel { UserViewModel(get()) }
}

// Start Koin
startKoin {
    modules(appModule)
}

// Inject
val repository: UserRepository by inject()

Testing with DI

@HiltAndroidTest
class UserViewModelTest {
    @get:Rule val hiltRule = HiltAndroidRule(this)

    @BindValue @JvmField
    val repository: UserRepository = mockk()

    @Inject lateinit var viewModel: UserViewModel

    @Before fun setup() { hiltRule.inject() }
}

Troubleshooting

IssueResolution
"No binding for..."Add @Provides or @Binds
ViewModel not injectedUse hiltViewModel() in Compose

Usage

Skill("kotlin-di")

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です