Skip to main content
skill CX Codex

motion · oakoss — Claude Code skill: what it does, how to install

Guides AI coding agents through React animations using the modern Motion library. Helps configure layout shifts, scroll effects, and avoids bundle bloat.

MIT 176 installs ★ 29 updated 2026-08-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add oakoss/agent-skills --skill motion -a claude-code
Open on GitHub

What motion does

This skill teaches agents how to structure animations using motion (formerly framer-motion) across React 18.2+, React 19, and Next.js App Router. It enforces imports from motion/react. The guide provides patterns for drag gestures, exit transitions with AnimatePresence, staggered lists, and SVG path drawing via pathLength.

Motion uses WAAPI for opacity and transforms alongside ScrollTimeline for scroll progress. The full package weighs 34 KB. To save space, the skill advises LazyMotion with domAnimation down to 4.6 KB, or the 2.3 KB useAnimate hook. It warns against animating width and height directly to prevent layout thrashing.

Combining Tailwind transition-* classes with Motion props causes visible frame stuttering, so the skill removes them. For basic list inserts, Motion is overkill: the instructions recommend AutoAnimate at 3.28 KB instead.

What it helps with

  • configure exit animations using AnimatePresence and unique keys
  • trim animation bundle footprint to 4.6 KB with LazyMotion
  • build scroll progress bars using useScroll and useTransform
  • resolve layout stuttering caused by Tailwind transition classes

Example prompts for the agent

  • Build a Next.js modal component with an exit animation using AnimatePresence and motion/react.
  • Create a scroll-linked reading progress bar with useScroll and scaleX.
  • Refactor this animated list to use LazyMotion and domAnimation instead of the full bundle.

How to install motion

1Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill motion -a claude-code

2Manually: put the files in place

~/.claude/skills/motion/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/motion/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about motion

How to install motion in Claude Code?

Run npx skills add oakoss/agent-skills --skill motion -a claude-code in your terminal.

When does the skill advise against using Motion?

Do not use it for 3D scenes; use Three.js or React Three Fiber instead. For basic list add and remove transitions, the skill points to AutoAnimate at 3.28 KB.

How does the skill handle bundle optimization?

It replaces the standard 34 KB package with the m component wrapped in LazyMotion and domAnimation (4.6 KB), or suggests the 2.3 KB useAnimate hook.

Source text

SKILL.md · MIT
---
name: motion
description: |
  Web animations with Motion (formerly Framer Motion) for React -- gestures, scroll effects, spring physics, layout animations, SVG, micro-interactions, loading states.

  Use when: drag-and-drop, scroll animations, modals, carousels, parallax, page transitions, hover effects, staggered lists, loading spinners, number counters.
  Troubleshoot: AnimatePresence exit, list performance, Tailwind conflicts, Next.js "use client", layout in scaled containers.
license: MIT
metadata:
  author: oakoss
  version: '1.0'
  source: 'https://motion.dev/docs'
user-invocable: false
---

# Motion

## Overview

Motion (package: `motion`, formerly `framer-motion`) is the standard React animation library. Import from `motion/react`. Provides declarative props for gestures, scroll-linked animations, layout transitions, SVG path drawing, and spring physics. Uses a hybrid animation engine (WAAPI for transforms/opacity, ScrollTimeline for scroll-linked effects). Bundle ranges from 2.3 KB (useAnimate mini) to 34 KB (full), optimizable to 4.6 KB with LazyMotion. Compatible with React 18.2+, React 19, Next.js App Router, and Vite.

Do NOT use Motion for simple list add/remove animations (use AutoAnimate instead at 3.28 KB). Do NOT use for 3D (use Three.js / React Three Fiber).

## Quick Reference

| Pattern                | API / Props                                             |
| ---------------------- | ------------------------------------------------------- |
| Fade in on mount       | `initial`, `animate`, `transition`                      |
| Exit animations        | `AnimatePresence` + `exit` prop (unique `key` required) |
| Staggered list         | `variants` with `staggerChildren`                       |
| Hover / tap / focus    | `whileHover`, `whileTap`, `whileFocus`                  |
| Drag                   | `drag`, `dragConstraints`, `dragElastic`                |
| Scroll-triggered       | `whileInView`, `viewport={{ once: true }}`              |
| Scroll-linked/parallax | `useScroll` + `useTransform`                            |
| Progress indicator     | `scrollYProgress` + `scaleX`                            |
| Layout animation       | `layout` prop (FLIP technique)                          |
| Shared element         | `layoutId` (same ID across views)                       |
| Layout group           | `LayoutGroup` wrapping sibling lists                    |
| Page transition        | `AnimatePresence` + `key={pathname}`                    |
| SVG path drawing       | `pathLength` on `motion.path`                           |
| Animated counter       | `useSpring` + `useTransform`                            |
| Imperative control     | `useAnimate` hook returns `[scope, animate]`            |
| Custom components      | `motion.create(Component)` wraps any component          |
| Bundle optimization    | `LazyMotion` + `domAnimation` + `m` component (4.6 KB)  |
| Reduced motion         | `MotionConfig reducedMotion="user"`                     |

## Common Mistakes

| Mistake                                                   | Correct Pattern                                                   |
| --------------------------------------------------------- | ----------------------------------------------------------------- |
| AnimatePresence inside a conditional                      | Keep AnimatePresence mounted; place conditional content inside it |
| Missing unique `key` on AnimatePresence children          | Add unique `key` to each direct child for exit animations         |
| Tailwind `transition-*` classes with Motion animate props | Remove Tailwind transition classes to avoid stuttering            |
| Importing from `framer-motion`                            | Use `import { motion } from "motion/react"` (renamed late 2024)   |
| Animating 50+ items without virtualization                | Use react-window or @tanstack/react-virtual for large lists       |
| Full 34 KB bundle for simple animations                   | Use LazyMotion + domAnimation (4.6 KB) or useAnimate (2.3 KB)     |
| Missing `"use client"` in Next.js App Router              | Add directive or use `motion/react-client` import                 |
| Animating `width`/`height` directly                       | Use `layout` prop or `transform: scale` for GPU acceleration      |
| No `prefers-reduced-motion` handling                      | Wrap app in `MotionConfig reducedMotion="user"`                   |

## Delegation

- **Audit animation performance and bundle size**: Use `Explore` agent to find heavy imports, missing LazyMotion, and reflow-triggering properties
- **Build complex multi-step animations**: Use `Task` agent for scroll-linked parallax, shared layout transitions, and staggered sequences
- **Plan animation architecture for a new project**: Use `Plan` agent to evaluate Motion vs AutoAnimate vs CSS-only based on requirements

> If the `design-system` skill is available, delegate animation token definitions and motion design guidelines to it.

## References

- [Core Patterns](references/core-patterns.md) -- Animation patterns: fade, exit, stagger, gestures, modal, accordion, tabs, scroll, layout, drag, SVG, loading
- [Scroll Animations](references/scroll-animations.md) -- useScroll, useTransform, scroll-triggered, parallax, progress indicators, offset configuration
- [Performance](references/performance.md) -- LazyMotion, useAnimate, hardware acceleration, virtualization, production checklist
- [Next.js Integration](references/nextjs-integration.md) -- App Router patterns, motion/react-client, Pages Router, known issues
- [Accessibility & CSS](references/accessibility-css.md) -- prefers-reduced-motion, MotionConfig, useReducedMotion, CSS keyframes, Tailwind animations
- [Library Selection Guide](references/library-selection.md) -- Motion vs AutoAnimate decision guide with feature comparison and use-case recommendations
- [Troubleshooting](references/troubleshooting.md) -- AnimatePresence bugs, Tailwind conflicts, layout glitches, React 19 issues, naming migration

© oakoss · MIT · oakoss/agent-skills

Similar skills

All skills for Frontend and UI →

motion by other authors comes first.

motion motiondivision Create Motion and CSS animations, find implementation examples, and investigate sluggish UI effects. The skill also helps with Motion upgrades and animation audits. CX Codex +1 1,400installs motion secondsky Adds the Motion (Framer Motion) library — drag-and-drop, scroll animations, gestures, SVG morphing, spring physics. CX Codex +1 1,100installs motion Mindrally Guides coding agents to build hardware-accelerated animations using the Motion library in vanilla JavaScript and TypeScript. CX Codex +1 861installs motion raphaelsalaja This Claude Code skill sets interface motion rules for transitions, gestures, timing, and blur. It applies when an agent builds or changes animated UI behaviour. CX Codex +1 259installs nextjs-framer-motion-animations tristanmanchester nextjs-framer-motion-animations — a skill that walks an agent through adding or fixing Motion for React in a Next.js app: gestures, exits, layout shifts, shared elements, scroll effects, route changes. CX Codex +1 183installs motion-framer freshtechbro motion-framer guides an agent through Motion and Framer Motion animations for React interfaces, from hover effects to state and layout transitions. CX Codex +1 6,800installs framer-motion AThevon Guides coding agents on Framer Motion and Motion patterns in React: layout transitions, gestures, and DOM-direct motion values. CX Codex +1 1,000installs framer-motion-animator patricio0312rev framer-motion-animator generates smooth Framer Motion animations and micro-interactions in React. Useful for building page transitions, drag gestures, and scroll effects. CX Codex +1 11,700installs motion-patterns jeff motion-patterns — a skill with reusable animation patterns for React and Next.js. Use it for buttons, modals, toast notifications, page transitions, scroll reveals, and layout changes. CX Codex +1 6,500installs motion-dev-animations Motion Dev Standards Generates GPU-accelerated Motion.dev animations for React, Next.js, Svelte, and Astro. Implements spring physics, gesture handling, and scroll reveals with accessibility checks. CX Codex +1 714installs

From the same set106

The whole set →

Project sponsors

Companies that keep this analytics open