Skip to content
kotlin-android-reviewer logo

Kotlin Android Reviewer Skill

kotlin-android-reviewer

WHEN: Android Kotlin code review, Jetpack Compose patterns, Coroutines/Flow checks, ViewModel structure analysis WHAT: Compose best practices + Coroutines patterns + State management + Memory leak detection + Performance optimization WHEN NOT: KMP shared code → kotlin-multiplatform-reviewer, Back...

SKILL.md

Full skill instructions

Kotlin Android Reviewer Skill

Purpose

Reviews Android Kotlin code for Jetpack Compose, Coroutines, Flow, and ViewModel best practices.

When to Use

  • Android Kotlin project code review
  • "Compose pattern", "Coroutines", "Flow", "ViewModel" mentions
  • Android performance, memory leak inspection
  • Projects with Android plugin in build.gradle.kts

Project Detection

  • com.android.application or com.android.library in build.gradle
  • AndroidManifest.xml exists
  • src/​main/​java or src/​main/​kotlin directories

Workflow

Step 1: Analyze Project

**Kotlin**: 1.9.x
**Compose**: 1.5.x
**minSdk**: 24
**targetSdk**: 34
**Architecture**: MVVM + Clean Architecture

Step 2: Select Review Areas

AskUserQuestion:

"Which areas to review?"
Options:
- Full Android pattern check (recommended)
- Jetpack Compose UI patterns
- Coroutines/​Flow usage
- ViewModel/​State management
- Memory leaks/​Performance
multiSelect: true

Detection Rules

Jetpack Compose Patterns

CheckRecommendationSeverity
Side-effect in ComposableUse LaunchedEffect/​SideEffectHIGH
Object creation without rememberUse remember { }HIGH
Missing State hoistingHoist state to parentMEDIUM
Missing derivedStateOfUse for derived stateLOW
LazyColumn without keyAdd key parameterHIGH
// BAD: Object creation without remember
@Composable
fun MyScreen() {
    val list = mutableListOf<String>()  // New every recomposition
}

// GOOD: Use remember
@Composable
fun MyScreen() {
    val list = remember { mutableListOf<String>() }
}

// BAD: Direct suspend call in Composable
@Composable
fun MyScreen(viewModel: MyViewModel) {
    viewModel.loadData()  // Side-effect!
}

// GOOD: Use LaunchedEffect
@Composable
fun MyScreen(viewModel: MyViewModel) {
    LaunchedEffect(Unit) {
        viewModel.loadData()
    }
}

Coroutines Patterns

CheckRecommendationSeverity
GlobalScope usageUse viewModelScope/​lifecycleScopeCRITICAL
Missing DispatcherSpecify Dispatchers.IO/​DefaultMEDIUM
Missing exception handlingtry-catch or CoroutineExceptionHandlerHIGH
runBlocking abuseConvert to suspend functionHIGH
// BAD: GlobalScope
GlobalScope.launch {
    repository.fetchData()
}

// GOOD: viewModelScope
viewModelScope.launch {
    repository.fetchData()
}

// BAD: Network on Main
viewModelScope.launch {
    val result = api.getData()  // NetworkOnMainThreadException
}

// GOOD: IO Dispatcher
viewModelScope.launch {
    val result = withContext(Dispatchers.IO) {
        api.getData()
    }
}

Flow Patterns

CheckRecommendationSeverity
Direct collect in ComposableUse collectAsStateHIGH
SharedFlow without replaySet appropriate replay valueMEDIUM
Nullable StateFlow initialProvide meaningful initial valueMEDIUM
// BAD: Direct collect in Composable
@Composable
fun MyScreen(viewModel: MyViewModel) {
    var data by remember { mutableStateOf<Data?>(null) }
    LaunchedEffect(Unit) {
        viewModel.dataFlow.collect { data = it }
    }
}

// GOOD: collectAsState
@Composable
fun MyScreen(viewModel: MyViewModel) {
    val data by viewModel.dataFlow.collectAsState()
}

// BAD: Nullable StateFlow initial
private val _state = MutableStateFlow<UiState?>(null)

// GOOD: Sealed class with clear initial state
private val _state = MutableStateFlow<UiState>(UiState.Loading)

ViewModel Patterns

CheckIssueSeverity
Direct Context referenceMemory leak riskCRITICAL
View referenceMemory leak riskCRITICAL
Missing SavedStateHandleProcess death handlingMEDIUM
Bidirectional data flowUse UiState + Event patternMEDIUM
// BAD: Activity Context reference
class MyViewModel(private val context: Context) : ViewModel()

// GOOD: Application Context with Hilt
class MyViewModel(
    @ApplicationContext private val context: Context
) : ViewModel()

// BAD: Bidirectional binding
class MyViewModel : ViewModel() {
    var name = MutableLiveData<String>()
}

// GOOD: Unidirectional + sealed class
class MyViewModel : ViewModel() {
    private val _uiState = MutableStateFlow(UiState())
    val uiState: StateFlow<UiState> = _uiState.asStateFlow()

    fun onNameChanged(name: String) {
        _uiState.update { it.copy(name = name) }
    }
}

Memory Leak Detection

CheckProblemSolution
Inner class with outer referenceActivity leakWeakReference or static
Unremoved ListenerMemory leakRemove in onDestroy
Uncancelled Coroutine JobJob leakStructured concurrency
Unreleased BitmapOOM riskrecycle() or Coil/​Glide

Response Template

## Android Kotlin Code Review Results

**Project**: [name]
**Kotlin**: 1.9.x | **Compose**: 1.5.x
**Files Analyzed**: X

### Jetpack Compose
| Status | File | Issue |
|--------|------|-------|
| HIGH | ui/​HomeScreen.kt | Object creation without remember (line 45) |
| MEDIUM | ui/​ProfileScreen.kt | State hoisting recommended |

### Coroutines/​Flow
| Status | File | Issue |
|--------|------|-------|
| CRITICAL | data/​Repository.kt | GlobalScope usage (line 23) |
| HIGH | viewmodel/​MainViewModel.kt | Missing exception handling |

### ViewModel/​State
| Status | File | Issue |
|--------|------|-------|
| HIGH | viewmodel/​DetailViewModel.kt | Activity Context reference |

### Recommended Actions
1. [ ] GlobalScope → viewModelScope
2. [ ] Add remember { }
3. [ ] Apply UiState sealed class pattern

Best Practices

  1. Compose: Prefer Stateless Composable, State hoisting
  2. Coroutines: Structured concurrency, appropriate Dispatcher
  3. Flow: Distinguish Hot/​Cold Flow, StateFlow for UI state
  4. ViewModel: Unidirectional data flow, avoid Context
  5. Testing: Turbine for Flow, Compose test rules

Integration

  • code-reviewer skill: General Kotlin code quality
  • kotlin-multiplatform-reviewer skill: KMP shared code
  • test-generator skill: Android test generation

Notes

  • Based on Compose 1.0+
  • Kotlin 1.9+, Coroutines 1.7+ recommended
  • Supports Hilt/​Dagger DI patterns

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View