본문으로 건너뛰기
Skillpedia
모바일 앱48k · #3742

android-jetpack-compose-expert

하는 일

Jetpack Compose를 사용해 Android 앱의 현대적인 사용자 인터페이스를 만드는 데 도움을 줍니다. 코드를 구성하는 방법, 화면에서 변하는 정보를 관리하는 방법, 화면 사이를 이동하는 방법, 성능을 최적화하는 방법을 알려 줍니다.

사용하는 경우

  • ✓Jetpack Compose로 새 Android 앱을 시작할 때.
  • ✓기존 레이아웃(XML)을 새로운 Compose 시스템으로 옮길 때.
  • ✓화면을 계속 업데이트해야 하는 복잡한 기능을 만들 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/android-jetpack-compose-expert/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/android-jetpack-compose-expert/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Jetpack Compose로 만든 Android 앱에서 화면 사이를 타입 안전 방식으로 이동하도록 어떻게 설정할 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

데이터 관리를 위한 `ViewModel`, 화면 이동을 위한 `NavHost` 같은 Jetpack Compose 구성 요소를 어떻게 사용하는지 코드 예시와 설명을 제공합니다. 목표는 더 깔끔하고 효율적인 코드를 작성하는 것입니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Android Jetpack Compose Expert

Overview

A comprehensive guide for building production-quality Android applications using Jetpack Compose. This skill covers architectural patterns, state management with ViewModels, navigation type-safety, and performance optimization techniques.

When to Use This Skill

  • Use when starting a new Android project with Jetpack Compose.
  • Use when migrating legacy XML layouts to Compose.
  • Use when implementing complex UI state management and side effects.
  • Use when optimizing Compose performance (recomposition counts, stability).
  • Use when setting up Navigation with type safety.

Step-by-Step Guide

1. Project Setup & Dependencies

Ensure your libs.versions.toml includes the necessary Compose BOM and libraries.

[versions]
composeBom = "2024.02.01"
activityCompose = "1.8.2"

[libraries]
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }

2. State Management Pattern (MVI/MVVM)

Use ViewModel with StateFlow to expose UI state. Avoid exposing MutableStateFlow.

// UI State Definition
data class UserUiState(
    val isLoading: Boolean = false,
    val user: User? = null,
    val error: String? = null
)

// ViewModel
class UserViewModel @Inject constructor(
    private val userRepository: UserRepository
) : ViewModel() {

    private val _uiState = MutableStateFlow(UserUiState())
    val uiState: StateFlow<UserUiState> = _uiState.asStateFlow()

    fun loadUser() {
        viewModelScope.launch {
            _uiState.update { it.copy(isLoading = true) }
            try {
                val user = userRepository.getUser()
                _uiState.update { it.copy(user = user, isLoading = false) }
            } catch (e: Exception) {
                _uiState.update { it.copy(error = e.message, isLoading = false) }
            }
        }
    }
}

3. Creating the Screen Composable

Consume the state in a "Screen" composable and pass data down to stateless components.

@Composable
fun UserScreen(
    viewModel: UserViewModel = hiltViewModel()
) {
    val uiState by viewModel.uiState.collectAsStateWithLifecycle()

    UserContent(
        uiState = uiState,
        onRetry = viewModel::loadUser
    )
}

@Composable
fun UserContent(
    uiState: UserUiState,
    onRetry: () -> Unit
) {
    Scaffold { padding ->
        Box(modifier = Modifier.padding(padding)) {
            when {
                uiState.isLoading -> CircularProgressIndicator()
                uiState.error != null -> ErrorView(uiState.error, onRetry)
                uiState.user != null -> UserProfile(uiState.user)
            }
        }
    }
}

Examples

Example 1: Type-Safe Navigation

Using the new Navigation Compose Type Safety (available in recent versions).

// Define Destinations
@Serializable
object Home

@Serializable
data class Profile(val userId: String)

// Setup NavHost
@Composable
fun AppNavHost(navController: NavHostController) {
    NavHost(navController, startDestination = Home) {
        composable<Home> {
            HomeScreen(onNavigateToProfile = { id ->
                navController.navigate(Profile(userId = id))
            })
        }
        composable<Profile> { backStackEntry ->
            val profile: Profile = backStackEntry.toRoute()
            ProfileScreen(userId = profile.userId)
        }
    }
}

Best Practices

  • ✅ Do: Use remember and derivedStateOf to minimize unnecessary calculations during recomposition.
  • ✅ Do: Mark data classes used in UI state as @Immutable or @Stable if they contain List or other unstable types to enable smart recomposition skipping.
  • ✅ Do: Use LaunchedEffect for one-off side effects (like showing a Snackbar) triggered by state changes.
  • ❌ Don't: Perform expensive operations (like sorting a list) directly inside the Composable function body without remember.

…

자주 묻는 질문

Jetpack Compose란 무엇인가요?

XML 파일 대신 Kotlin 코드를 사용해 Android의 사용자 인터페이스를 만드는 최신 방식입니다.

ViewModel이란 무엇인가요?

화면 데이터를 저장하고 관리하는 클래스입니다. 휴대폰을 회전해도 데이터가 유지됩니다.

‘타입 안전 탐색’은 무슨 뜻인가요?

탐색 시스템이 화면 사이에 올바른 데이터를 전달하는지 확인해서 오류를 막는다는 뜻입니다.

상세 정보

작성자의 원본 설명

Expert guidance for building modern Android UIs with Jetpack Compose, covering state management, navigation, performance, and Material Design 3.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#3742
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬