Back to Prompts

Kotlin / Android Development

CLAUDE.md for Kotlin and Android projects with Jetpack Compose

kotlinandroidmobilejetpack-compose
By Claude Code Community

CLAUDE.md Content

# Kotlin / Android Project

This is a Kotlin Android project using Jetpack Compose and modern Android architecture.

## Project Structure
- `app/src/main/java/` - Main source code
- `ui/` - Compose UI screens and components
- `data/` - Repositories, data sources, and models
- `domain/` - Use cases and domain models
- `di/` - Dependency injection modules
- `app/src/test/` - Unit tests
- `app/src/androidTest/` - Instrumented tests

## Code Style
- Use Kotlin idioms (scope functions, extensions, sealed classes)
- Use Jetpack Compose for all new UI
- Use coroutines and Flow for async operations
- Follow Kotlin coding conventions

## Conventions
- Use MVVM architecture with ViewModels
- Use Hilt for dependency injection
- Use sealed classes/interfaces for UI state
- Use data classes for models and DTOs
- Prefer immutable data (val over var)

## State Management
- Use StateFlow for UI state in ViewModels
- Use remember and mutableStateOf in Compose
- Collect flows with collectAsStateWithLifecycle
- Keep UI state in ViewModels, not in composables

## Navigation
- Use Compose Navigation with type-safe routes
- Define navigation graphs in a central location
- Pass arguments through routes, not shared state

## Commands
- `./gradlew assembleDebug` - Build debug APK
- `./gradlew test` - Run unit tests
- `./gradlew connectedAndroidTest` - Run instrumented tests
- `./gradlew lint` - Run lint checks

How to use

  1. Copy the content above
  2. Create a CLAUDE.md file in your project root
  3. Paste the content and customize as needed
  4. Claude Code will automatically use this context