trigger: always_on glob: "**/*.{kt,kts,xml}" description: Android Jetpack Compose Guidelines
Android Native (Jetpack Compose)
Android Jetpack Compose
Flexibility Notice
Note: This is a recommended project structure, but be flexible and adapt to existing project structures. Do not enforce these structural patterns if the project follows a different organization. Focus on maintaining consistency with the existing project architecture while applying Jetpack Compose best practices.
Project Architecture and Best Practices
val androidJetpackComposeBestPractices = listOf(
"Adapt to existing project architecture while maintaining clean code principles",
"Follow Material Design 3 guidelines and components",
"Implement clean architecture with domain, data, and presentation layers",
"Use Kotlin coroutines and Flow for asynchronous operations",
"Implement dependency injection using Hilt",
"Follow unidirectional data flow with ViewModel and UI State",
"Use Compose navigation for screen management",
"Implement proper state hoisting and composition"
)
Folder Structure
Note: This is a reference structure. Adapt to the project's existing organization.
app/
src/
main/
java/com/package/
data/
repository/
datasource/
models/
domain/
usecases/
models/
repository/
presentation/
screens/
components/
theme/
viewmodels/
di/
utils/
res/
values/
drawable/
mipmap/
test/
androidTest/
Compose UI Guidelines
- Use
rememberandderivedStateOfappropriately - Implement proper recomposition optimization
- Use proper Compose modifiers ordering
- Follow composable function naming conventions
- Implement proper preview annotations
- Use proper state management with
MutableState - Implement proper error handling and loading states
- Use proper theming with
MaterialTheme - Follow accessibility guidelines
- Implement proper animation patterns
Testing Guidelines
- Write unit tests for ViewModels and UseCases
- Implement UI tests using Compose testing framework
- Use fake repositories for testing
- Implement proper test coverage
- Use proper testing coroutine dispatchers
Performance Guidelines
- Minimize recomposition using proper keys
- Use proper lazy loading with
LazyColumnandLazyRow - Implement efficient image loading
- Use proper state management to prevent unnecessary updates
- Follow proper lifecycle awareness
- Implement proper memory management
- Use proper background processing
Related Documents
Design Document: BharatSeva AI
BharatSeva AI is a multi-agent orchestration system built on AWS using Amazon Bedrock Agents with Claude 3.5 Sonnet as the foundation model. The system deploys 10 AI agents (1 Master Orchestrator + 9 Specialist Agents) to assist India's informal sector workers in navigating government schemes across three domains: PM Vishwakarma (artisan credit), PMFBY (crop insurance), and BOCW (construction worker welfare).
OpenClaw Enterprise Transformation Plan
Transform OpenClaw from a single-user personal AI assistant into a **dual-mode platform** that is simultaneously:
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Daniel Sandner, for article on https://sandner.art/
Qwen3-TTS — Model Reference
Models: `Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice` and `Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice`