Home › Android / Kotlin › Android Jetpack Compose AGENTS.md

Android Jetpack Compose AGENTS.md

AGENTS.md for Android apps in Kotlin 2 with Jetpack Compose, ViewModel + StateFlow, Hilt, and Room.

AGENTS.mdAndroid / Kotlin

How to use

Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

AGENTS.mdDownload  
# AGENTS.md: Android (Kotlin + Compose)

## Commands
`./gradlew assembleDebug` · `./gradlew testDebugUnitTest` · `./gradlew lint` · `./gradlew ktlintCheck` (or `detekt`, whichever exists)

## Architecture
- UI in Compose only; no new XML layouts or Fragments.
- Each screen: `FooScreen` (stateless composable taking state + lambdas) and `FooRoute` that gets the `FooViewModel` via `hiltViewModel()`.
- ViewModels expose one `StateFlow<FooUiState>` (immutable data class) and accept events as functions. Collect with `collectAsStateWithLifecycle()`.
- Data flows Repository -> ViewModel -> UI. Repositories return `Flow` or `suspend` results and own the Room DAO and Retrofit/Ktor service.
- Coroutines: `viewModelScope`, inject dispatchers, never `GlobalScope` or `runBlocking` in app code.
- Dependency injection with Hilt (`@HiltViewModel`, `@Inject constructor`).
- Navigation Compose with type-safe `@Serializable` routes.
- Dependencies go in `gradle/libs.versions.toml` (version catalog), not hard-coded versions.

## Compose rules
- Hoist state; pass `Modifier` as the first optional parameter.
- Use `remember`/`derivedStateOf` for expensive calculations; stable keys in `LazyColumn` `items(key = { it.id })`.
- Strings in `strings.xml`, colors from `MaterialTheme`. Content descriptions on icons.

## Done
Build, unit tests, and lint pass. Add `@Preview` for new composables.

More: all Android / Kotlin rules · all AGENTS.md rules

Related rules

Flutter AGENTS.md

AGENTS.md for Flutter apps with Riverpod, go_router and clean feature-first structure.

AGENTS.mdFlutter

Flutter + Riverpod rules

Cursor rules for Flutter 3 apps using Riverpod 3 with code generation, go_router, and widget tests.

CursorFlutter

Kotlin Multiplatform + Compose Multiplatform CLAUDE.md

CLAUDE.md for Kotlin Multiplatform apps sharing UI with Compose Multiplatform across Android, iOS, desktop, and web.

Claude Code (CLAUDE.md)Kotlin Multiplatform

Kotlin Multiplatform Copilot path instructions

Path-specific Copilot instructions for Kotlin Multiplatform modules: commonMain first, expect/actual, and coroutines.

GitHub CopilotKotlin Multiplatform

React Native + Expo rules

Cursor rules for Expo Router apps with TypeScript, NativeWind and TanStack Query.

CursorReact Native / Expo

React Native + Expo Windsurf rules

Windsurf rules for React Native apps on Expo SDK (New Architecture): Expo Router, native modules, and EAS builds.

WindsurfReact Native / Expo

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.