paging

Implements paginated lists in Android and Compose with Paging 3 PagingSource, Pager, and LazyPagingItems.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill paging-w0lzard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: paging
Source: https://github.com/w0lzard/Wolzard-s-Marketplace/tree/main/plugins/personal-skills/skills/paging
Command: npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill paging-w0lzard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building infinite-scroll lists in Android with Paging 3 involves subtle pitfalls — misplaced cachedIn calls, PagingData embedded in UiState, missing item keys, and untestable paging flows — that cause scroll jumps, cache leaks, and broken UI state. ## Core Features & Use Cases - PagingSource and Pager setup: Defines per-endpoint PagingSource implementations with correct LoadResult handling, PagingConfig tuning, and the dual-flow ViewModel rule separating Flow<PagingData> from StateFlow<UiState>. - Compose integration: Wires LazyPagingItems into LazyColumn with itemKey, itemContentType, and loadState-driven loading and error footers. - Offline-first and testing: Implements RemoteMediator with Room transactions for offline-first lists, dynamic filters via flatMapLatest, and unit tests using TestPager and asSnapshot. - Use Case: You are adding an infinite-scroll repository search screen to a Compose app. Use this Skill to scaffold the PagingSource, ViewModel paging flow with debounced query filters, LazyColumn UI with stable keys, and ViewModel tests that scroll to index 30 via asSnapshot. ## Quick Start Use the paging skill to implement an infinite-scroll list in my Compose app backed by a Retrofit endpoint, including the ViewModel paging flow and LazyColumn UI.

Frequently Asked Questions about paging

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

FAQPage Schema
How do I implement infinite scroll in Jetpack Compose with Paging 3?

Create a PagingSource per endpoint, expose a Flow<PagingData> from the ViewModel via Pager with cachedIn(viewModelScope), and collect it in Compose with collectAsLazyPagingItems. Render items in LazyColumn using pagingItems.itemKey with a stable domain ID.

How to add search filters to a Paging 3 flow in Android?

Combine debounced, distinctUntilChanged filter StateFlows and use flatMapLatest to rebuild the Pager when filters change. Place cachedIn after flatMapLatest so it caches the final Flow<PagingData>, not a flow-of-flows.

Does Paging 3 support Kotlin Multiplatform?

KMP support in androidx.paging is Android-only as of version 3.5.0, with multiplatform support on the roadmap. The paging-common artifact can still be used in a framework-agnostic domain module since it has no Android dependencies.

Why does my LazyColumn scroll position jump when paging refreshes?

Scroll jumps happen when LazyColumn items lack stable keys, so prepended pages shift every item's positional identity. Fix it by passing key = pagingItems.itemKey { it.id } with a stable domain ID and a meaningful itemContentType.

How do I test a PagingSource and paging ViewModel?

Use TestPager from paging-testing to assert LoadResult pages for a PagingSource, and Flow<PagingData>.asSnapshot { } for ViewModel tests. Never call .first() or .toList() on a paging flow since it is hot and never completes.

When should I use RemoteMediator with Paging 3?

Use RemoteMediator for offline-first lists where Room is the PagingSource and the network refreshes the database. Wrap DB writes in withTransaction, clear state on LoadType.REFRESH, and observe loadState.source.refresh so the spinner persists until Room writes finish.