avoiding-subcomposition-pitfalls

Community

Prevent subcomposition pitfalls in Compose.

Authorskydoves
Version1.0.0
Installs0

System Documentation

What problem does it solve?

SubcomposeLayout, BoxWithConstraints, and nested Scaffolds can trigger composition during the measure pass, leading to extra layout work and a laggy first frame. This skill helps engineers identify when subcomposition is misused and replace it with cheaper primitives or tuning strategies to keep UI responsive.

Core Features & Use Cases

  • Detection: Identify hot paths where SubcomposeLayout or BoxWithConstraints trigger measure-phase recomposition.
  • Mitigation: Recommend alternatives like Modifier.onSizeChanged, layout modifiers, or hoisting constraints to reduce re-subcomposition.
  • Optimization patterns: Provide guidance for tuning SubcomposeLayout with SubcomposeLayoutState and SubcomposeSlotReusePolicy to reuse slots and precompose when appropriate.

Quick Start

Analyze the target screen to identify measure-phase recomposition caused by SubcomposeLayout or BoxWithConstraints, then implement the recommended substitutions to minimize re-composition.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: avoiding-subcomposition-pitfalls
Download link: https://github.com/skydoves/compose-performance-skills/archive/main.zip#avoiding-subcomposition-pitfalls

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 510,000+ vetted skills library on demand.