
Motion Foundations
Establish motion tokens, spring presets, reduced-motion gates, and SSR-safe defaults before building animated React or Next.js UI.
Overview
Motion Foundations is an agent skill most often used in Build (also Validate prototype, Launch distribution) that defines motion/react tokens, five spring presets, accessibility gates, and SSR-safe animation rules for Re
Install
npx skills add https://github.com/affaan-m/everything-claude-code --skill motion-foundationsWhat is this skill?
- Shared motionTokens (duration, easing, distance, scale) and 5 named spring presets
- shouldAnimate() gate plus useReducedMotion for accessibility enforcement
- Non-negotiable rules: responsiveness beats smoothness; remove motion that does not guide, signal state, or preserve spac
- SSR-safe initial states to avoid hydration warnings from animation defaults
- Explicit activation triggers: new animated components, token setup, reduced-motion, hydration debugging
- 5 named spring presets in the springs map
- 3 motion purpose principles (guide attention, communicate state, preserve spatial continuity)
Adoption & trust: 1.1k installs on skills.sh; 210k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are adding motion/react animations without shared tokens, so performance, accessibility, and hydration issues show up late.
Who is it for?
Indie builders starting a Next.js or React UI who want one enforced motion system before building components.
Skip if: Projects skipping animation entirely, non-React stacks, or teams that already maintain a complete design-system motion spec with no refactor planned.
When should I use this skill?
Starting any animated component, setting motion tokens or springs, implementing prefers-reduced-motion, or debugging SSR hydration from animation initial states.
What do I get? / Deliverables
You get a motionTokens object, springs map, shouldAnimate gate, and SSR-safe defaults so later motion skills stay consistent and shippable.
- motionTokens and springs module
- shouldAnimate() helper wired to useReducedMotion
- SSR-safe default initial states documented for components
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Animation foundations belong in Build/frontend as the first implementation layer, but the same rules apply when polishing Launch pages or Grow lifecycle UI. Frontend is canonical because motion/react tokens and hydration safety are component-layer concerns upstream of motion-patterns and motion-advanced.
Where it fits
Create motionTokens and springs before building a dashboard sidebar transition.
Decide whether a landing hero animation survives the three motion principles checklist.
Apply shouldAnimate() on a marketing page so campaigns stay accessible on low-power devices.
Eliminate hydration warnings by aligning SSR initial states with client motion.
How it compares
Foundation token and policy layer—load before pattern libraries, not a one-off CSS keyframe generator.
Common Questions / FAQ
Who is motion-foundations for?
Solo frontend builders using motion/react in React or Next.js who need shared presets, a11y gates, and SSR-safe baselines.
When should I use motion-foundations?
At the start of Build/frontend for any new motion, when fixing reduced-motion or hydration issues, and when validating a prototype interaction in Validate before full polish.
Is motion-foundations safe to install?
It is styling and performance guidance without shell access; review the Security Audits panel on this page before installing.
Workflow Chain
Then invoke: motion patterns, motion advanced
SKILL.md
READMESKILL.md - Motion Foundations
# Motion Foundations The base layer of the motion system. Defines every value, constraint, and rule that downstream skills (`motion-patterns`, `motion-advanced`) inherit. Load this skill before any animation work begins. ## When to Activate - Starting any animated component from scratch - Setting up tokens, spring presets, or easing values - Implementing `prefers-reduced-motion` support - Debugging hydration mismatches from animation initial states - Evaluating whether an animation should exist at all ## Outputs This skill produces: - A shared `motionTokens` object (duration, easing, distance, scale) - A shared `springs` preset map (5 named configs) - A `shouldAnimate()` gate used by all components - Accessibility-compliant animation defaults via `useReducedMotion` - SSR-safe initial states with zero hydration warnings ## Principles Motion must do at least one of the following or it must be removed: - Guide attention - Communicate state - Preserve spatial continuity Responsiveness always outranks smoothness. A 60 fps animation that causes input delay is worse than no animation. ## Rules These are non-negotiable. They apply to every component in the system. 1. **Use `motion/react` only.** Never import from `framer-motion`. Never mix the two in the same tree. 2. **`initial` must match server output.** If the server renders `opacity: 1`, the `initial` prop must also be `opacity: 1`. No exceptions. 3. **Reduced motion overrides everything.** When `useReducedMotion()` returns `true` or `prefersReduced` is `true`, all transforms are disabled. Opacity-only fades at ≤ 0.2s are the only permitted fallback. 4. **Never animate layout properties.** `width`, `height`, `top`, `left`, `margin`, `padding` are banned from `animate`. Use `transform` and `opacity` only. 5. **All token values come from `motionTokens`.** Hardcoded durations and easings in component files are forbidden. 6. **All spring configs come from the `springs` map.** Inline `stiffness`/`damping` values are forbidden. 7. **`"use client"` is required** on every file that imports from `motion/react`. 8. **Never read `window` or `navigator` at module level.** Always guard with `typeof window !== "undefined"`. ## Decision Guidance ### Choosing a duration | Token | Use when | | --------- | -------------------------------------------- | | `instant` | Tooltip show/hide, focus ring, badge update | | `fast` | Button feedback, icon swap, chip toggle | | `normal` | Modal open, card expand, page element enter | | `slow` | Hero entrance, full-page transition | | `crawl` | Deliberate storytelling; use sparingly | ### Choosing a spring | Preset | Use when | | --------- | ------------------------------------------ | | `snappy` | Default UI — buttons, chips, nav items | | `gentle` | Cards, modals, panels landing softly | | `bouncy` | Playful moments — empty states, onboarding | | `instant` | Tooltips, popovers, dropdowns | | `release` | Drag release — natural physics feel | ### When to disable animation entirely Disable (make `shouldAnimate()` return `false`) when: - `prefersReduced` is `true` - `isLowEnd` is `true` and the animation is non-essential - The element is off-screen and will never enter the viewport - The animation is purely decorative with no UX purpose ## Core Concepts ### Token system ```ts // lib/motion-tokens.ts export const motionTokens = { duration: { instant: 0.08, fast: 0.18, normal: 0.35, slow: 0.6, crawl: 1.0, }, easing: { smooth: [0.22, 1, 0.36, 1], sharp: [0.4, 0, 0.2, 1], bounce: [0.34, 1.56, 0.64, 1], linear: [0, 0, 1, 1], }, distance: {