configuring-lazy-prefetch

Configures Jetpack Compose lazy-layout prefetch windows and nested prefetch to reduce scroll jank.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Heavy lazy lists in Jetpack Compose drop frames at high scroll velocity because items are composed too late or prefetch work piles into a single frame. This Skill guides you through measuring, configuring, and validating LazyLayoutCacheWindow and pausable prefetch so scrolling stays smooth. ## Core Features & Use Cases - Cache Window Tuning: Configure Dp-based ahead/behind extents with LazyLayoutCacheWindow (Compose Foundation 1.9+) plumbed through rememberLazyListState. - Pausable Prefetch & Nested Prefetch: Leverage Compose Foundation 1.10+ pausable composition by default and implement NestedPrefetchScope for rows hosting inner lazy layouts like HorizontalPager. - Measurement-Driven Workflow: Establish Macrobenchmark FrameTimingMetric baselines before and after changes, with strict rules against premature or bundled tuning. - Use Case: A feed of image-heavy rows stutters during fast flings. Measure p95/p99 frame times, add a 200.dp/100.dp cache window, re-measure, and confirm the jank disappears without memory regressions. ## Quick Start Ask the assistant to configure a LazyLayoutCacheWindow for your LazyColumn and validate the change with a Macrobenchmark FrameTimingMetric comparison.

Frequently Asked Questions about configuring-lazy-prefetch

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

FAQPage Schema
How do I configure a prefetch cache window for LazyColumn in Jetpack Compose?▼

Create a LazyLayoutCacheWindow with Dp-based ahead and behind values, pass it to rememberLazyListState(cacheWindow = ...), and give that state to LazyColumn. The window is not a parameter on LazyColumn itself, and every call site needs @OptIn(ExperimentalFoundationApi::class).

How do I fix dropped frames when scrolling a Compose lazy list?▼

First ensure items have stable keys, contentType, and skippable composables, then measure with Macrobenchmark FrameTimingMetric. Only widen the prefetch window if the baseline proves prefetch is the bottleneck; on Compose Foundation 1.10+ pausable prefetch is already on by default.

What Compose Foundation version supports LazyLayoutCacheWindow?▼

LazyLayoutCacheWindow requires Compose Foundation 1.9 or higher and is an @ExperimentalFoundationApi factory taking ahead and behind Dp values. Pausable composition in prefetch became the default behavior in Compose Foundation 1.10.

When should I not widen the lazy layout prefetch window?▼

Avoid widening when items are cheap and short, when item composables are unstable or non-skippable, or when measure/draw dominates rather than composition. Wide windows increase memory pressure and waste prefetched work on direction reversals without fixing the root cause.

Why does the first swipe on a HorizontalPager inside a LazyColumn stutter?▼

The outer prefetch only warms the row's outer composition, so the inner pager's first page composes on the user's first swipe. Implementing NestedPrefetchScope chains the work so the inner first page composes during the outer prefetch slot.