android-clean-architecture

Implements Clean Architecture module structure and layer patterns for Android and Kotlin Multiplatform projects.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill android-clean-architecture-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: android-clean-architecture
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/android-clean-architecture
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill android-clean-architecture-freedom909

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 organizing modules, enforcing dependency rules, and implementing UseCases, Repositories, and DataSources. ## Core Features & Use Cases - Module Structure & Dependency Rules: Defines a recommended layout (app, core, domain, data, presentation, design-system) with strict rules ensuring the domain layer stays pure Kotlin with no framework dependencies. - UseCase and Repository Patterns: Provides templates for suspend and Flow-based UseCases using operator invoke, repository interfaces in domain, and implementations coordinating local and remote DataSources. - Data Layer Implementations: Includes working examples for Room databases, SQLDelight queries, Ktor HTTP clients, mapper extension functions, and DI setup with Koin or Hilt. - Use Case: When starting a new KMP project, apply this Skill to scaffold the module graph, write a GetItemsByCategoryUseCase, wire an ItemRepositoryImpl with Room and Ktor DataSources, and register everything in Koin modules. ## Quick Start Ask the AI to structure a new Android or Kotlin Multiplatform feature module following Clean Architecture with a UseCase, Repository, and Room data source.

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 an Android project with Clean Architecture?▼

Split the project into app, core, domain, data, and presentation modules. Domain holds pure Kotlin UseCases, models, and repository interfaces; data implements repositories with Room or Ktor DataSources; presentation contains ViewModels and UI. Dependencies must point inward only.

How to write a UseCase in Kotlin Clean Architecture?▼

Create a class with a single operator fun invoke that calls a repository, using suspend for one-shot operations or returning Flow for reactive streams. Inject the repository interface through the constructor so the UseCase stays testable and framework-free.

Koin vs Hilt for dependency injection in KMP projects?▼

Koin works in Kotlin Multiplatform shared code and uses simple module DSL with single and factory declarations. Hilt is Android-only, annotation-based, and integrates with ViewModels via @HiltViewModel. Choose Koin for KMP, Hilt for Android-only apps.

Can the domain layer depend on Android framework classes?▼

No, the domain layer must never import Android framework, data, or presentation code. It contains only pure Kotlin data classes, repository interfaces, and UseCases, which keeps business logic portable across platforms and unit-testable without an emulator.

Should I use Room or SQLDelight for local storage?▼

Use Room for Android-only projects with annotation-based entities and DAOs. Use SQLDelight for Kotlin Multiplatform since it generates type-safe Kotlin APIs from SQL statements that compile on Android, iOS, and other KMP targets.

Why should DTOs and entities not be exposed to the UI layer?▼

Exposing database entities or network DTOs to the UI couples presentation to storage and API schemas, so any backend or schema change breaks the UI. Map them to domain models with extension functions at the data layer boundary instead.