ordering-modifier-chains

Diagnose and fix Jetpack Compose Modifier ordering bugs affecting paint, click, clip, and layout behavior.

Updated May 31, 2026
One-click install
npx skills add https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat --skill ordering-modifier-chains-decoutkhanqindev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ordering-modifier-chains
Source: https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat/tree/main/.claude/skills/ordering-modifier-chains
Command: npx skills add https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat --skill ordering-modifier-chains-decoutkhanqindev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Jetpack Compose Modifier order changes what your UI actually does — backgrounds paint in the wrong region, click areas leak past visible buttons, clips fail to round corners, and graphicsLayer alpha applies to the wrong subtree. This Skill teaches how to read a Modifier chain top-to-bottom and reorder it correctly. ## Core Features & Use Cases - Chain Reading Model: Explains the wrap-the-next-modifier mental model so each modifier's effect on everything below it is predictable. - Canonical Reorder Patterns: Covers padding vs background, clickable placement for touch targets, clip before background, graphicsLayer scope, and size vs padding semantics. - Anti-Pattern Guardrails: Prevents hoisting Modifier chains via remember without FrameTimingMetric evidence, and blocks Modifier.composed workarounds. - Use Case: A developer reports that a button's ripple fires in the surrounding padding. The Skill identifies that clickable sits below padding in the chain and reorders it so the hit area matches the design intent. ## Quick Start Ask the assistant to review your Compose Modifier chain and explain why the background, click area, or clip is behaving incorrectly, then apply the correct ordering.

Frequently Asked Questions about ordering-modifier-chains

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does Modifier order matter in Jetpack Compose?▼

Each Modifier wraps everything below it in the chain, so order determines which bounds each effect applies to. For example, padding before background shrinks the painted region, while background before padding fills the full bounds first.

How do I fix a Compose clickable area that extends past the visible button?▼

Move clickable below padding in the chain so its hit region matches the visible content area. If you want the padded area tappable for the 48dp accessibility touch target, place clickable above the visual padding instead.

Should I use clip before or after background in Compose?▼

Place clip before background so the background paint is clipped to the shape. Alternatively, use Modifier.background(color, shape) which handles clipping and filling in a single modifier and avoids the ordering question.

Does remembering a Modifier chain improve Compose performance?▼

Rarely. Compose already interns structurally-equal Modifier chains, so remember { Modifier... } saves at most one allocation per recomposition. Only hoist after a FrameTimingMetric macrobenchmark on a release build shows a measurable regression.

Why does graphicsLayer alpha not fade my Compose background?▼

graphicsLayer wraps only the modifiers below it, so a background placed above it stays fully opaque. Move graphicsLayer to the top of the chain so alpha applies to the entire visual subtree including the background.