PluginBench
Rule

android jetpack compose

via PatrickJS/awesome-cursorrules

Android development with Jetpack Compose best practices and architecture patterns.

What is android jetpack compose?

This rule provides guidance for Android development using Jetpack Compose, covering clean architecture, Material Design 3, state management, and performance optimization. Use it when building modern Android UIs with Compose to maintain consistency with recommended patterns while adapting to your project's existing structure.

  • Guides clean architecture implementation with domain, data, and presentation layers
  • Recommends Material Design 3 components and theming patterns
  • Advises on state management using ViewModel, Flow, and proper composition
  • Provides Compose-specific optimization techniques for recomposition and lazy loading
  • Outlines testing strategies for ViewModels, UseCases, and Compose UI
  • Suggests performance best practices including memory management and lifecycle awareness

Applies to

File patterns this rule matches.

**/*
Rule definition (reference)

Source of truth, from the repository.

// Android Jetpack Compose .cursorrules

// 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

const androidJetpackComposeBestPractices = [ "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

const projectStructure = 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

const composeGuidelines = `

  1. Use remember and derivedStateOf appropriately
  2. Implement proper recomposition optimization
  3. Use proper Compose modifiers ordering
  4. Follow composable function naming conventions
  5. Implement proper preview annotations
  6. Use proper state management with MutableState
  7. Implement proper error handling and loading states
  8. Use proper theming with MaterialTheme
  9. Follow accessibility guidelines
  10. Implement proper animation patterns `;

// Testing Guidelines

const testingGuidelines = `

  1. Write unit tests for ViewModels and UseCases
  2. Implement UI tests using Compose testing framework
  3. Use fake repositories for testing
  4. Implement proper test coverage
  5. Use proper testing coroutine dispatchers `;

// Performance Guidelines

const performanceGuidelines = `

  1. Minimize recomposition using proper keys
  2. Use proper lazy loading with LazyColumn and LazyRow
  3. Implement efficient image loading
  4. Use proper state management to prevent unnecessary updates
  5. Follow proper lifecycle awareness
  6. Implement proper memory management
  7. Use proper background processing `;

Related rules

Angular development with Novo Elements UI library—clean code practices and standalone component patterns.

**/*
41k
via PatrickJS/awesome-cursorrules

Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.

**/*
41k
via PatrickJS/awesome-cursorrules

Ankra CLI rules and best practices for Kubernetes cluster management via the Ankra platform.

**/*.sh +5
41k
via PatrickJS/awesome-cursorrules

Keep changes scoped and simple—modify only what was asked, nothing more.

["**/*"]
41k
via PatrickJS/awesome-cursorrules

Enforce technical rigor in code review and generation by blocking hallucinated APIs, false confidence, and authority-driven validation.

**/*
41k
via PatrickJS/awesome-cursorrules

Turn-based ASCII simulation where AI nations compete for resources on a procedurally generated 100x100 grid.

**/*
41k
via PatrickJS/awesome-cursorrules