agentleFS
ariaraminariaramin/flutter-skills/skills/flutter-ui-performance-engineering/SKILL.md

flutter-ui-performance-engineering

Skill8 starsChanged 48 days agoMITView on GitHub

Diagnose, optimize, review, and validate Flutter UI smoothness across Android, iOS, Web, and desktop. Use when a task involves dropped or slow frames, bad frame pacing, input latency, scrolling or list lag, route or animation hitching, excessive rebuild/layout/paint/raster work, CustomPainter, blur/clipping/opacity/shadows, platform-view composition, oversized UI images, keyboard or resize jank, low-end device tuning, 90/120/144 Hz readiness, or a Flutter UI performance audit. Prefer this skill for end-to-end frame-pipeline and rendering work. Do not use for a memory leak with no UI symptom, image handling with no measured frame impact, isolate architecture with no UI bottleneck, or package-specific tuning when a dedicated skill covers it.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 11 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before advising or editing, inspect:

    line 14
  2. Distinctive:

    Run native targets in profile mode on physical hardware.

    line 44
  3. Very specific:

    Use build/layout/paint tracing, repaint rainbow, layer disabling, CPU profiling, or memory tooling only to test a specific hypothesis.

    line 53
  4. Distinctive:

    Keep the change only when the target metric materially improves without a correctness, accessibility, memory, thermal, or maintenance …

    line 57
  5. Distinctive:

    Never use debug-mode timing, average FPS, one lucky run, an emulator alone, or rebuild count alone as production evidence.

    line 60
  6. Very specific:

    Use 1000 / refreshRateHz as the approximate cadence interval.

    line 75
  7. Very specific:

    Keep network, database, parsing, sorting, and other significant work out of build() and frame-critical callbacks.

    line 80
  8. Very specific:

    Use lazy builders for large collections.

    line 85
  9. Distinctive:

    Use known item extents only when they are actually correct.

    line 87
  10. Very specific:

    Add RepaintBoundary only after repaint evidence and verify raster/memory impact.

    line 90
  11. Distinctive:

    Prefer transform- or paint-driven motion over repeated layout when the visual result and semantics allow it.

    line 94
  12. Distinctive:

    Stop or mute invisible continuous animations and respect reduced motion.

    line 96
  13. Distinctive:

    Do not recommend obsolete SkSL bundling or assume Impeller fixes arbitrary build, layout, paint, image, or composition work.

    line 101
  14. Distinctive:

    Never disable semantics, text scaling, reduced-motion handling, hit testing, or correctness as a performance shortcut.

    line 103
  15. Very specific:

    Read only the sections needed from references/production-guide.md.

    line 108
  16. Distinctive:

    If no trace or reproducible artifact exists, label the diagnosis as a hypothesis and request or define the smallest measurement that can …

    line 149
  17. Distinctive:

    Run the narrowest relevant formatting, analysis, and tests, then repeat the representative performance scenario.

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flutter UI Performance Engineering

Optimize the dominant measured work, not performance folklore. Preserve correctness, accessibility, visual intent, bounded memory, battery life, and maintainability.

Establish the runtime

Before advising or editing, inspect:

flutter --version
dart --version
pubspec.yaml and pubspec.lock
target platforms and minimum OS/browser versions
renderer/backend and platform views
target device tiers and refresh rates
existing performance tests, traces, and telemetry

The bundled guide was validated on 2026-08-11 against Flutter documentation in the Flutter 3.44.7 line and Dart 3.12.x. Treat scroll APIs, text scaling, Impeller, Web renderers/concurrency, platform views, DevTools, and image-cache defaults as version-sensitive. Prefer the installed SDK and package source when they differ.

Use the evidence loop

Follow this order:

reproduce → define metric → profile representative hardware
→ classify slow stage → identify dominant mechanism
→ make one bounded change → repeat identical trace
→ validate sustained load and release behavior
  1. Translate the complaint into a repeatable scenario and target metric.
  2. Run native targets in profile mode on physical hardware; use a profile Web build plus browser performance tooling for Web.
  3. Record the device, OS/browser, build mode, renderer, refresh cadence, data size, cache/network state, and interaction path.
  4. Capture a baseline with p90, p99, worst frames, and slow-frame count. Include memory or input-to-display latency only when relevant.
  5. Select slow frames and separate UI/build/layout/CPU time from raster/GPU time. Inspect FrameTiming.totalSpan when both bars look healthy but input still feels late.
  6. Use build/layout/paint tracing, repaint rainbow, layer disabling, CPU profiling, or memory tooling only to test a specific hypothesis; disable extra instrumentation for the final comparison.
  7. Change the largest contributor first, then repeat the same trace.
  8. Keep the change only when the target metric materially improves without a correctness, accessibility, memory, thermal, or maintenance regression.

Never use debug-mode timing, average FPS, one lucky run, an emulator alone, or rebuild count alone as production evidence.

Classify before changing code

EvidenceInvestigate first
UI time over budgetsynchronous Dart, broad invalidation, expensive build, intrinsic/repeated layout, collection work, text layout, allocation/GC
Raster time over budgetoversized images, blur/filter/saveLayer, opacity, clipping, shadows, paths, overdraw, large repaint regions, platform views
Both over budgetthe larger stage first, unless one mechanism clearly feeds both
Both within budget but input is latetotalSpan, event-loop stalls, native/plugin calls, event batching
Hitch as new rows appearlazy construction, row layout, decode/upload, cache policy
Degrades during a long sessionretained resources, image cache, allocation rate, GC, hidden animations
60 Hz passes but 120 Hz failsthe actual ~8.33 ms cadence and target hardware

Use 1000 / refreshRateHz as the approximate cadence interval. Do not treat 16 ms as universal, and do not simply add pipelined UI and raster durations.

Preserve these invariants

  • Keep network, database, parsing, sorting, and other significant work out of build() and frame-critical callbacks.
  • Remember that async/await does not move CPU work off the main isolate.
  • Scope state invalidation to the state that changed, but do not contort code to eliminate cheap rebuilds.
  • Use lazy builders for large collections; review large shrinkWrap scrollables, intrinsic layout, nested scrolling, eager children, and unbounded keep-alive.
  • Use known item extents only when they are actually correct.
  • Decode images near their rendered size where supported; keep precache and cache growth bounded.
  • Add RepaintBoundary only after repaint evidence and verify raster/memory impact; never blanket-wrap the tree.
  • Bound blur, clipping, shadows, alpha layers, complex paths, and animated paint area by their measured visual value.
  • Prefer transform- or paint-driven motion over repeated layout when the visual result and semantics allow it.
  • Stop or mute invisible continuous animations and respect reduced motion.
  • Dispose controllers, listeners, subscriptions, overlays, and other owned UI resources at the correct lifecycle boundary.
  • Move genuinely heavy CPU work to an isolate only when saved main-isolate time exceeds spawn, transfer, and coordination cost. Revalidate Web support.
  • Do not recommend obsolete SkSL bundling or assume Impeller fixes arbitrary build, layout, paint, image, or composition work.
  • Never disable semantics, text scaling, reduced-motion handling, hit testing, or correctness as a performance shortcut.

Route to the production guide

Read only the sections needed from references/production-guide.md. Locate them before loading long ranges:

rg -n '^#{1,3} (SEARCH HEADING)$' references/production-guide.md
TaskSearch headings
Establish frame model and budgets`Flutter Frame PipelineFrame BudgetsRefresh RateFrame-Time TargetsFrame Pacing vs FPSProduction Frame MetricsJank Classification`
Profile and instrument`Required Performance Decision TreeProfiling Workflow — HIGH PRIORITYPerformance InstrumentationFrameTiming`
Reduce build/state work`Build OptimizationsetStateState ManagementSelectors / Granular SubscriptionsconstWidgets vs Helper FunctionsKeysMediaQuery Granularity`
Reduce layout and scrolling work`Layout OptimizationIntrinsic LayoutshrinkWrapNested Scroll Anti-PatternScrolling — HIGH PRIORITYLazy ListsitemExtentscrollCacheExtentKeepAliveSliversPagination`
Reduce paint/raster work`Paint OptimizationRepaintBoundarysaveLayerOpacityClippingBlur — HIGH PRIORITYShadows and ElevationCustomPainterCanvas Hot PathsGPU Overdraw`
Tune animation and routes`Animation PerformanceAnimationController LifecycleTickerModeTransform vs Layout AnimationAnimatedBuilder / ListenableBuilderInfinite AnimationsRoute TransitionsHero`
Diagnose images, text, or CPU`Images — HIGH PRIORITYOversized Image ProblemImage Cache TuningText PerformanceCPU Work on the Main IsolateIsolatesGarbage Collection and Allocation`
Diagnose lifecycle/input/native composition`Memory and Long-Session JankResource LifecycleInput and Gesture PerformanceKeyboard OpeningPlatform ChannelsPlatform Views — HIGH PRIORITY`
Handle a specific platform/runtime`ImpellerWeb PerformanceAndroid PerformanceiOS PerformanceDesktop PerformanceHigh Refresh RateLow-End Device StrategyAdaptive Quality`
Audit, review, or verify a release`Performance Rules — HIGH PRIORITYAnti-PatternsOptimization Priority Ladder120 Hz Readiness ChecklistUI Performance Audit ChecklistCode Review ChecklistProduction Readiness ChecklistVersion-Sensitive Areas`

For a broad audit, read the guide's principles, decision tree, profiling workflow, optimization priority ladder, relevant platform section, audit checklist, and version-sensitive areas. Read the entire guide only when the request genuinely spans the whole UI pipeline.

Fix the shared cause

Trace every caller and owner of the expensive path before editing. Prefer one fix at the lifecycle, state, data, layout, or paint boundary shared by all affected callers over guards in individual widgets. Reuse the project's state, rendering, image, and lifecycle patterns. Do not switch state-management packages, add a global performance abstraction, or introduce a dependency without measured necessity.

Report each recommendation as:

evidence → bottleneck stage → mechanism → smallest change
→ expected metric → verification scenario → tradeoff

If no trace or reproducible artifact exists, label the diagnosis as a hypothesis and request or define the smallest measurement that can confirm it.

Validate the result

Run the narrowest relevant formatting, analysis, and tests, then repeat the representative performance scenario. Cover the affected paths:

  • first and repeated interactions;
  • sustained scrolling/animation and route cycles;
  • keyboard, resize, rotation, background/resume, or platform views when used;
  • realistic data and images;
  • lowest supported hardware tier;
  • target 90/120/144 Hz hardware where promised;
  • reduced motion and text scaling;
  • memory stability and idle frame scheduling for long-lived UI;
  • release build behavior after profile-mode diagnosis.

State which devices, browsers, build modes, and traces were not validated. Do not claim a performance improvement from static analysis or code shape alone.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.