This skill helps implement MVVM, Clean Architecture, and SOLID principles in Android apps using repository and dependency injection for robust, testable code.
npx playbooks add skill pluginagentmarketplace/custom-plugin-android --skill architecture
@HiltViewModel
class UserViewModel @Inject constructor(
private val repository: UserRepository
) : ViewModel() {
private val _state = MutableLiveData<UiState>()
val state: LiveData<UiState> = _state
fun loadUser(id: Int) {
viewModelScope.launch {
_state.value = repository.getUser(id)
}
}
}
interface UserRepository {
suspend fun getUser(id: Int): User
}
class UserRepositoryImpl(
private val dao: UserDao,
private val api: UserApi
) : UserRepository {
override suspend fun getUser(id: Int): User {
return dao.getUser(id) ?: api.fetchUser(id)
}
}
@Module
@InstallIn(SingletonComponent::class)
object RepositoryModule {
@Provides
fun provideUserRepository(dao: UserDao, api: UserApi): UserRepository {
return UserRepositoryImpl(dao, api)
}
}
✅ Dependency injection
✅ Interface-based design
✅ Layered architecture
✅ Single responsibility
✅ Testable code
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.