跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

kotlin-ui-adaptive-resources

Use when designing, implementing, or reviewing adaptive Compose UI for KMP or Android projects — window-size layouts, adaptive navigation, canonical layouts, multi-window support, and resource strategy.

mmiani · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add mmiani/kotlin-kmp-claude-agent-skills --skill kotlin-ui-adaptive-resources

技能说明


name: kotlin-ui-adaptive-resources description: Use when designing, implementing, or reviewing adaptive Compose UI for KMP or Android projects — window-size layouts, adaptive navigation, canonical layouts, multi-window support, and resource strategy. allowed-tools: Read, Grep, Glob license: Apache-2.0 metadata: author: Mariano Miani version: "1.1.0"

Adaptive UI and Resource Strategy

Use this skill when designing, implementing, or reviewing adaptive UI in a Compose-based project.

This skill is intentionally strict. Its purpose is to keep layouts resilient across display sizes, window sizes, orientations, fold states, and resizable environments while preserving clear UI architecture and avoiding fragile one-device assumptions.

Primary goals

The adaptive strategy should optimize for:

  • support for a wide range of display and window sizes
  • structured layout changes rather than ad hoc breakpoints
  • navigation chrome that adapts with available space
  • correct use of canonical multi-pane layouts where appropriate
  • resilience in split-screen, freeform, and desktop-style windowing
  • resource and presentation decisions that stay configurable
  • Compose layouts that remain understandable under adaptation pressure
  • previewability and testability across adaptive states

Do not treat “works on my phone” as sufficient. Adaptive UI should remain coherent when the window changes shape, size, or posture.


Official defaults to prefer

Unless the project has a strong reason not to, prefer:

  • responsive and adaptive UI that supports a wide range of screens and app window sizes
  • window size classes as the primary high-level breakpoint system
  • canonical layouts such as list-detail, feed, and supporting-pane when they fit the use case
  • adaptive navigation patterns that switch chrome based on available space
  • layouts that remain usable in multi-window mode and desktop-style windowing
  • resource and presentation values that stay configurable rather than hard-coded
  • Compose layouts whose modifier chains and measurement behavior remain explainable

Review dimensions

1. Adaptive mindset and target environments

Check whether the design explicitly supports:

  • phones
  • tablets
  • foldables
  • ChromeOS / large-screen environments
  • portrait and landscape
  • resizable windows
  • split-screen mode
  • desktop windowing / freeform windows where applicable

Flag as a concern when:

  • the design assumes one full-screen phone window shape
  • large-screen behavior is just stretched phone UI
  • resizable environments are ignored
  • adaptation is deferred until after feature implementation

2. Window size class strategy

Window size classes are the default high-level tool for adaptive decisions. In Compose, WindowWidthSizeClass and WindowHeightSizeClass (from the androidx.compose.material3.adaptive or androidx.window artifact) classify the current window into compact, medium, or expanded buckets. rememberWindowAdaptiveInfo() (from androidx.compose.material3.adaptive) is the current recommended API for querying the full adaptive context including window size and posture.

Check whether:

  • major layout decisions are driven by window size classes rather than raw dp breakpoints
  • rememberWindowAdaptiveInfo() or equivalent structured APIs are used at the root shell level
  • breakpoints are not reinvented casually without reason
  • navigation chrome and pane layout decisions are tied to structured size input
  • fine-grained layout work sits underneath, rather than replacing, size-class strategy

Flag as a concern when:

  • arbitrary pixel/dp thresholds replace standard size-class reasoning
  • different parts of the app use incompatible breakpoint logic
  • layout changes are too ad hoc to scale consistently
  • window-size queries are scattered across many composables instead of hoisted to the shell

3. Navigation adaptation

Adaptive navigation should change with available space.

Check whether:

  • bottom navigation, navigation rail, drawer, or other shell chrome are chosen intentionally based on window size
  • current destination tracking remains stable while the chrome changes
  • navigation adaptation is a shell concern rather than duplicated in every feature

Flag as a concern when:

  • phone navigation chrome is forced onto large layouts without reason
  • large-screen navigation is bolted on with special cases
  • shell adaptation and route state are tightly tangled

4. Canonical layout choice

Android’s canonical layouts are proven patterns for common use cases.

Check whether the design should use:

  • list-detail
  • supporting pane
  • feed-like or other canonical structures

Prefer canonical layouts when the product problem matches them.

Flag as a concern when:

  • bespoke layouts re-solve a standard list-detail or supporting-pane problem poorly
  • large-screen UI is over-customized without product value
  • canonical multi-pane opportunities are missed

5. List-detail behavior

For master-detail style problems, review whether list-detail behavior is properly adaptive.

Check whether:

  • compact windows can show one pane at a time
  • larger windows can present list and detail simultaneously
  • selection state and detail navigation remain coherent across size changes
  • back behavior still makes sense when moving between single-pane and multi-pane presentations

Flag as a concern when:

  • list-detail patterns are modeled as unrelated screens with no shared selection state
  • expanding to large layouts creates duplicated or conflicting detail logic
  • detail presentation is not resilient to resizing

6. Supporting-pane behavior

Supporting-pane layouts should be used when a secondary pane adds context or tools rather than acting like a full peer destination.

Check whether:

  • the supporting pane has a clear role
  • supporting content collapses gracefully when space is constrained
  • pane visibility and priority rules are explicit

Flag as a concern when:

  • supporting-pane content become
阅读完整来源 ↗