/scroll-spy:optimize-scroll-spy-performancefrom ScrollSpy Assistant
Optimizes Flutter scroll_spy performance by diagnosing rebuild storms and guiding subscription choices (ScrollSpyItem vs Lite, listeners, snapshots).
Ships in ScrollSpy Assistant. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Get the cost model right first: the engine's compute pass is tens of microseconds even with hundreds of mounted items (O(1) cached arithmetic per item on the hot path, allocation-free, no render-tree walks). Measurable scroll cost in an app almost always comes from widget rebuilds you subscribed to, not from the engine. Optimize subscriptions, not the engine.
ScrollSpyPrimaryListener, ScrollSpyItem*Listener):
side effects with zero rebuilds. Correct for play/pause, analytics,
haptics, prefetch.ScrollSpyItemLite,
ScrollSpyItem{Primary,Focused,Visible}Builder): rebuild only when a
flag flips. Correct for highlights, badges, borders.ScrollSpyItem, ScrollSpyItemFocusBuilder):
rebuild whenever metrics drift past tolerance, which during scrolling
means nearly every frame. Reserve for items that genuinely animate from
focusProgress/visibleFraction.controller.snapshot, ScrollSpySnapshotBuilder):
notifies every compute pass and materializes the full immutable frame.
One dashboard-style consumer at most; never one per item.The engine bills only for what is consumed: with no snapshot listeners no snapshot is materialized; per-item notifiers are created lazily, updated diff-only, and auto-evicted. An unheard signal costs nothing, so the win comes from moving consumers down this ladder, not from removing scroll_spy.
ScrollSpyItem whose builder only uses isPrimary/
isFocused to ScrollSpyItemLite.child:; the builder wraps
child and never reconstructs the card. Confirm the static part is
genuinely const/stable.setState.snapshot listeners; threshold scans (impressions) use one
snapshot listener for the whole screen, or per-item boolean listeners.debug: false and includeItemRectsInFrame unset in release paths
(rect capture allocates per item per pass; debug frames are gated but the
overlay itself repaints).perFrame is not a CPU problem; but if metric
subscriptions (ladder rung 3) must exist and flings rebuild too much, use
ScrollSpyUpdatePolicy.hybrid(ballisticInterval: 50ms) to throttle
ballistic recomputes, or onScrollEnd when only settled state matters.
These change semantics (staleness mid-scroll), so state the tradeoff.
Store non-const policies in fields (no ==; inline construction churns
engine config every rebuild).ScrollSpyRegion.custom allocates
by design.flutter run --profile).debugPrint in one item builder or use
DevTools "Track widget builds"; with the ladder applied, boolean items
rebuild only on flips (a handful per scroll), never per frame.ScrollSpyItemLite.
Its own perf regression test (test/perf/compute_pass_benchmark_test.dart
in the package repo) documents expected compute-pass magnitudes.Report what moved down the ladder, before/after frame times or rebuild counts, and any semantic tradeoffs (update policy changes).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/convert-visibility-detector-to-scroll-spyUse when replacing the visibility_detector package with scroll_spy in a Flutter app, when migrating VisibilityDetector, VisibilityInfo, or VisibilityDetectorController code, or when a VisibilityDetector-based feed additionally needs a single stable primary item, per-item focus metrics, or scroll-performance improvements./diagnose-scroll-spyUse when scroll_spy misbehaves in a Flutter app and the cause is unknown: primaryId stays null, focusedIds stays empty, listeners or builders never fire, focus ignores jumpTo or programmatic scrolls, the highlighted item is offset under a pinned header or app bar, state resets on setState, nested scrollables interfere, or a widget test reads null focus state./integrate-scroll-spyUse when adding the scroll_spy Flutter package to a screen or feature: autoplay video feeds, current-item tracking, reading-position or TOC highlighting, impression analytics, carousels or PageViews, photo grids, prefetching around the focused item, or wiring ScrollSpyScope, ScrollSpyItem, and ScrollSpyController for the first time, including widget tests for that integration. Not for scrolling work unrelated to focus or visibility tracking (saving/restoring scroll offsets, scroll physics, scroll-to-index)./migrate-scroll-spy-v0-to-v1Use when upgrading a Flutter project from scroll_spy 0.1.x or 0.2.x to 1.x, when a build breaks after a scroll_spy upgrade with unresolved names such as ScrollSpyRegistry, ScrollSpyGeometry, ScrollSpySelection, ScrollSpyDiff, or commitFrame, or when estimating how much work the 0.x to 1.x upgrade needs./migrate-scroll-spy-v1-to-v2Upgrade an existing scroll_spy 1.x integration to 2.x, including SDK constraints and optional ScrollCacheExtent migration. Use for 1.x-to-2.x upgrades or SDK resolution failures after that upgrade./tune-scroll-spy-stabilityUse when scroll_spy selects the right things but behaves badly over time: the primary item flickers or alternates between two items, switches too eagerly or too sluggishly, stutters at card boundaries in autoplay, goes null between items or during fast scrolls, sticks to an old item too long, or updates at the wrong moments (mid-drag versus after settling).npx claudepluginhub omar-hanafy/scroll_spy --plugin scroll-spyOther plugins' skills for the same job