domain is pure Kotlin business logic. No Android dependencies belong here.
- Define repository interfaces, use cases, domain models, and domain exceptions.
- Use
operator fun invoke(...)for use cases. - Prefer
Result<T>orFlow<T>for new code. - Keep the legacy
Pair<T?, ErrorHandler?>pattern only for existing user/auth code. - Do not add data access or UI concerns here.
- Business contracts and orchestration
- Error mapping and domain-specific exceptions
- Shared utilities used by other layers
- All use cases use
@Inject constructor - Naming:
Get{Resource}UseCasefor reads,{Verb}{Resource}UseCasefor mutations
- Define feature errors as
sealed class {Feature}Errorwithobjectentries extending theKoinErrorException - Avoid standalone exception subclasses for new code — the sealed class groups related errors and is easier to handle exhaustively
- Root
AGENTS.md data/AGENTS.md