Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
mobile ruleP2universalStack: Kotlin
clean-architecturekotlinabstraction
Don't create pass-through use cases
Skip a use-case/interactor class when it only forwards to a repository with no added business logic. A one-line delegator is indirection without value; introduce a use case only when it encapsulates real logic (validation, orchestration, mapping). Call the repository directly otherwise.
PR: profico-org-corpus batch2 (all stacks/products)Created: Jul 26, 2026
Bad example
Old codekotlin
| 1 | class SetAccessTokenUseCase(private val repo: AuthRepository) { |
| 2 | suspend operator fun invoke(token: String) = repo.setAccessToken(token) |
| 3 | } |
Explanation (EN)
The use case adds no logic; it's pure indirection over the repo.
Objašnjenje (HR)
Good example
New codekotlin
| 1 | // ViewModel calls the repository directly when there is no extra logic |
| 2 | class AuthViewModel(private val repo: AuthRepository) { |
| 3 | suspend fun setToken(token: String) = repo.setAccessToken(token) |
| 4 | } |
Explanation (EN)
Without added behaviour, the view model uses the repository directly.
Objašnjenje (HR)