[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74FT1WXX5MPQW2Q5S18B7CS":3,"skill-same:01M74FT1WXX5MPQW2Q5S18B7CS":69},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":27,"updatedAt":28,"install":29,"resources":42},"01M74FT1WXX5MPQW2Q5S18B7CS","compose-multiplatform",null,"Astrumon\u002Fspovishun-skills","Astrumon","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F67917191?v=4","01M74FSGPFMM3XWY2PMSEN8Z2W","Danylo Bidnyk","01M74FSGQ12JX4QM4FEY6NEH6N",0,"MIT","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"# Compose Multiplatform Skill\n\nThe mechanics of Compose Multiplatform UI: where state lives and how it is keyed, how the modifier\nparameter forms a component's public contract, how lazy lists stay cheap, and why a composable\nrecomposes when it should skip.\n\nDesign-system boundaries, component contracts and theme usage are normative — see\n`.claude\u002Frules\u002Fkmp\u002Fuikit.md`. Screen composition, effect collection and the MVI wiring are in\n`.claude\u002Frules\u002Fkmp\u002Ffeature-structure.md` and `.claude\u002Frules\u002Fkmp\u002Farchitecture.md`. This skill\nimplements against those rules; it does not restate them.\n\n| If you need… | Read |\n|---|---|\n| `remember` keying, `derivedStateOf`, hoisting boundaries, cross-phase back-writing | `references\u002Fstate-management.md` |\n| The `modifier` parameter contract and chain ordering | `references\u002Fmodifiers-and-layout.md` |\n| `LazyColumn` keys, `contentType`, prefetch, the O(n²) trap | `references\u002Flists-and-scrolling.md` |\n| Stability classes, strong skipping, compiler reports, phase deferral | `references\u002Fperformance-and-stability.md` |\n| Gating stability in CI against a committed baseline; runtime recomposition counts on non-Android targets | `references\u002Fstability-baselines.md` |\n| Where a component belongs and what its contract must be | `.claude\u002Frules\u002Fkmp\u002Fuikit.md` |\n\nDo not load a reference during discovery — open it when writing or diagnosing that specific thing.\n\n## Scope\n\n**In scope**\n- State: `remember` and its keys, `rememberSaveable`, `derivedStateOf`, hoisting decisions.\n- Effects: which one, keyed how, and what invalidates what.\n- Modifier API contract, chain order, custom layout.\n- Lazy list correctness and cost.\n- Recomposition diagnosis: stability, strong skipping, phase.\n- Gating stability against a committed baseline, and measuring recomposition at runtime.\n- Compose Multiplatform specifics — what is Android-only and what runs in `commonMain`.\n\n**Out of scope — hand off, do not answer here**\n- Whether a component belongs in the design system → `.claude\u002Frules\u002Fkmp\u002Fuikit.md`\n- Screen\u002Ffeature package layout, effect collection shape → `.claude\u002Frules\u002Fkmp\u002Ffeature-structure.md`\n- ViewModel contract, `UiState`\u002F`Intent`\u002F`Effect` → `.claude\u002Frules\u002Fkmp\u002Farchitecture.md`\n- Obtaining a ViewModel in a composable → **`koin-kmp`**\n- Navigation and routes → `.claude\u002Frules\u002Fkmp\u002Fnavigation.md`\n- Strings and resources → `.claude\u002Frules\u002Fkmp\u002Flocalization.md`\n- Compose UI test authoring → **`kmp-testing`**\n- Compose compiler Gradle wiring → **`kmp-multiplatform-specialist`**\n- iOS-embedded views → **`kmp-ios-interop`**\n\n## Procedure\n\n1. **Read the surrounding code first** — the screen, its state holder, and one neighbouring component.\n   Match the conventions already in use before introducing any.\n2. **Name the axis before optimising.** A recomposition complaint is either a *stability* problem (the\n   composable runs although inputs did not change) or a *phase* problem (a state read happened in\n   composition that belonged in layout or draw). Applying the wrong fix costs time and adds noise.\n3. **Change the smallest surface.** Prefer deriving over caching, hoisting over annotating.\n4. **Verify.** Run the UI tests for the affected screen and report the real output.\n\n## Composition, layout, draw\n\nThree phases, in order. State written in a phase invalidates that phase and everything after it —\nnever before it. Almost every \"jittery scroll\", \"ghost layout\" or \"recomposition loop\" is a **backward\nwrite**: layout or draw writing state that composition reads. The cure is a layout-phase API\n(`Modifier.layout { }`, `Modifier.offset { }`, `Modifier.graphicsLayer { }`), not a `MutableState`\nbridging the value back into composition. `references\u002Fstate-management.md` has the shapes.\n\n## Compose Multiplatform vs Android\n\nSeveral things carried over from Android tutorials do not exist or do not behave the same in\n`commonMain`:\n\n| Android | Compose Multiplatform |\n|---|---|\n| `rememberSaveable` with `Bundle` \u002F `@Parcelize` | `@Serializable` + a kotlinx-serialization-based `Saver` |\n| `collectAsStateWithLifecycle()` | `collectAsState()` — it does **not** stop collecting in the background unless a lifecycle-aware variant is available in `commonMain` |\n| `LocalConfiguration` | not available; use `BoxWithConstraints` or the window-size-class APIs |\n| Layout Inspector, Macrobenchmark, Baseline Profiles | Android-only. Desktop profiles with JVM tooling; iOS with Instruments |\n| `painterResource(R.drawable.x)` | Compose Resources `Res.drawable.x`, per-module — see `.claude\u002Frules\u002Fkmp\u002Flocalization.md` |\n\nThe stability and phase model itself is identical across platforms; only the tooling differs.\n\n## Do NOT\n\n- Do NOT add `@Immutable` \u002F `@Stable` speculatively — under strong skipping, same-module classes with\n  stable properties are inferred stable already, and a false promise produces stale UI.\n- Do NOT `rememberSaveable` a runtime object (`LazyListState`, `FocusRequester`, a callback).\n- Do NOT build `Flow` pipelines (`stateIn`, `combine`, `flatMapLatest`) inside a composable body.\n- Do NOT run a scroll or animation suspend function from `viewModelScope`.\n- Do NOT hardcode placement (`fillMaxWidth`, fixed height, outer padding) on a reusable component's\n  root.\n- Do NOT nest a scrolling container inside a lazy list item.\n- Do NOT optimise without a measurement that names the axis.\n- Do NOT reach for `derivedStateOf` when the block reads no Compose `State` — it is pure overhead.\n\n## Error handling\n\n- **\"It recomposes too much\" with no measurement** → say so, and ask for the recomposition counts or\n  the compiler report first. Do not start annotating.\n- **A composable is reported skippable but still recomposes** → the defect is at the **call site**, not\n  the callee. Name the allocation (a fresh `List`, `Modifier` chain, or ad-hoc object per frame).\n- **The fix would be an `@Immutable` on a type with mutable non-snapshot fields** → refuse and fix the\n  type; that annotation causes silent stale UI.\n- **The behaviour depends on Compose version** → read `libs.versions.toml` and say which version the\n  answer assumes. Prefetch and cache-window APIs in particular moved recently.\n- **\"Gate stability in CI\", or a red `stabilityCheck`** → `references\u002Fstability-baselines.md`. Do not\n  hand this to `gradle-build-auditor` (it audits build structure, not Compose semantics) or to\n  `ci-cd-pipeline-builder` (it writes the pipeline; the compile-before-check ordering and the plugin's\n  Kotlin-version coupling are answered here).\n- **The question is really about layering or where the component lives** → point at\n  `.claude\u002Frules\u002Fkmp\u002Fuikit.md` or `feature-structure.md` and stop.\n\n## Example\n\n> \"The list stutters while scrolling and the row recomposes constantly.\"\n\n1. Read the screen and the row component; report how `items` is keyed and what the row's parameters\n   are.\n2. Name the axis. Fresh lambda or list allocated per scroll → stability. Animated or scroll-derived\n   value read in composition → phase.\n3. Check the item factory for an `indexOf` call — an O(n) lookup per item is O(n²) per scroll pass and\n   looks exactly like a recomposition problem.\n4. Apply the one matching fix — stable `key` + `contentType`, `remember(item.id)` for the per-item\n   lambda, or moving the read into `graphicsLayer { }`.\n5. Re-measure and report the before\u002Fafter numbers, not just \"it feels smoother\".\n\nExpected outcome: one named cause, one fix, and a measurement that shows the change.\n\n## Related Skills\n\n- `kmp-multiplatform-specialist` — Compose compiler config, resources, source sets\n- `kmp-testing` — Compose test dispatching, selectors, determinism\n- `koin-kmp` — obtaining the ViewModel a screen renders\n- `kotlin-specialist` — `Flow`, `StateFlow`, coroutine scope ownership\n- `kmp-ios-interop` — embedding UIKit\u002FSwiftUI inside Compose\n- `new-feature` — scaffolding the screen this UI lives in\n",{},"main","4ad702b3d4f403306c1a016277020693dd669f55","skills\u002Fcompose-multiplatform","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills","https:\u002F\u002Fgithub.com\u002FAstrumon","Software Engineer","2026-10-14 01:01:46",{"source":7,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add Astrumon\u002Fspovishun-skills --skill compose-multiplatform",{"tool":35,"command":36},"bunx","bunx skills add Astrumon\u002Fspovishun-skills --skill compose-multiplatform",{"tool":38,"command":39},"pnpm","pnpm dlx skills add Astrumon\u002Fspovishun-skills --skill compose-multiplatform","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002FSKILL.md",true,[43,49,53,57,61,65],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"manifest.yaml","REFERENCE","参考文档",2592,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002Fmanifest.yaml",{"path":50,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Flists-and-scrolling.md",4830,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002Freferences\u002Flists-and-scrolling.md",{"path":54,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fmodifiers-and-layout.md",5996,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002Freferences\u002Fmodifiers-and-layout.md",{"path":58,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fperformance-and-stability.md",11709,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002Freferences\u002Fperformance-and-stability.md",{"path":62,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fstability-baselines.md",9880,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002Freferences\u002Fstability-baselines.md",{"path":66,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fstate-management.md",9376,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-multiplatform\u002Freferences\u002Fstate-management.md",[70,76,82,89,94,99],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M74FX71JH2KNG5KX7TZHSKCB","universal-skill","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource\u002Fskills\u002Funiversal-skill\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M74FX57GTEFPJVCPWPSP6CCW","notion-skill","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource\u002Fskills\u002Fnotion-skill\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M74FX30F3K8906P5ASQ3DNXR","inline-frontmatter-skill","Hand-authored description that already lives in the body and must not be double-wrapped.","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource\u002Fskills\u002Finline-frontmatter-skill\u002FSKILL.md",[],[],{"skillNo":90,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M74FX18AGHM2KHQ502PMJZRJ","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource-v2\u002Fskills\u002Funiversal-skill\u002FSKILL.md",[],[],{"skillNo":95,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":18},"01M74FWZJ193G810P0ZJ1PKEZ9","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource-v2\u002Fskills\u002Fnotion-skill\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":18},"01M74FWPNEZWWGQ2Q37N6MMWP1","write-a-skill","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[],[]]