AI SummaryA comprehensive Android architecture guide covering MVVM, Clean Architecture, Repository pattern, SOLID principles, and Hilt dependency injection for building enterprise-grade, scalable applications. Essential for Android developers and architects designing maintainable, testable codebases.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to set up the "06-architecture" agent in my project. Please run this command in my terminal: # Add AGENTS.md to your project root curl --retry 3 --retry-delay 2 --retry-all-errors -o AGENTS.md "https://raw.githubusercontent.com/pluginagentmarketplace/custom-plugin-android/main/agents/06-architecture.md" Then explain what the agent does and how to invoke it.
Description
Architecture & Design Patterns - MVVM, Clean Architecture, Repository, SOLID, Hilt DI (40 hours)
2.3 Application Layer (Use Cases)
`kotlin // Use case orchestration @HiltViewModel class UserListViewModel @Inject constructor( private val getUsersUseCase: GetUsersUseCase, private val deleteUserUseCase: DeleteUserUseCase ) : ViewModel() { private val _state = MutableStateFlow<UiState>(UiState.Loading) val state: StateFlow<UiState> = _state.asStateFlow() fun loadUsers() { viewModelScope.launch { when (val result = getUsersUseCase()) { is Result.Success -> _state.value = UiState.Success(result.data) is Result.Error -> _state.value = UiState.Error(result.exception) } } } } `
Architecture Agent: Scalable & Maintainable App Design
Design enterprise-grade Android applications using MVVM, Clean Architecture, Repository Pattern, and SOLID principles. Build scalable, testable, and maintainable codebases using proven architectural patterns. Prerequisite: Fundamentals, Platform, Data Management & Networking agents Duration: 40 hours | Level: Advanced Topics: 7 major areas | Code Examples: 35+ real-world patterns ---
1. MVVM ARCHITECTURE
MVVM (Model-View-ViewModel) separates concerns and enables testable, lifecycle-aware UI logic.
1.1 Complete MVVM Implementation
`kotlin // Domain: Business data data class User( val id: Int, val name: String, val email: String ) // ViewModel: State management & logic @HiltViewModel class UserListViewModel @Inject constructor( private val userRepository: UserRepository ) : ViewModel() { private val _uiState = MutableStateFlow<UiState>(UiState.Loading) val uiState: StateFlow<UiState> = _uiState.asStateFlow() init { loadUsers() } fun loadUsers() { viewModelScope.launch { _uiState.value = UiState.Loading when (val result = userRepository.getUsers()) { is Result.Success -> _uiState.value = UiState.Success(result.data) is Result.Error -> _uiState.value = UiState.Error(result.exception.message) } } } fun deleteUser(user: User) { viewModelScope.launch { userRepository.deleteUser(user) loadUsers() } } } sealed class UiState { object Loading : UiState() data class Success(val users: List<User>) : UiState() data class Error(val message: String) : UiState() } // View: UI & user interaction class UserListFragment : Fragment() { private val viewModel: UserListViewModel by viewModels() override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { viewModel.uiState.collect { state -> when (state) { is UiState.Loading -> showLoading() is UiState.Success -> showUsers(state.users) is UiState.Error -> showError(state.message) } } } } } } `
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster