Create a new screen with ViewModel following clean architecture.
Creates a new screen with ViewModel following clean architecture patterns. Use this when building new UI features that require proper state management and navigation integration.
/plugin marketplace add ggz23/android-interview-plugin/plugin install ggz23-android-interview@ggz23/android-interview-pluginCreate a new screen with ViewModel following clean architecture.
Interview? Use
/android-interview:implementinstead to ensure proper requirements clarification before coding.
$ARGUMENTS - Screen name (e.g., "ProductList", "Settings")
Explore Existing Patterns
Add route to navigation (find the project's NavRoutes or similar)
Create screen folder: presentation/screens/{name}/ or follow project convention
Create ViewModel with state:
// {Name}ViewModel.kt
@HiltViewModel
class {Name}ViewModel @Inject constructor() : ViewModel() {
private val _state = MutableStateFlow({Name}State())
val state: StateFlow<{Name}State> = _state.asStateFlow()
fun onAction(action: {Name}Action) {
when (action) {
// Handle actions
}
}
}
data class {Name}State(
val isLoading: Boolean = false,
val error: String? = null
)
sealed interface {Name}Action {
data object Load : {Name}Action
}
@Composable
fun {Name}Screen(
viewModel: {Name}ViewModel = hiltViewModel(),
onNavigateBack: () -> Unit = {}
) {
val state by viewModel.state.collectAsStateWithLifecycle()
Scaffold(
topBar = {
// Top bar
}
) { padding ->
Column(modifier = Modifier.padding(padding)) {
// Content
}
}
}
Register in NavHost
Add strings to res/values/strings.xml