AI SummaryBuild robust native Android applications using Kotlin with modern architecture patterns, Jetpack libraries, and Compose for declarative UI.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to install the "android-kotlin-development" skill in my project. Please run this command in my terminal: # Install skill into your project (2 files) mkdir -p .claude/skills/android-kotlin-development-aj-geddes-useful-ai-prompts && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/android-kotlin-development-aj-geddes-useful-ai-prompts/SKILL.md "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/development/android-kotlin-development-aj-geddes-useful-ai-prompts/SKILL.md" && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/android-kotlin-development-aj-geddes-useful-ai-prompts/metadata.json "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/development/android-kotlin-development-aj-geddes-useful-ai-prompts/metadata.json" Then restart Claude Code (or reload the window in Cursor) so the skill is picked up.
Description
Develop native Android apps with Kotlin. Covers MVVM with Jetpack, Compose for modern UI, Retrofit for API calls, Room for local storage, and navigation architecture.
Overview
Build robust native Android applications using Kotlin with modern architecture patterns, Jetpack libraries, and Compose for declarative UI.
When to Use
• Creating native Android applications with best practices • Using Kotlin for type-safe development • Implementing MVVM architecture with Jetpack • Building modern UIs with Jetpack Compose • Integrating with Android platform APIs
1. **Models & API Service**
`kotlin // Models data class User( val id: String, val name: String, val email: String, val avatarUrl: String? = null ) data class Item( val id: String, val title: String, val description: String, val imageUrl: String? = null, val price: Double ) // API Service with Retrofit interface ApiService { @GET("/users/{id}") suspend fun getUser(@Path("id") userId: String): User @PUT("/users/{id}") suspend fun updateUser( @Path("id") userId: String, @Body user: User ): User @GET("/items") suspend fun getItems(@Query("filter") filter: String = "all"): List<Item> @POST("/items") suspend fun createItem(@Body item: Item): Item } // Network client setup @Module @InstallIn(SingletonComponent::class) object NetworkModule { @Provides @Singleton fun provideRetrofit(): Retrofit { val httpClient = OkHttpClient.Builder() .addInterceptor { chain -> val original = chain.request() val requestBuilder = original.newBuilder() val token = PreferencesManager.getToken() if (token.isNotEmpty()) { requestBuilder.addHeader("Authorization", "Bearer $token") } requestBuilder.addHeader("Content-Type", "application/json") chain.proceed(requestBuilder.build()) } .connectTimeout(30, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) .build() return Retrofit.Builder() .baseUrl("https://api.example.com") .client(httpClient) .addConverterFactory(GsonConverterFactory.create()) .build() } @Provides @Singleton fun provideApiService(retrofit: Retrofit): ApiService { return retrofit.create(ApiService::class.java) } } `
2. **MVVM ViewModels with Jetpack**
`kotlin @HiltViewModel class UserViewModel @Inject constructor( private val apiService: ApiService ) : ViewModel() { private val _user = MutableStateFlow<User?>(null) val user: StateFlow<User?> = _user.asStateFlow() private val _isLoading = MutableStateFlow(false) val isLoading: StateFlow<Boolean> = _isLoading.asStateFlow() private val _errorMessage = MutableStateFlow<String?>(null) val errorMessage: StateFlow<String?> = _errorMessage.asStateFlow() fun fetchUser(userId: String) { viewModelScope.launch { _isLoading.value = true _errorMessage.value = null try { val user = apiService.getUser(userId) _user.value = user } catch (e: Exception) { _errorMessage.value = e.message ?: "Unknown error" } finally { _isLoading.value = false } } } fun logout() { _user.value = null } } @HiltViewModel class ItemsViewModel @Inject constructor( private val apiService: ApiService ) : ViewModel() { private val _items = MutableStateFlow<List<Item>>(emptyList()) val items: StateFlow<List<Item>> = _items.asStateFlow() private val _isLoading = MutableStateFlow(false) val isLoading: StateFlow<Boolean> = _isLoading.asStateFlow() fun fetchItems(filter: String = "all") { viewModelScope.launch { _isLoading.value = true try { val items = apiService.getItems(filter) _items.value = items } catch (e: Exception) { println("Error fetching items: ${e.message}") } finally { _isLoading.value = false } } } fun addItem(item: Item) { viewModelScope.launch { try { val created = apiService.createItem(item) _items.value = _items.value + created } catch (e: Exception) { println("Error creating item: ${e.message}") } } } } `
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster