PluginBench
Skill
Pass
Audit score 90

fixing-motion-performance

ibelick/ui-skills

Audit and fix animation performance issues—layout thrashing, compositor properties, scroll-linked motion, and blur effects.

What is fixing-motion-performance?

Identifies and resolves animation performance problems including layout thrashing, inefficient rendering paths, and scroll-linked motion anti-patterns. Use when animations stutter, transitions jank, or when reviewing CSS/JS animation code for optimization opportunities.

  • Detects layout thrashing and interleaved DOM reads/writes in animations
  • Validates compositor-safe properties (transform, opacity) vs. paint-heavy alternatives
  • Reviews scroll-linked motion for polling anti-patterns and recommends Scroll/View Timelines
  • Audits blur and filter animations for size and duration constraints
  • Checks will-change usage, layer promotion, and animation system mixing
  • Applies FLIP-style measurement patterns and batching strategies

How to install fixing-motion-performance

npx skills add https://github.com/ibelick/ui-skills --skill fixing-motion-performance
Claude Code
Cursor
Windsurf
Cline

How to use fixing-motion-performance

  1. 1.Run `/fixing-motion-performance` to apply constraints to all animation work in the conversation
  2. 2.Run `/fixing-motion-performance <file>` to review a specific file and receive violations with exact line quotes, impact explanation, and concrete code fixes
  3. 3.Reference the rule categories (never patterns, measurement, scroll, paint, layers, blur/filters) when deciding between animation techniques
  4. 4.Use the rendering steps glossary (composite, paint, layout) to understand which properties trigger expensive work

Use cases

Good for
  • Fixing janky CSS transitions and WAAPI animations that cause frame drops
  • Refactoring scroll-linked reveal-on-scroll effects to use Scroll Timelines instead of polling
  • Auditing large component animations to replace layout/paint work with transform-based motion
  • Reviewing blur and filter animations to ensure they stay small and one-time only
  • Validating animation code during component refactors to prevent performance regressions
Who it's for
  • Frontend engineers optimizing animation performance
  • UI developers implementing scroll-linked or interaction-driven motion
  • Code reviewers checking animation patterns in CSS and JavaScript
  • Teams using CSS, WAAPI, Motion, rAF, or GSAP for animations

fixing-motion-performance FAQ

Should I migrate to a different animation library to fix performance?

No. Apply these rules within your existing animation system (CSS, WAAPI, Motion, rAF, GSAP). Do not migrate libraries unless explicitly requested.

What's the difference between composite, paint, and layout?

Composite (transform, opacity) is cheapest. Paint (color, borders, gradients, filters) is more expensive. Layout (size, position, flow) is most expensive and can trigger cascading recalculations.

When is it okay to animate paint or layout properties?

Only on small, isolated elements. One-shot effects are acceptable more often than continuous motion. For larger surfaces, prefer downgrading the technique (e.g., use transform instead of width) rather than removing motion entirely.

How do I fix scroll-linked animations that poll scroll position?

Replace `window.addEventListener('scroll', ...)` with Scroll Timelines or View Timelines when available. Use IntersectionObserver to pause animations when off-screen.

What's the FLIP pattern and when should I use it?

FLIP (First, Last, Invert, Play) measures layout once before animation, then animates via transform. Use it for layout-like effects: read all positions first, then animate transforms instead of mutating layout properties.

Full instructions (SKILL.md)

Source of truth, from ibelick/ui-skills.


name: fixing-motion-performance description: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

fixing-motion-performance

Fix animation performance issues.

how to use

  • /fixing-motion-performance Apply these constraints to any UI animation work in this conversation.

  • /fixing-motion-performance <file> Review the file against all rules below and report:

    • violations (quote the exact line or snippet)
    • why it matters (one short sentence)
    • a concrete fix (code-level suggestion)

Do not migrate animation libraries unless explicitly requested. Apply rules within the existing stack.

when to apply

Reference these guidelines when:

  • adding or changing UI animations (CSS, WAAPI, Motion, rAF, GSAP)
  • refactoring janky interactions or transitions
  • implementing scroll-linked motion or reveal-on-scroll
  • animating layout, filters, masks, gradients, or CSS variables
  • reviewing components that use will-change, transforms, or measurement

rendering steps glossary

  • composite: transform, opacity
  • paint: color, borders, gradients, masks, images, filters
  • layout: size, position, flow, grid, flex

rule categories by priority

prioritycategoryimpact
1never patternscritical
2choose the mechanismcritical
3measurementhigh
4scrollhigh
5paintmedium-high
6layersmedium
7blur and filtersmedium
8view transitionslow
9tool boundariescritical

quick reference

1. never patterns (critical)

  • do not interleave layout reads and writes in the same frame
  • do not animate layout continuously on large or meaningful surfaces
  • do not drive animation from scrollTop, scrollY, or scroll events
  • no requestAnimationFrame loops without a stop condition
  • do not mix multiple animation systems that each measure or mutate layout

2. choose the mechanism (critical)

  • default to transform and opacity for motion
  • use JS-driven animation only when interaction requires it
  • paint or layout animation is acceptable only on small, isolated surfaces
  • one-shot effects are acceptable more often than continuous motion
  • prefer downgrading technique over removing motion entirely

3. measurement (high)

  • measure once, then animate via transform or opacity
  • batch all DOM reads before writes
  • do not read layout repeatedly during an animation
  • prefer FLIP-style transitions for layout-like effects
  • prefer approaches that batch measurement and writes

4. scroll (high)

  • prefer Scroll or View Timelines for scroll-linked motion when available
  • use IntersectionObserver for visibility and pausing
  • do not poll scroll position for animation
  • pause or stop animations when off-screen
  • scroll-linked motion must not trigger continuous layout or paint on large surfaces

5. paint (medium-high)

  • paint-triggering animation is allowed only on small, isolated elements
  • do not animate paint-heavy properties on large containers
  • do not animate CSS variables for transform, opacity, or position
  • do not animate inherited CSS variables
  • scope animated CSS variables locally and avoid inheritance

6. layers (medium)

  • compositor motion requires layer promotion, never assume it
  • use will-change temporarily and surgically
  • avoid many or large promoted layers
  • validate layer behavior with tooling when performance matters

7. blur and filters (medium)

  • keep blur animation small (<=8px)
  • use blur only for short, one-time effects
  • never animate blur continuously
  • never animate blur on large surfaces
  • prefer opacity and translate before blur

8. view transitions (low)

  • use view transitions only for navigation-level changes
  • avoid view transitions for interaction-heavy UI
  • avoid view transitions when interruption or cancellation is required
  • treat size changes as potentially layout-triggering

9. tool boundaries (critical)

  • do not migrate or rewrite animation libraries unless explicitly requested
  • apply these rules within the existing animation system
  • never partially migrate APIs or mix styles within the same component

common fixes

/* layout thrashing: animate transform instead of width */
/* before */ .panel { transition: width 0.3s; }
/* after */  .panel { transition: transform 0.3s; }

/* scroll-linked: use scroll-timeline instead of JS */
/* before */ window.addEventListener('scroll', () => el.style.opacity = scrollY / 500)
/* after */  .reveal { animation: fade-in linear; animation-timeline: view(); }
// measurement: batch reads before writes (FLIP)
// before — layout thrash
el.style.left = el.getBoundingClientRect().left + 10 + 'px';
// after — measure once, animate via transform
const first = el.getBoundingClientRect();
el.classList.add('moved');
const last = el.getBoundingClientRect();
el.style.transform = `translateX(${first.left - last.left}px)`;
requestAnimationFrame(() => { el.style.transition = 'transform 0.3s'; el.style.transform = ''; });

review guidance

  • enforce critical rules first (never patterns, tool boundaries)
  • choose the least expensive rendering work that matches the intent
  • for any non-default choice, state the constraint that justifies it (surface size, duration, or interaction requirement)
  • when reviewing, prefer actionable notes and concrete alternatives over theory