AGENT SKILL
dependency-injection-architecture
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 0
- Forks
- 0
02 资源文件 3
- 参考文档manifest.yaml563 B
- 参考文档references/koin-patterns.md3.8 KB
- 参考文档references/layers.md962 B
03 SKILL.md 正文
Dependency Injection & Architecture (Kotlin)
Expert in clean architecture and dependency injection for Kotlin applications.
Workflow
- Identify whether the task is about layer boundaries or Koin wiring.
- Match it to the Decision Table below.
- Read
references/<chosen>.mdusing theReadtool. - Apply the patterns, enforcing the Always-Active Rules below.
Decision Table
| If the task is about… | Read first |
|---|---|
| Layer responsibilities, allowed dependency direction, per-layer hard rules | references/layers.md |
Koin modules, single/factory, profile-based config, naming, adding a service, coroutine scope / CoroutineExceptionHandler provider |
references/koin-patterns.md |
Always-Active Rules
- Dependency direction is
presentation → domain ← data;commonhas zero project imports. - Only
data/db/DatabaseFactory.ktmay useDispatchers.IO. - Prefer constructor injection over
by inject()— it is explicit and testable. - Use interface types for all repository/service bindings.
- Never inject the DI container itself (service-locator anti-pattern).
- Use
Service, neverUseCase, for the naming of domain orchestration classes. - Provide
CoroutineExceptionHandleras its own DI dependency keyed by a typed qualifier (annotation class, not string@Named), then compose the scope asCoroutineScope(SupervisorJob() + dispatcher + exceptionHandler). A scope without an injected handler silently swallows background exceptions.
Do NOT
- Do NOT load both reference files unless the task spans layering and wiring.
- Do NOT put business logic in
presentation/Command classes. - Do NOT import Exposed/JDBC or the Telegram SDK into
domain/. - Do NOT create circular dependencies — redesign with an intermediate service.
Error Handling
- If the task does not match a Decision Table row, ask the user to clarify.
- If a reference file is missing, STOP and report the expected path.
Related Skills
kotlin-specialist— coroutine scope ownership and dispatcher rules wired through DIunit-testing-kotlin— MockImpl bindings and how DI enables test doublespostgresql-exposed-orm—DatabaseFactoryis the singleDispatchers.IOowner referenced above
04 同仓库更多 Skills
universal-skill
暂无简介
★ 0
notion-skill
暂无简介
★ 0
inline-frontmatter-skill
Hand-authored description that already lives in the body and must not be double-wrapped.
★ 0
universal-skill
暂无简介
★ 0
notion-skill
暂无简介
★ 0
write-a-skill
暂无简介
★ 0