ronjunevaldoz/kmp-agent-skills/kmp-compose-adaptive-layout
Claude Code and agent skill by ronjunevaldoz/kmp-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Adaptive UI for Kotlin Multiplatform — WindowSizeClass-driven layouts that respond correctly to Compact (phone), Medium (tablet), and Expanded (desktop) breakpoints. Covers list-detail splits, adaptive navigation (bottom bar → rail → drawer), single-source WindowSizeClass propagation, and Roborazzi tests for each breakpoint. Enforces cross-session pattern consistency so every screen in the project uses the same adaptive strategy.
Install
npx vskill@latest install ronjunevaldoz/kmp-agent-skills/kmp-compose-adaptive-layoutSKILL.md
The same SKILL.md was published earlier as ronjunevaldoz/kmp-agent-skills/kmp-compose-adaptive-layout.
When to Use This Skill
Use when:
- Implementing any screen that needs a different layout on phone vs tablet vs desktop
- Adding list-detail (master-detail) split navigation
- Adapting navigation chrome (bottom bar → rail → drawer)
- A new session is started after adaptive layout was already established — check the
existing pattern before writing new screens
- The reviewer flags
[ADAPTIVE] inconsistency— one screen uses WindowSizeClass, a
newly added screen does not
Trigger keywords: adaptive layout, responsive layout, WindowSizeClass, ListDetailPane, tablet layout, desktop layout, mobile layout, phone layout, split screen, detail split, list detail, side panel, navigation rail, navigation drawer, window size, Compact Medium Expanded, adaptive navigation, calculateWindowSizeClass, different layout phone tablet, different layout phone desktop, responsive composable, multi-pane layout, master detail KMP, pane layout, screen size breakpoint, layout per screen size, detect all screen layouts, all screen sizes, page layout, layout consistency, consistent layout, screen consistency, redesign page, layout redesign, page consistency, uniform layout, layout patterns, FlexBox, CSS flexbox, flex container, flex item, flex wrap, flex grow, flex shrink, flex basis, justifyContent, alignItems, alignContent, Modifier.flex, wrapping row, wrapping layout, chip wrap layout.
Freshness rule: material3-adaptive is still evolving — recheck the API when upgrading androidx.compose.material3.adaptive. calculateWindowSizeClass() moved packages between CMP releases; verify the import against the current version in libs.versions.toml.
Compose Layout Fundamentals
- https://developer.android.com/develop/ui/compose/layouts — official Compose layout overview; use this before picking a container or custom pattern
- https://developer.android.com/develop/ui/compose/layouts/adaptive/get-started-with-adaptive-apps — official adaptive-app entry point for phones, tablets, foldables, and other form factors
- https://developer.android.com/develop/ui/compose/layouts/adaptive/canonical-layouts — canonical adaptive layout patterns for list-detail, supporting pane, and related responsive structures
- https://developer.android.com/develop/ui/compose/layouts/adaptive/build-adaptive-navigation — adaptive navigation patterns for bottom bar, rail, drawer, and multi-pane navigation shells
- https://developer.android.com/develop/adaptive-apps/guides/flexbox — FlexBox overview: an experimental CSS-flexbox-equivalent container for responsive, wrapping, single-axis layouts
- https://developer.android.com/develop/adaptive-apps/guides/flexbox/get-started — FlexBox setup (
foundation-layoutdependency) and first layouts - https://developer.android.com/develop/adaptive-apps/guides/flexbox/container-behavior —
FlexBoxConfigproperties:direction,wrap,justifyContent,alignItems,alignContent,gap - https://developer.android.com/develop/adaptive-apps/guides/flexbox/item-behavior —
Modifier.flexproperties:basis,grow,shrink,alignSelf,order - https://developer.android.com/develop/ui/compose/layouts/custom — official custom-layout guide; use when built-in containers are not enough
Layout fundamentalsin the Compose docs covers the base mental model forBox,Row,Column,Spacer, modifiers, and constraintsLayout containersandAdvanced and custom layoutsin the same doc tree cover lazy lists/grids, flow layouts, custom layouts, alignment lines, and intrinsic measurement
FlexBox — experimental CSS-flexbox-equivalent container
FlexBox (androidx.compose.foundation.layout, @ExperimentalFlexBoxApi) is a single-axis container that wraps, grows, and shrinks items to fill available space — modeled directly on the CSS Flexible Box spec. It is a layout primitive, not a WindowSizeClass replacement: use it inside a breakpoint branch (or any composable) when a row/column of items needs to reflow, not to decide the breakpoint itself.
When to reach for it:
- A small-to-medium set of items (chips, tags, action buttons, badges) that should wrap onto
new lines when space runs out
- Items with different grow/shrink weights on the same axis — cheaper than a manual
Row + weight() + conditional wrap logic
- Not for: large/lazy datasets (use
LazyRow/LazyColumn/LazyGrid) or overall screen
structure (use the WindowSizeClass patterns above, or Grid)
Setup
Container config (FlexBoxConfig)
Item config (Modifier.flex)
grow/shrinkare proportional, like CSS: an item withgrow(2f)takes twice the extra
space of a sibling with grow(1f).
basissets the pre-distribution size; if it's smaller than the item's intrinsic minimum,
the intrinsic minimum wins.
- Still experimental — annotate call sites with
@OptIn(ExperimentalFlexBoxApi::class)and
recheck the API shape when bumping the Compose Foundation version, same as any other @Experimental* surface in this repo.
Recommendation First
Calculate WindowSizeClass once at the app root and pass it down as a parameter. Never call calculateWindowSizeClass() inside a leaf composable — it re-reads window metrics on every recomposition and makes components impossible to preview or test in isolation.
Why:
- A single read at the root means every screen snapshot test can supply a fake
WindowSizeClass — no device, no emulator
- Passing as a parameter makes the layout decision visible in the call site — you can
read a composable signature and immediately know it is adaptive
- Centralising the calculation prevents two screens from disagreeing on the breakpoint
because they each read at a different recomposition moment
Cross-session pattern consistency
Before implementing a new screen, run:
If any file matches, the adaptive pattern is already established. Read one of those files and replicate the exact same:
WindowSizeClassparameter name and position in the screen signature- Breakpoint switch structure (
when (windowSizeClass.widthSizeClass)) - Helper layout composable naming (
FooContentCompact,FooContentMedium,
FooContentExpanded)
Never introduce a second pattern in the same project.
If nothing matches, establish the pattern using the template below and update .agents/pipeline-context.json:
Retrofitting an existing project
If the project already has many screens without WindowSizeClass, retrofitting all of them in one session is impractical. Use migration mode to avoid being blocked:
- Set
adaptive_layout_migration_mode: truein.agents/pipeline-context.jsonand commit it - The reviewer will warn (not block) on pre-existing screens and only enforce the full
rule on screens created or modified in the current session
- Track the remaining screens as a follow-up ticket
- Once all screens are migrated, set
adaptive_layout_migration_mode: falseand commit
Core pattern — screen structure
List-detail split (Expanded)
Adaptive navigation
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/kmp-compose-adaptive-layout/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ronjunevaldoz/kmp-agent-skills/kmp-compose-adaptive-layout)