What problem does it solve?
This Skill solves the common problem of inconsistent, fragile Android UI code that leads to state loss during configuration changes, untraceable bugs from tight coupling, and untestable UI logic, by providing Google's official, production-proven UI layer architecture guidelines tailored for TajsOS Android development.
Core Features & Use Cases
- Unidirectional Data Flow (UDF) Enforcement: Guarantees state flows down from ViewModel to UI and events flow up from UI to ViewModel to eliminate state inconsistencies and lost user interactions.
- ViewModel & State Holder Best Practices: Guidance on proper ViewModel scoping, lifecycle safety, and separation of business and UI logic to avoid memory leaks, tight coupling, and untestable components.
- Lifecycle-Aware State Collection: Rules for using
collectAsStateWithLifecycle in Compose and repeatOnLifecycle in Views to prevent unnecessary work and memory leaks when the UI is backgrounded.
- Use Case: When building a task capture screen in TajsOS, use this Skill to ensure the screen's UI state persists when the user rotates their device, one-time snackbar messages are never lost, and reusable UI components like task chips don't depend on the screen-level ViewModel.
Quick Start
Use the ui-layer skill to audit your Compose screen's ViewModel and state collection logic to ensure it follows Google's recommended Android UI layer patterns.