agy-superpowers 5.1.2 → 5.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +198 -175
  3. package/package.json +1 -1
  4. package/template/agent/.shared/mobile-uiux-promax/data/accessibility.csv +25 -0
  5. package/template/agent/.shared/mobile-uiux-promax/data/animation.csv +22 -0
  6. package/template/agent/.shared/mobile-uiux-promax/data/components.csv +21 -0
  7. package/template/agent/.shared/mobile-uiux-promax/data/gestures.csv +26 -0
  8. package/template/agent/.shared/mobile-uiux-promax/data/layout.csv +21 -0
  9. package/template/agent/.shared/mobile-uiux-promax/data/navigation.csv +27 -0
  10. package/template/agent/.shared/mobile-uiux-promax/data/onboarding.csv +17 -0
  11. package/template/agent/.shared/mobile-uiux-promax/data/platform.csv +22 -0
  12. package/template/agent/.shared/mobile-uiux-promax/data/stacks/flutter.csv +19 -0
  13. package/template/agent/.shared/mobile-uiux-promax/data/stacks/jetpack-compose.csv +18 -0
  14. package/template/agent/.shared/mobile-uiux-promax/data/stacks/react-native.csv +20 -0
  15. package/template/agent/.shared/mobile-uiux-promax/data/stacks/swiftui.csv +18 -0
  16. package/template/agent/.shared/mobile-uiux-promax/data/ux-laws.csv +16 -0
  17. package/template/agent/.shared/mobile-uiux-promax/scripts/mobile-search.py +157 -0
  18. package/template/agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  19. package/template/agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  20. package/template/agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  21. package/template/agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
  22. package/template/agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  23. package/template/agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  24. package/template/agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  25. package/template/agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  26. package/template/agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  27. package/template/agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  28. package/template/agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  29. package/template/agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  30. package/template/agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  31. package/template/agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  32. package/template/agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  33. package/template/agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  34. package/template/agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  35. package/template/agent/.shared/ui-ux-pro-max/scripts/core.py +236 -0
  36. package/template/agent/.shared/ui-ux-pro-max/scripts/search.py +61 -0
  37. package/template/agent/.tests/TESTS.md +119 -0
  38. package/template/agent/.tests/mobile-uiux-promax/test_search.py +266 -0
  39. package/template/agent/.tests/run_tests.py +86 -0
  40. package/template/agent/patches/skills-patches.md +24 -0
  41. package/template/agent/rules/git-policy.md +25 -0
  42. package/template/agent/skills/brainstorming/SKILL.md +57 -0
  43. package/template/agent/skills/finishing-a-development-branch/SKILL.md +18 -6
  44. package/template/agent/skills/frontend-design/SKILL.md +147 -0
  45. package/template/agent/skills/frontend-design/reference/color-and-contrast.md +117 -0
  46. package/template/agent/skills/frontend-design/reference/interaction-design.md +159 -0
  47. package/template/agent/skills/frontend-design/reference/motion-design.md +150 -0
  48. package/template/agent/skills/frontend-design/reference/responsive-design.md +161 -0
  49. package/template/agent/skills/frontend-design/reference/spatial-design.md +122 -0
  50. package/template/agent/skills/frontend-design/reference/typography.md +124 -0
  51. package/template/agent/skills/frontend-design/reference/ux-writing.md +127 -0
  52. package/template/agent/skills/mobile-uiux-promax/SKILL.md +139 -0
  53. package/template/agent/skills/using-git-worktrees/SKILL.md +3 -1
  54. package/template/agent/skills/verification-before-completion/SKILL.md +11 -0
  55. package/template/agent/workflows/mobile-uiux-promax.md +137 -0
  56. package/template/agent/workflows/ui-ux-pro-max.md +231 -0
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: frontend-design
3
+ description: Use when building web components, pages, artifacts, or applications — especially when high design quality is needed. Generates creative, polished code that avoids generic AI aesthetics (purple gradients, Inter font, card-in-card layouts).
4
+ ---
5
+
6
+ # Frontend Design
7
+
8
+ This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
9
+
10
+ ## Context Gathering Protocol
11
+
12
+ Design skills produce generic output without project context. Before doing any design work, confirm:
13
+
14
+ - **Target audience**: Who uses this product and in what context?
15
+ - **Use cases**: What jobs are they trying to get done?
16
+ - **Brand personality/tone**: How should the interface feel?
17
+
18
+ **Gathering order:**
19
+ 1. **Check current instructions**: If your loaded instructions contain a Design Context section, proceed immediately.
20
+ 2. **Check `.impeccable.md`**: If it exists in the project root and has context, use it.
21
+ 3. **Ask the user**: If neither source has context, ask these 3 questions before proceeding.
22
+
23
+ ---
24
+
25
+ ## Design Direction
26
+
27
+ Commit to a **BOLD** aesthetic direction before writing any code:
28
+
29
+ - **Purpose**: What problem does this interface solve? Who uses it?
30
+ - **Tone**: Pick an extreme — brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian
31
+ - **Differentiation**: What makes this UNFORGETTABLE? What's the one thing users remember?
32
+
33
+ **CRITICAL**: Choose a clear conceptual direction and execute with precision. Bold maximalism and refined minimalism both work — the key is **intentionality**, not intensity.
34
+
35
+ Implement working code that is:
36
+ - Production-grade and functional
37
+ - Visually striking and memorable
38
+ - Cohesive with a clear aesthetic point-of-view
39
+ - Meticulously refined in every detail
40
+
41
+ ---
42
+
43
+ ## Frontend Aesthetics Guidelines
44
+
45
+ ### Typography
46
+ → *See [typography reference](reference/typography.md) for scales, pairing, and loading strategies.*
47
+
48
+ Choose fonts that are beautiful, unique, and interesting. Pair a distinctive display font with a refined body font.
49
+
50
+ **DO**: Use a modular type scale with fluid sizing (`clamp()`)
51
+ **DO**: Vary font weights and sizes to create clear visual hierarchy
52
+ **DON'T**: Use overused fonts — Inter, Roboto, Arial, Open Sans, system defaults
53
+ **DON'T**: Use monospace typography as lazy shorthand for "technical/developer" vibes
54
+ **DON'T**: Put large icons with rounded corners above every heading
55
+
56
+ ### Color & Theme
57
+ → *See [color reference](reference/color-and-contrast.md) for OKLCH, palettes, and dark mode.*
58
+
59
+ **DO**: Use modern CSS color functions (`oklch`, `color-mix`, `light-dark()`) for perceptually uniform palettes
60
+ **DO**: Tint your neutrals toward your brand hue
61
+ **DON'T**: Use gray text on colored backgrounds — looks washed out; use a shade of the bg color instead
62
+ **DON'T**: Use pure black (`#000`) or pure white (`#fff`) — always tint
63
+ **DON'T**: Use the AI color palette: cyan-on-dark, purple-to-blue gradients, neon on dark
64
+ **DON'T**: Use gradient text for "impact" on metrics or headings
65
+ **DON'T**: Default to dark mode with glowing accents without real design decisions
66
+
67
+ ### Layout & Space
68
+ → *See [spatial reference](reference/spatial-design.md) for grids, rhythm, and container queries.*
69
+
70
+ **DO**: Create visual rhythm through varied spacing — tight groupings, generous separations
71
+ **DO**: Use fluid spacing with `clamp()` that breathes on larger screens
72
+ **DO**: Use asymmetry and unexpected compositions; break the grid intentionally
73
+ **DON'T**: Wrap everything in cards — not everything needs a container
74
+ **DON'T**: Nest cards inside cards — visual noise
75
+ **DON'T**: Use identical card grids (same-sized card with icon + heading + text, repeated)
76
+ **DON'T**: Center everything — left-aligned text with asymmetric layouts feels more designed
77
+ **DON'T**: Use the same spacing everywhere
78
+
79
+ ### Visual Details
80
+ **DO**: Use intentional, purposeful decorative elements that reinforce brand
81
+ **DON'T**: Use glassmorphism everywhere — blur/glass/glow as decoration rather than purpose
82
+ **DON'T**: Use rounded rectangles with generic drop shadows — forgettable
83
+ **DON'T**: Use sparklines as decoration
84
+ **DON'T**: Use modals unless there's truly no better alternative
85
+
86
+ ### Motion
87
+ → *See [motion reference](reference/motion-design.md) for timing, easing, and reduced motion.*
88
+
89
+ **DO**: Use motion to convey state changes — entrances, exits, feedback
90
+ **DO**: Use exponential easing (`ease-out-quart/quint/expo`) for natural deceleration
91
+ **DO**: For height animations, use `grid-template-rows` transitions instead of animating `height`
92
+ **DON'T**: Animate layout properties (width, height, padding, margin) — use `transform` and `opacity` only
93
+ **DON'T**: Use bounce or elastic easing — dated and tacky
94
+
95
+ ### Interaction
96
+ → *See [interaction reference](reference/interaction-design.md) for forms, focus, loading patterns.*
97
+
98
+ **DO**: Use progressive disclosure — start simple, reveal sophistication through interaction
99
+ **DO**: Design empty states that teach the interface, not just say "nothing here"
100
+ **DON'T**: Make every button primary — use ghost buttons, text links, secondary styles
101
+ **DON'T**: Repeat the same information redundantly
102
+
103
+ ### Responsive
104
+ → *See [responsive reference](reference/responsive-design.md) for mobile-first, fluid design.*
105
+
106
+ **DO**: Use container queries (`@container`) for component-level responsiveness
107
+ **DO**: Adapt the interface for different contexts — don't just shrink it
108
+ **DON'T**: Hide critical functionality on mobile
109
+
110
+ ### UX Writing
111
+ → *See [UX writing reference](reference/ux-writing.md) for labels, errors, and empty states.*
112
+
113
+ **DO**: Make every word earn its place
114
+ **DON'T**: Repeat information users can already see
115
+
116
+ ---
117
+
118
+ ## The AI Slop Test
119
+
120
+ **Critical quality check**: If you showed this interface to someone and said "AI made this," would they believe you immediately? If yes, that's the problem.
121
+
122
+ A distinctive interface should make someone ask "how was this made?" not "which AI made this?"
123
+
124
+ Review the DON'T guidelines above — they are the fingerprints of AI-generated work from 2024-2025.
125
+
126
+ ---
127
+
128
+ ## Implementation Principles
129
+
130
+ Match implementation complexity to the aesthetic vision:
131
+ - **Maximalist designs** → elaborate code, extensive animations, rich effects
132
+ - **Minimalist designs** → restraint, precision, careful spacing, subtle details
133
+
134
+ Interpret creatively and make unexpected choices that feel genuinely designed for the context. **No design should be the same.** Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices across generations.
135
+
136
+ ---
137
+
138
+ ## Quick Reference: What to Avoid
139
+
140
+ | Category | DON'T |
141
+ |----------|-------|
142
+ | **Fonts** | Inter, Roboto, Arial, Open Sans |
143
+ | **Colors** | Pure black/white, purple gradients, gray on color |
144
+ | **Layout** | Cards in cards, centered everything, identical grids |
145
+ | **Motion** | Bounce/elastic easing, animating height/width |
146
+ | **Visual** | Glassmorphism everywhere, gradient text, generic shadows |
147
+ | **Writing** | "OK", "Submit", redundant copy, vague errors |
@@ -0,0 +1,117 @@
1
+ # Color & Contrast
2
+
3
+ ## Color Spaces: Use OKLCH
4
+
5
+ **Stop using HSL.** Use OKLCH (or LCH) instead. It's perceptually uniform — equal steps in lightness *look* equal, unlike HSL where 50% lightness in yellow looks bright while 50% in blue looks dark.
6
+
7
+ ```css
8
+ /* OKLCH: lightness (0-100%), chroma (0-0.4+), hue (0-360) */
9
+ --color-primary: oklch(60% 0.15 250); /* Blue */
10
+ --color-primary-light: oklch(85% 0.08 250); /* Same hue, lighter */
11
+ --color-primary-dark: oklch(35% 0.12 250); /* Same hue, darker */
12
+ ```
13
+
14
+ **Key insight**: As you move toward white or black, reduce chroma. High chroma at extreme lightness looks garish. A light blue at 85% lightness needs ~0.08 chroma, not the 0.15 of your base color.
15
+
16
+ ---
17
+
18
+ ## Building Functional Palettes
19
+
20
+ ### The Tinted Neutral Trick
21
+ **Pure gray is dead.** Add a subtle hint of your brand hue to all neutrals:
22
+
23
+ ```css
24
+ /* Dead grays */
25
+ --gray-100: oklch(95% 0 0); /* No personality */
26
+ --gray-900: oklch(15% 0 0);
27
+
28
+ /* Warm-tinted grays */
29
+ --gray-100: oklch(95% 0.01 60); /* Hint of warmth */
30
+ --gray-900: oklch(15% 0.01 60);
31
+
32
+ /* Cool-tinted grays (tech, professional) */
33
+ --gray-100: oklch(95% 0.01 250); /* Hint of blue */
34
+ --gray-900: oklch(15% 0.01 250);
35
+ ```
36
+
37
+ The chroma is tiny (0.01) but perceptible. It creates subconscious cohesion between your brand color and UI.
38
+
39
+ ### Palette Structure
40
+ | Role | Purpose | Example |
41
+ |------|---------|---------|
42
+ | **Primary** | Brand, CTAs, key actions | 1 color, 3–5 shades |
43
+ | **Neutral** | Text, backgrounds, borders | 9–11 shade scale |
44
+ | **Semantic** | Success, error, warning, info | 4 colors, 2–3 shades each |
45
+ | **Surface** | Cards, modals, overlays | 2–3 elevation levels |
46
+
47
+ Skip secondary/tertiary unless you need them. Most apps work fine with one accent color.
48
+
49
+ ### The 60-30-10 Rule (Applied Correctly)
50
+ This rule is about **visual weight**, not pixel count:
51
+ - **60%**: Neutral backgrounds, white space, base surfaces
52
+ - **30%**: Secondary — text, borders, inactive states
53
+ - **10%**: Accent — CTAs, highlights, focus states
54
+
55
+ The common mistake: using accent everywhere because it's "the brand color." Accent colors work *because* they're rare. Overuse kills their power.
56
+
57
+ ---
58
+
59
+ ## Contrast & Accessibility
60
+
61
+ ### WCAG Requirements
62
+ | Content Type | AA Minimum | AAA Target |
63
+ |--------------|------------|------------|
64
+ | Body text | 4.5:1 | 7:1 |
65
+ | Large text (18px+ or 14px bold) | 3:1 | 4.5:1 |
66
+ | UI components, icons | 3:1 | 4.5:1 |
67
+ | Decorative elements | None | None |
68
+
69
+ **The gotcha**: Placeholder text still needs 4.5:1. That light gray placeholder you see everywhere? Usually fails WCAG.
70
+
71
+ ### Dangerous Color Combinations
72
+ - Light gray text on white (the #1 accessibility fail)
73
+ - **Gray text on any colored background** — looks washed out; use a darker shade of the background color
74
+ - Red on green (or vice versa) — 8% of men can't distinguish
75
+ - Blue on red background (vibrates visually)
76
+ - Yellow text on white (almost always fails)
77
+
78
+ ### Never Use Pure Gray or Pure Black
79
+ Pure gray and `#000` don't exist in nature — real shadows always have a color cast. Even chroma of 0.005–0.01 feels natural without being obviously tinted.
80
+
81
+ ---
82
+
83
+ ## Theming: Light & Dark Mode
84
+
85
+ ### Dark Mode Is Not Inverted Light Mode
86
+ You can't just swap colors. Dark mode requires different design decisions:
87
+
88
+ | Light Mode | Dark Mode |
89
+ |------------|-----------|
90
+ | Shadows for depth | Lighter surfaces for depth (no shadows) |
91
+ | Dark text on light | Light text on dark (reduce font weight slightly) |
92
+ | Vibrant accents | Desaturate accents slightly |
93
+ | White backgrounds | Never pure black — use dark gray (oklch 12–18%) |
94
+
95
+ ```css
96
+ /* Dark mode depth via surface color, not shadow */
97
+ [data-theme="dark"] {
98
+ --surface-1: oklch(15% 0.01 250);
99
+ --surface-2: oklch(20% 0.01 250); /* "Higher" = lighter */
100
+ --surface-3: oklch(25% 0.01 250);
101
+
102
+ --body-weight: 350; /* Reduce from 400, perceived weight is lighter */
103
+ }
104
+ ```
105
+
106
+ ### Token Hierarchy
107
+ Use two layers: primitive tokens (`--blue-500`) and semantic tokens (`--color-primary: var(--blue-500)`). For dark mode, only redefine the semantic layer.
108
+
109
+ ---
110
+
111
+ ## Alpha Is A Design Smell
112
+
113
+ Heavy use of transparency usually means an incomplete palette. Alpha creates unpredictable contrast, performance overhead, and inconsistency. Define explicit overlay colors for each context. Exception: focus rings and interactive states where see-through is needed.
114
+
115
+ ---
116
+
117
+ **Avoid**: Relying on color alone to convey information. Using pure black (#000) for large areas. Skipping color blindness testing (8% of men affected).
@@ -0,0 +1,159 @@
1
+ # Interaction Design
2
+
3
+ ## Make Interactions Feel Fast
4
+
5
+ Use **optimistic UI** — update immediately, sync later. This is the single biggest perceived-performance improvement you can make.
6
+
7
+ ```javascript
8
+ // BAD: Wait for server
9
+ async function likePost(id) {
10
+ const result = await api.like(id);
11
+ setLiked(result.liked);
12
+ }
13
+
14
+ // GOOD: Optimistic update
15
+ function likePost(id) {
16
+ setLiked(true); // Instant feedback
17
+ api.like(id).catch(() => {
18
+ setLiked(false); // Revert on failure
19
+ showError('Could not save like');
20
+ });
21
+ }
22
+ ```
23
+
24
+ Use optimistic UI for low-stakes actions. Avoid for payments, destructive operations, or anything requiring server validation first.
25
+
26
+ ---
27
+
28
+ ## Progressive Disclosure
29
+
30
+ Start simple, reveal sophistication through interaction:
31
+
32
+ - Basic options visible immediately
33
+ - Advanced options behind expandable sections
34
+ - Hover/focus states reveal secondary actions
35
+ - "Show more" patterns for secondary content
36
+
37
+ This prevents overwhelming users while keeping power-user features accessible.
38
+
39
+ ---
40
+
41
+ ## Form Design
42
+
43
+ ### Fields
44
+ - Show format with placeholders, not fixed instruction text (instructions disappear on focus)
45
+ - For non-obvious fields, explain **why** you're asking, not just what to enter
46
+ - Group related fields visually with spacing, not just labels
47
+ - Use `autocomplete` attributes — they're free UX
48
+
49
+ ```html
50
+ <input
51
+ type="email"
52
+ autocomplete="email"
53
+ placeholder="you@company.com"
54
+ aria-describedby="email-hint"
55
+ >
56
+ <span id="email-hint">We'll send your receipt here</span>
57
+ ```
58
+
59
+ ### Validation
60
+ **Validate on blur, not on keystroke** — keystroke validation creates stress (errors appear before you've finished typing). Clear errors immediately when the user corrects them.
61
+
62
+ ```css
63
+ /* Visual validation state */
64
+ input:invalid:not(:focus):not(:placeholder-shown) {
65
+ border-color: oklch(55% 0.2 25);
66
+ background: oklch(98% 0.01 25);
67
+ }
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Loading States
73
+
74
+ Three types — use the right one:
75
+
76
+ | State | When | Pattern |
77
+ |-------|------|---------|
78
+ | **Skeleton** | Content structure is known | Placeholder shapes in layout position |
79
+ | **Spinner** | Action feedback (button click) | Small inline spinner, disable button |
80
+ | **Progress** | Long operations | Bar with estimated time if >10s |
81
+
82
+ **Specific loading messages beat generic ones:**
83
+ - `"Saving your draft..."` not `"Loading..."`
84
+ - `"Analyzing 40 files..."` not `"Processing..."`
85
+ - `"This usually takes 30 seconds"` for long waits
86
+
87
+ ---
88
+
89
+ ## Error States
90
+
91
+ Every error needs: (1) What happened, (2) Why, (3) How to fix it.
92
+
93
+ - `"Email address isn't valid. Please include an @ symbol."` ✅
94
+ - `"Invalid input"` ❌
95
+
96
+ For field errors, place them directly below the field, not in a banner far away.
97
+
98
+ ---
99
+
100
+ ## Empty States
101
+
102
+ Empty states are **onboarding moments**:
103
+ 1. Acknowledge briefly ("No projects yet")
104
+ 2. Explain the value of filling it
105
+ 3. Provide a clear action ("Create your first project →")
106
+
107
+ Empty states that just say "No items found" are missed opportunities.
108
+
109
+ ---
110
+
111
+ ## Focus Management
112
+
113
+ Always visible focus indicators — don't set `outline: none` without providing an alternative.
114
+
115
+ ```css
116
+ :focus-visible {
117
+ outline: 2px solid oklch(60% 0.15 250);
118
+ outline-offset: 2px;
119
+ border-radius: 2px;
120
+ }
121
+
122
+ /* Hide focus ring for mouse users */
123
+ :focus:not(:focus-visible) {
124
+ outline: none;
125
+ }
126
+ ```
127
+
128
+ Move focus intentionally after actions — after closing a modal, return focus to the trigger. After deleting an item, move focus to the next item.
129
+
130
+ ---
131
+
132
+ ## Button Hierarchy
133
+
134
+ Not every action deserves a primary button. Create clear hierarchy:
135
+
136
+ | Style | Use For | Frequency |
137
+ |-------|---------|-----------|
138
+ | **Primary** (filled) | The one main action | 1 per view |
139
+ | **Secondary** (outlined) | Important but not primary | 2–3 max |
140
+ | **Ghost/text** | Low-priority actions | Multiple OK |
141
+ | **Destructive** (red) | Delete, remove | When needed |
142
+
143
+ Never put two primary buttons side by side — the user can't tell which is "more primary."
144
+
145
+ ---
146
+
147
+ ## Modals: Use Sparingly
148
+
149
+ Modals are lazy default design. Ask: does this need to interrupt the user? Alternatives:
150
+ - **Inline editing**: Edit in place
151
+ - **Slide-over panel**: For complex forms
152
+ - **Undo**: For destructive actions instead of confirmation
153
+ - **Toast**: For confirmations that don't need user input
154
+
155
+ When you must use a modal: trap focus inside, close on Escape and backdrop click, return focus to trigger on close.
156
+
157
+ ---
158
+
159
+ **Avoid**: Confirming every action with a modal. Showing errors only in banners. Disabled buttons without explanation. Making hover the only way to access functionality (touch users can't hover).
@@ -0,0 +1,150 @@
1
+ # Motion Design
2
+
3
+ ## Duration: The 100/300/500 Rule
4
+
5
+ Timing matters more than easing. These durations feel right for most UI:
6
+
7
+ | Duration | Use Case | Examples |
8
+ |----------|----------|----------|
9
+ | **100–150ms** | Instant feedback | Button press, toggle, color change |
10
+ | **200–300ms** | State changes | Menu open, tooltip, hover states |
11
+ | **300–500ms** | Layout changes | Accordion, modal, drawer |
12
+ | **500–800ms** | Entrance animations | Page load, hero reveals |
13
+
14
+ **Exit animations are faster than entrances** — use ~75% of enter duration.
15
+
16
+ ---
17
+
18
+ ## Easing: Pick the Right Curve
19
+
20
+ **Don't use `ease`.** It's a compromise that's rarely optimal. Instead:
21
+
22
+ | Curve | Use For | CSS |
23
+ |-------|---------|-----|
24
+ | **ease-out** | Elements entering | `cubic-bezier(0.16, 1, 0.3, 1)` |
25
+ | **ease-in** | Elements leaving | `cubic-bezier(0.7, 0, 0.84, 0)` |
26
+ | **ease-in-out** | State toggles (there → back) | `cubic-bezier(0.65, 0, 0.35, 1)` |
27
+
28
+ **For micro-interactions, use exponential curves — they mimic real physics:**
29
+
30
+ ```css
31
+ --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1); /* Smooth, refined (recommended) */
32
+ --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1); /* Slightly more dramatic */
33
+ --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1); /* Snappy, confident */
34
+ ```
35
+
36
+ **Avoid bounce and elastic curves.** They were trendy in 2015 but now feel tacky and amateurish. Real objects decelerate smoothly — they don't bounce when they stop.
37
+
38
+ ---
39
+
40
+ ## The Only Two Properties You Should Animate
41
+
42
+ **`transform` and `opacity` only** — everything else causes layout recalculation.
43
+
44
+ For height animations (accordions, expandables), use `grid-template-rows: 0fr → 1fr` instead of animating `height` directly:
45
+
46
+ ```css
47
+ .expandable {
48
+ display: grid;
49
+ grid-template-rows: 0fr;
50
+ transition: grid-template-rows 300ms var(--ease-out-quart);
51
+ }
52
+
53
+ .expandable.open {
54
+ grid-template-rows: 1fr;
55
+ }
56
+
57
+ .expandable > div {
58
+ overflow: hidden;
59
+ }
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Staggered Animations
65
+
66
+ Use CSS custom properties for cleaner stagger:
67
+
68
+ ```css
69
+ .item {
70
+ animation: slide-up 500ms var(--ease-out-expo) both;
71
+ animation-delay: calc(var(--i, 0) * 50ms);
72
+ }
73
+ ```
74
+
75
+ ```html
76
+ <div class="item" style="--i: 0">...</div>
77
+ <div class="item" style="--i: 1">...</div>
78
+ <div class="item" style="--i: 2">...</div>
79
+ ```
80
+
81
+ **Cap total stagger time** — 10 items at 50ms = 500ms total. For many items, reduce per-item delay or cap staggered count.
82
+
83
+ ---
84
+
85
+ ## Reduced Motion
86
+
87
+ This is not optional. Vestibular disorders affect ~35% of adults over 40.
88
+
89
+ ```css
90
+ /* Define animations normally */
91
+ .card {
92
+ animation: slide-up 500ms ease-out;
93
+ }
94
+
95
+ /* Provide crossfade alternative */
96
+ @media (prefers-reduced-motion: reduce) {
97
+ .card {
98
+ animation: fade-in 200ms ease-out;
99
+ }
100
+ }
101
+
102
+ /* Or disable all motion */
103
+ @media (prefers-reduced-motion: reduce) {
104
+ *, *::before, *::after {
105
+ animation-duration: 0.01ms !important;
106
+ transition-duration: 0.01ms !important;
107
+ }
108
+ }
109
+ ```
110
+
111
+ **What to preserve**: Progress bars, loading spinners (slowed), and focus indicators should still work — just without spatial movement.
112
+
113
+ ---
114
+
115
+ ## Perceived Performance
116
+
117
+ Nobody cares how fast your site is — just how fast it **feels**.
118
+
119
+ **The 80ms threshold**: Anything under 80ms feels instant. This is your target for micro-interactions.
120
+
121
+ **Strategies:**
122
+ - **Optimistic UI**: Update immediately, sync later. Instagram likes work offline — the UI updates instantly. Use for low-stakes actions; avoid for payments or destructive operations.
123
+ - **Skeleton screens**: Show structure before content. Beats blank loading states.
124
+ - **Progressive loading**: Show content as it arrives — don't wait for everything.
125
+
126
+ **Caution**: Too-fast responses can decrease perceived value. Users may distrust instant results for complex operations (search, analysis). Sometimes a brief delay signals "real work" is happening.
127
+
128
+ ---
129
+
130
+ ## Performance
131
+
132
+ Don't use `will-change` preemptively — only when animation is imminent (`:hover`, `.animating`). For scroll-triggered animations, use Intersection Observer instead of scroll events; unobserve after animating once.
133
+
134
+ Create motion tokens for consistency:
135
+
136
+ ```css
137
+ :root {
138
+ --duration-instant: 100ms;
139
+ --duration-fast: 200ms;
140
+ --duration-normal: 300ms;
141
+ --duration-slow: 500ms;
142
+ --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
143
+ --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
144
+ --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ **Avoid**: Animating everything (animation fatigue is real). Using >500ms for UI feedback. Ignoring `prefers-reduced-motion`. Using animation to hide slow loading.