kmp-shared-resources

Configures Compose Multiplatform Resources for sharing strings, images, and fonts across KMP targets.

2|Updated Jun 6, 2026
One-click install
npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-shared-resources-ronjunevaldoz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-shared-resources
Source: https://github.com/ronjunevaldoz/kmp-agent-skills/tree/main/skills/kmp-shared-resources
Command: npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-shared-resources-ronjunevaldoz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Sharing strings, plurals, images, fonts, and raw files across Android, iOS, Desktop, and Web in a Kotlin Multiplatform project normally requires duplicating platform-specific resource systems. This Skill sets up Compose Multiplatform Resources so a single composeResources/ directory in commonMain works on every target with type-safe generated accessors. ## Core Features & Use Cases - Unified resource directory: Organizes strings, plurals, drawables (with dark and density variants), fonts, and raw files under src/commonMain/composeResources/. - Type-safe accessors: Generates a Res object consumed via stringResource, pluralStringResource, painterResource, and Font in Composables, plus suspend APIs for ViewModels and repositories. - Localization and theming: Covers values-<locale>/strings.xml localization, custom font wiring into a Material3 theme, and sharing Res across modules with publicResClass. - Use Case: You need to localize a KMP app into Spanish and replace hardcoded strings in Composables. The Skill walks you through creating values/strings.xml and values-es/strings.xml, then accessing them via stringResource(Res.string.app_name) on all targets. ## Quick Start Ask the agent to set up Compose Multiplatform Resources in the :core:ui module with shared strings, fonts, and localized values directories.

Frequently Asked Questions about kmp-shared-resources

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share strings across Kotlin Multiplatform targets?▼

Place strings in src/commonMain/composeResources/values/strings.xml and access them with stringResource(Res.string.app_name) in Composables. The Compose Resources plugin generates type-safe accessors that work on Android, iOS, Desktop, and Web from one directory.

How to localize a Compose Multiplatform app?▼

Create locale-specific directories like values-es/strings.xml alongside the default values/strings.xml in composeResources. The resource system resolves the correct locale at runtime, and you must register new locales in gradle/libs.versions.toml or they are silently ignored.

Can I use Compose Resources outside Composables?▼

Yes, use the suspend APIs getString(Res.string.xxx) and pluralString(Res.plurals.xxx, count, count) in ViewModels or repositories. Raw files are read with Res.readBytes("files/config.json") under the ExperimentalResourceApi opt-in.

Why is Res.string unresolved in my KMP module?▼

The Res accessors are generated at build time, so run ./gradlew generateCommonMainResourceAccessors to regenerate them. Also confirm the module applies the org.jetbrains.compose plugin and includes compose.components.resources in commonMain dependencies.

How do I share Res resources between KMP modules?▼

Set publicResClass = true and packageOfResClass in the compose.resources block of the owning module such as :core:ui. Consuming modules then add implementation(projects.core.ui) to access the shared Res object.

Should I use PNG or SVG for images in Compose Multiplatform?▼

Use SVG for icons since it scales across densities with the smallest size, and reserve PNG or WebP for photos or complex rasters. Density-specific rasters go in drawable-mdpi through drawable-xxxhdpi folders sized by px = dp × scale factor.