Skip to content

JetBrains/intellij-community / .claude/skills/compose-ui

compose-ui

Verified

Write or audit Compose Desktop UI state, effects, and boundaries.

FileKindSize
OWNERSHIPother20 B
SKILL.mdskill md637 B
architecture/GUIDE.mdmarkdown5.7 KB
architecture/evals/evals.jsonconfig6.5 KB
architecture/references/animation.mdmarkdown11.3 KB
architecture/references/component-api-lists-performance.mdmarkdown4.1 KB
architecture/references/desktop-seams-review-output.mdmarkdown1.5 KB
architecture/references/effects.mdmarkdown1.7 KB
architecture/references/state-boundaries.mdmarkdown5.4 KB
architecture/skill-source.jsonconfig2.0 KB
audit/GUIDE.mdmarkdown14.1 KB
audit/evals/evals.jsonconfig18.1 KB
audit/references/api-hygiene.mdmarkdown8.8 KB
audit/references/audit-search-patterns.mdmarkdown3.9 KB
audit/references/boundary-violations.mdmarkdown3.3 KB
audit/references/effects/derived-state-of-guide.mdmarkdown2.2 KB
audit/references/effects/effect-selection-guide.mdmarkdown2.7 KB
audit/references/effects/infinite-loop-patterns.mdmarkdown2.6 KB
audit/references/effects/overview.mdmarkdown7.7 KB
audit/references/lazy-layouts/animate-item.mdmarkdown2.0 KB
audit/references/lazy-layouts/cache-window-and-prefetch.mdmarkdown3.2 KB
audit/references/lazy-layouts/desktop-scroll-measurement.mdmarkdown2.0 KB
audit/references/lazy-layouts/keys-and-content-type.mdmarkdown2.2 KB
audit/references/lazy-layouts/nested-lazy-layouts.mdmarkdown1.6 KB
audit/references/lazy-layouts/overview.mdmarkdown7.5 KB
audit/references/measurement/benchmarking-methodology.mdmarkdown1.9 KB
audit/references/measurement/overview.mdmarkdown5.5 KB
audit/references/measurement/profiler-setup.mdmarkdown2.5 KB
audit/references/modifiers/custom-modifier-node.mdmarkdown3.4 KB
audit/references/modifiers/modifier-order.mdmarkdown2.1 KB
audit/references/modifiers/overview.mdmarkdown7.4 KB
audit/references/modifiers/phase-deferral.mdmarkdown2.6 KB
audit/references/reporting-guidance.mdmarkdown2.3 KB
audit/references/stability/ci-stability-gate.mdmarkdown2.0 KB
audit/references/stability/desktop-measurement.mdmarkdown2.2 KB
audit/references/stability/overview.mdmarkdown7.6 KB
audit/references/stability/reading-classes-txt.mdmarkdown2.1 KB
audit/references/stability/reading-composables-txt.mdmarkdown1.9 KB
audit/references/stability/stabilising-types.mdmarkdown3.1 KB
audit/references/stability/stability-config-syntax.mdmarkdown1.6 KB
audit/references/stability/stability-inference-algorithm.mdmarkdown3.4 KB
audit/references/stability/strong-skipping-escape-hatches.mdmarkdown2.6 KB
audit/references/subcomposition/desktop-subcomposition-measurement.mdmarkdown1.7 KB
audit/references/subcomposition/overview.mdmarkdown7.2 KB
audit/references/subcomposition/subcomposition-decision-tree.mdmarkdown1.8 KB
audit/references/subcomposition/swing-panel-subcomposition.mdmarkdown1.8 KB
audit/references/tracing-setup.mdmarkdown5.3 KB
audit/references/tracing-usage.mdmarkdown6.3 KB
audit/skill-source.jsonconfig2.5 KB

architecture/references/component-api-lists-performance.md

View on GitHub
# Component API, Lists, And Performance

Use this reference when UI work touches reusable composable APIs, modifier handling, lazy lists, recomposition behavior,
object churn, animations, or performance-sensitive composition.

## Modifier And Component API Contract

For reusable UI:

```kotlin
@Composable
fun ExampleCard(
    model: ExampleCardModel,
    onOpen: () -> Unit,
    modifier: Modifier = Modifier,
    trailingContent: (@Composable () -> Unit)? = null,
) { ... }
```

Rules:

- Required data and callbacks first.
- `modifier: Modifier = Modifier` is the first optional parameter.
- Slot lambdas last; primary slot is named `content` when present.
- Forward `modifier` to the outermost layout-producing call.
- Chain internal modifiers after caller `modifier`.
- Do not expose `MutableState<T>` in reusable component APIs. Prefer value + `onXxxChange` or a dedicated state holder.
- Do not pass presenters/coordinators into leaf components. Pass view models and callbacks.
- Compose skips a call when its inputs are stable and equal. Prefer primitives, `String`, lambdas, `@Immutable` data
  classes, and `@Stable` state holders. Pass the few fields a component needs, not an interface or a mutable collection.

## Lazy Lists

- Use stable, unique keys for items that can move, be inserted, be removed, or stream in.
- Use `contentType` for heterogeneous rows so Compose can reuse compatible item compositions.
- Never use list index as a key for reorderable/dynamic data.
- Verify key uniqueness when rows merge data from multiple sources.
- A plain loop over items with internal state or effects needs `key(item.id) { ... }` too. Identity is the call
  site, so without a key a reorder moves state to the wrong item.

Common examples that should be key/content-type aware include timeline rows, message/log rows, sidebar rows,
settings/provider rows, permission cards, and generated lists of tools, plans, or knowledge items.

## Performance Smells To Check

Flag and fix when touched:

- file/DB/network/process/config reads in composition
- JSON parsing in composition
- Move `filter`, `map`, `groupBy`, and `sortedBy` collection chains out of hot composable bodies.
- Markdown parsing, permission payload parsing, model filtering, or command/menu construction runs in composition when
  it can be projected by a presenter/coordinator.
- Avoid rebuilding `listOf(...)`, `mapOf(...)`, fresh UI models, or anonymous objects on every composition and passing
  them to child composables.
- Replace broad app or session state reads in composables with presenter-projected view models.
- Combine multiple flows in the presenter instead of collecting them independently when their values must stay coherent
  on screen.
- `mutableStateOf<Int|Long|Float|Double>` instead of typed primitive factories
- `Animatable(...)` created without `remember` or hoisting
- Run target-driven animations inside `LaunchedEffect(target)` instead of launching them from the composition body or an
  event scope.
- Infinite animations are hosted in surfaces that remain composed while hidden or offscreen.
- animated values passed to `Modifier.offset(x = ...)`, `alpha`, `rotate`, or `scale` when `offset { ... }` or
  `graphicsLayer { ... }` can defer per-frame reads to layout/draw
- `Modifier.composed { ... }` for new custom modifiers when `Modifier.Node` or a plain modifier factory is enough

## Healthy Patterns To Preserve

Do not refactor these just because they use Compose state/effects:

- Keep `remember { MutableInteractionSource() }` and derived hover or press state inside the composable for visual
  feedback.
- Keep `FocusRequester` paired with `LaunchedEffect(Unit) { requestFocus() }` when focusing a newly shown editor.
- Local text-field/editing state that is committed through callbacks.
- Keep UI-only expanded or collapsed toggle state in the composable when it does not mirror persisted settings.
- Demo/debug entries that build sample state locally, as long as production code keeps protocol/runtime work behind the
  real owning seam.
- Composition executing a scroll/focus/dialog command returned by a state holder or presenter event.

If a pattern is healthy, say so briefly and move on; do not manufacture a refactor.
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall