beta

fixing-motion-performance

Skills
2113/26/2026

Version 2

Published

Updated via agex push

Created 3/26/2026

Changes

v1v2
11 ---
22 name: fixing-motion-performance
33 description: Fix animation performance issues.
44 ---
55  
66 # fixing-motion-performance
77  
88 Fix animation performance issues.
99  
1010 ## how to use
1111  
1212 - `/fixing-motion-performance`
1313  Apply these constraints to any UI animation work in this conversation.
1414  
1515 - `/fixing-motion-performance <file>`
1616  Review the file against all rules below and report:
1717  - violations (quote the exact line or snippet)
1818  - why it matters (one short sentence)
1919  - a concrete fix (code-level suggestion)
2020  
2121 Do not migrate animation libraries unless explicitly requested. Apply rules within the existing stack.
2222  
2323 ## when to apply
2424  
2525 Reference these guidelines when:
2626 - adding or changing UI animations (CSS, WAAPI, Motion, rAF, GSAP)
2727 - refactoring janky interactions or transitions
2828 - implementing scroll-linked motion or reveal-on-scroll
2929 - animating layout, filters, masks, gradients, or CSS variables
3030 - reviewing components that use will-change, transforms, or measurement
3131  
3232 ## rendering steps glossary
3333  
3434 - composite: transform, opacity
3535 - paint: color, borders, gradients, masks, images, filters
3636 - layout: size, position, flow, grid, flex
3737  
3838 ## rule categories by priority
3939  
4040 | priority | category | impact |
4141 |----------|----------|--------|
4242 | 1 | never patterns | critical |
4343 | 2 | choose the mechanism | critical |
4444 | 3 | measurement | high |
4545 | 4 | scroll | high |
4646 | 5 | paint | medium-high |
4747 | 6 | layers | medium |
4848 | 7 | blur and filters | medium |
4949 | 8 | view transitions | low |
5050 | 9 | tool boundaries | critical |
5151  
5252 ## quick reference
5353  
5454 ### 1. never patterns (critical)
5555  
5656 - do not interleave layout reads and writes in the same frame
5757 - do not animate layout continuously on large or meaningful surfaces
5858 - do not drive animation from scrollTop, scrollY, or scroll events
5959 - no requestAnimationFrame loops without a stop condition
6060 - do not mix multiple animation systems that each measure or mutate layout
6161  
6262 ### 2. choose the mechanism (critical)
6363  
6464 - default to transform and opacity for motion
6565 - use JS-driven animation only when interaction requires it
6666 - paint or layout animation is acceptable only on small, isolated surfaces
6767 - one-shot effects are acceptable more often than continuous motion
6868 - prefer downgrading technique over removing motion entirely
6969  
7070 ### 3. measurement (high)
7171  
7272 - measure once, then animate via transform or opacity
7373 - batch all DOM reads before writes
7474 - do not read layout repeatedly during an animation
7575 - prefer FLIP-style transitions for layout-like effects
7676 - prefer approaches that batch measurement and writes
7777  
7878 ### 4. scroll (high)
7979  
8080 - prefer Scroll or View Timelines for scroll-linked motion when available
8181 - use IntersectionObserver for visibility and pausing
8282 - do not poll scroll position for animation
8383 - pause or stop animations when off-screen
8484 - scroll-linked motion must not trigger continuous layout or paint on large surfaces
8585  
8686 ### 5. paint (medium-high)
8787  
8888 - paint-triggering animation is allowed only on small, isolated elements
8989 - do not animate paint-heavy properties on large containers
9090 - do not animate CSS variables for transform, opacity, or position
9191 - do not animate inherited CSS variables
9292 - scope animated CSS variables locally and avoid inheritance
9393  
9494 ### 6. layers (medium)
9595  
9696 - compositor motion requires layer promotion, never assume it
9797 - use will-change temporarily and surgically
9898 - avoid many or large promoted layers
9999 - validate layer behavior with tooling when performance matters
100100  
101101 ### 7. blur and filters (medium)
102102  
103103 - keep blur animation small (<=8px)
104104 - use blur only for short, one-time effects
105105 - never animate blur continuously
106106 - never animate blur on large surfaces
107107 - prefer opacity and translate before blur
108108  
109109 ### 8. view transitions (low)
110110  
111111 - use view transitions only for navigation-level changes
112112 - avoid view transitions for interaction-heavy UI
113113 - avoid view transitions when interruption or cancellation is required
114114 - treat size changes as potentially layout-triggering
115115  
116116 ### 9. tool boundaries (critical)
117117  
118118 - do not migrate or rewrite animation libraries unless explicitly requested
119119 - apply these rules within the existing animation system
120120 - never partially migrate APIs or mix styles within the same component
121121  
122122 ## review guidance
123123  
124124 - enforce critical rules first (never patterns, tool boundaries)
125125 - choose the least expensive rendering work that matches the intent
126126 - for any non-default choice, state the constraint that justifies it (surface size, duration, or interaction requirement)
127127 - when reviewing, prefer actionable notes and concrete alternatives over theory
Action Skill
---
name: fixing-motion-performance
description: Fix animation performance issues.
---

# 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

| priority | category | impact |
|----------|----------|--------|
| 1 | never patterns | critical |
| 2 | choose the mechanism | critical |
| 3 | measurement | high |
| 4 | scroll | high |
| 5 | paint | medium-high |
| 6 | layers | medium |
| 7 | blur and filters | medium |
| 8 | view transitions | low |
| 9 | tool boundaries | critical |

## 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

## 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