JetBrains/intellij-community / .claude/skills/compose-ui
compose-ui
VerifiedWrite or audit Compose Desktop UI state, effects, and boundaries.
audit/references/subcomposition/subcomposition-decision-tree.md
View on GitHub# Subcomposition Decision Tree
## What is subcomposition?
Subcomposition runs `@Composable` functions during the layout/measure phase instead of the normal
composition phase. It is necessary when the UI structure depends on measurements that are only
known at layout time.
## Common APIs that use subcomposition
| API | Uses subcomposition | Typical reason |
|-----|--------------------|---------------|
| `BoxWithConstraints` | Yes | Exposes `maxWidth`/`maxHeight` to composable body. |
| `SubcomposeLayout` | Yes | Full control over composition inside measure. |
| `SwingPanel` | Yes | Embeds Swing components sized by Compose layout. |
| `LazyColumn`/`LazyRow` | Yes internally | Items are composed on demand based on viewport. |
| `AndroidView` | N/A on Desktop | Not applicable. |
## Decision tree
```
Does the UI structure depend on measured size?
├── No → Use standard modifiers (Column, Row, Box, padding, weight)
│
└── Yes
├── Is it just breakpoints (compact/medium/expanded)?
│ ├── Can breakpoints be derived from window state? → Read LocalWindowInfo.current.containerSize
│ │ (convert pixels→Dp via LocalDensity); use derivedStateOf for the breakpoint value
│ └── Must depend on parent container size? → BoxWithConstraints is acceptable
│
├── Is it intrinsics (text wrapping around image, etc.)?
│ └── Yes → SubcomposeLayout is the correct tool
│
└── Is it Swing interop?
└── Yes → SwingPanel (unavoidable subcomposition)
```
## Rules
- **Never** use `BoxWithConstraints` for simple conditional values that can be computed from
external state.
- **Always** justify `SubcomposeLayout` with a specific intrinsics or two-pass need.
- **Accept** `SwingPanel` subcomposition for Swing interop, but minimise factory recreation.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |