android-clean-architecture

Implements Clean Architecture module structure, UseCases, and Repositories for Android and Kotlin Multiplatform projects.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill android-clean-architecture-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-clean-architecture
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/pi/.pi/agent/skills/android-clean-architecture
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill android-clean-architecture-ravitejakarra24

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Structuring Android and Kotlin Multiplatform codebases without clear layer boundaries leads to tangled dependencies, untestable business logic, and framework leakage into domain code. This Skill provides concrete patterns for module separation, dependency rules, and data flow so projects stay maintainable as they grow. ## Core Features & Use Cases - Module Structure & Dependency Rules: Defines a layered layout (app, core, domain, data, presentation, design-system) with strict dependency direction, keeping the domain layer pure Kotlin. - UseCase and Repository Patterns: Provides templates for operator fun invoke UseCases, Flow-based observers, repository interfaces in domain, and implementations coordinating local and remote DataSources. - Data Layer Integrations: Includes working examples for Room, SQLDelight, Ktor HTTP clients, mapper extension functions, and DI wiring with Koin or Hilt. - Use Case: When starting a new KMP feature, apply the patterns to create a domain module with a GetItemsByCategoryUseCase, a ItemRepository interface, and a data module with Room/SQLDelight entities and Ktor remote sources, all wired through Koin modules. ## Quick Start Ask the agent to scaffold a new feature module following Clean Architecture with a UseCase, Repository interface, Room entity, and Koin DI wiring.

Frequently Asked Questions about android-clean-architecture

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

FAQPage Schema
How do I structure modules for Clean Architecture on Android?

Split the project into app, core, domain, data, presentation, and design-system modules. Dependencies flow inward: presentation and data depend on domain, while domain depends only on core or nothing, keeping it pure Kotlin with no framework imports.

How to implement a UseCase in Kotlin with clean call sites?

Define a class with a single `suspend operator fun invoke` that delegates to a repository, returning `Result<T>` or a `Flow`. This lets callers invoke the UseCase like a function, e.g. `getItems(category)`, keeping ViewModel code concise.

Koin vs Hilt for dependency injection in KMP projects?

Koin works across Kotlin Multiplatform targets and uses simple module DSL with `single` and `factory` declarations. Hilt is Android-only, using annotation processing with `@Module` and `@Binds`, and integrates directly with ViewModels via `@HiltViewModel`.

Can the domain layer use Room or Android framework classes?

No. The domain layer must remain pure Kotlin with no Android framework, Room, or DTO imports. Database entities and network DTOs live in the data layer and are converted to domain models via mapper extension functions.

Why should database entities not be exposed to the UI layer?

Exposing entities couples the UI to storage details, so schema changes ripple through the app. Map entities to domain models in the repository using extension functions like `toDomain()`, so presentation only sees stable domain types.

When should I use SQLDelight instead of Room?

Use SQLDelight for Kotlin Multiplatform projects since it generates type-safe Kotlin APIs from `.sq` files that compile on Android and iOS. Room is Android-only and better suited when the project targets a single platform.