Skip to main content
skill CX Codex

framer-motion · mindrally — Claude Code skill: smooth React animations

Tells your agent which properties to animate in Motion and which ones wreck layout. Useful when the project already runs React and TypeScript.

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

What framer-motion does

This skill turns the agent into a Motion (formerly Framer Motion) reviewer for React and TypeScript. It insists on importing from motion/react, since the old framer-motion path is outdated, and it limits animation to x, y, scale, rotate and opacity — those run on the GPU and skip layout recalculation. Animating width, height, top, left, margin or padding is called out as a source of jank.

Inside are code patterns: variants with staggerChildren for complex scenes, layoutId for shared element transitions, spring transitions instead of durations, AnimatePresence for exit animations, and useScroll with useTransform for parallax. Separate sections cover willChange, memoizing variants and callbacks with useMemo and useCallback, and useReducedMotion so animations respect the system setting.

There is a debugging section too: React DevTools for extra re-renders, the Chrome DevTools Performance tab for stutter, and testing on real devices. The stated target is 60fps, 120fps on high refresh rate displays. If your project animates with CSS or another library, these rules will fight your current code — worth checking before you install.

What it helps with

  • switch imports from framer-motion to motion/react
  • stop jank when animating layout properties
  • add page transitions with AnimatePresence
  • build parallax with useScroll and useTransform
  • honor prefers-reduced-motion in a component

Example prompts for the agent

  • animate this list appearing with a stagger between items
  • why does the modal stutter on close — check it against the framer-motion rules
  • rewrite the page transition with Motion and reduced motion support

How to install framer-motion

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill framer-motion -a claude-code

2Manually: put the files in place

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

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

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

Questions about framer-motion

How do I install framer-motion in Claude?

Run npx skills add Mindrally/skills --skill framer-motion -a claude-code. The skill file lands at ~/.claude/skills/framer-motion/SKILL.md.

What does the framer-motion skill do?

It hands the agent a set of React animation rules: which properties to animate, how to structure variants, gestures, scroll effects and exit animations. It also points at ways to track down extra re-renders and stutter.

Why does it say motion/react instead of framer-motion?

The library was renamed from Framer Motion to Motion, and the old import path is outdated. The skill requires the current API.

Source text

SKILL.md · Apache-2.0
---
name: framer-motion
description: Expert guidelines for building performant animations with Framer Motion/Motion library in React applications
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Framer Motion / Motion Animation Guidelines

You are an expert in Framer Motion (now Motion), React, and TypeScript. Follow these guidelines when creating animations.

## Core Principles

### Import from the Correct Package
- Use `import { motion } from "motion/react"` for React projects (not "framer-motion" - this is outdated)
- The library was renamed from Framer Motion to Motion
- Always use the latest Motion API

### Performance-First Approach
- Animate transform properties (`x`, `y`, `scale`, `rotate`) and `opacity` for best performance
- These properties can be hardware-accelerated and don't trigger layout recalculations
- Avoid animating properties that cause layout shifts like `width`, `height`, `top`, `left`, `margin`, `padding`

## Hardware Acceleration

### Use will-change Properly
```tsx
// When animating transforms
<motion.div
  style={{ willChange: "transform" }}
  animate={{ x: 100, y: 50, scale: 1.2 }}
/>

// When animating other GPU-accelerated properties
<motion.div
  style={{ willChange: "opacity, transform" }}
  animate={{ opacity: 0.5, x: 100 }}
/>
```

### Properties to Add to willChange
- `transform` - for x, y, scale, rotate, skew
- `opacity` - for opacity animations
- `filter` - for blur, brightness, etc.
- `clipPath` - for clip-path animations
- `backgroundColor` - for background color transitions

## Animation Best Practices

### Use Variants for Complex Animations
```tsx
const containerVariants = {
  hidden: { opacity: 0 },
  visible: {
    opacity: 1,
    transition: {
      staggerChildren: 0.1
    }
  }
};

const itemVariants = {
  hidden: { y: 20, opacity: 0 },
  visible: { y: 0, opacity: 1 }
};
```

### Use layoutId for Shared Element Transitions
```tsx
<motion.div layoutId="shared-element" />
```

### Prefer spring Animations
```tsx
// Springs feel more natural than duration-based animations
<motion.div
  animate={{ x: 100 }}
  transition={{ type: "spring", stiffness: 300, damping: 30 }}
/>
```

## React Integration

### Memoization for Performance
```tsx
// Memoize animation variants
const variants = useMemo(() => ({
  hidden: { opacity: 0 },
  visible: { opacity: 1 }
}), []);

// Memoize callbacks
const handleAnimationComplete = useCallback(() => {
  // handler logic
}, []);
```

### Avoid Inline Style Objects
```tsx
// Bad - creates new object on every render
<motion.div style={{ willChange: "transform" }} />

// Good - define outside or memoize
const style = { willChange: "transform" };
<motion.div style={style} />
```

## Accessibility

### Respect Reduced Motion Preferences
```tsx
import { useReducedMotion } from "motion/react";

function Component() {
  const shouldReduceMotion = useReducedMotion();

  return (
    <motion.div
      animate={{ x: shouldReduceMotion ? 0 : 100 }}
      transition={{ duration: shouldReduceMotion ? 0 : 0.3 }}
    />
  );
}
```

## Gesture Animations

### Use Gesture Props Correctly
```tsx
<motion.button
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  transition={{ type: "spring", stiffness: 400, damping: 17 }}
/>
```

## Scroll Animations

### Use useScroll for Scroll-Linked Animations
```tsx
import { useScroll, useTransform, motion } from "motion/react";

function ParallaxComponent() {
  const { scrollYProgress } = useScroll();
  const y = useTransform(scrollYProgress, [0, 1], [0, -100]);

  return <motion.div style={{ y }} />;
}
```

## Exit Animations

### Use AnimatePresence for Exit Animations
```tsx
import { AnimatePresence, motion } from "motion/react";

<AnimatePresence mode="wait">
  {isVisible && (
    <motion.div
      key="modal"
      initial={{ opacity: 0 }}
      animate={{ opacity: 1 }}
      exit={{ opacity: 0 }}
    />
  )}
</AnimatePresence>
```

## Common Patterns

### Staggered List Animation
```tsx
<motion.ul
  initial="hidden"
  animate="visible"
  variants={{
    visible: { transition: { staggerChildren: 0.07 } }
  }}
>
  {items.map((item) => (
    <motion.li
      key={item.id}
      variants={{
        hidden: { opacity: 0, y: 20 },
        visible: { opacity: 1, y: 0 }
      }}
    />
  ))}
</motion.ul>
```

### Page Transitions
```tsx
const pageTransition = {
  initial: { opacity: 0, x: -20 },
  animate: { opacity: 1, x: 0 },
  exit: { opacity: 0, x: 20 },
  transition: { duration: 0.3 }
};
```

## Performance Debugging

- Use React DevTools to inspect re-renders
- Use Chrome DevTools Performance tab to identify animation jank
- Target 60fps minimum, 120fps on high refresh rate displays
- Test on actual devices, especially mid-range Android phones

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Frontend and UI →

framer-motion by other authors comes first.

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 990installs framer-motion pproenca Optimizes React animations using Framer Motion guidelines: slashes bundle size, eliminates unnecessary re-renders, and polishes gesture or scroll transitions. CX Codex +1 1,100installs framer-motion dylantarre This skill guides the agent in implementing Disney's 12 animation principles with Framer Motion in React. Useful for building UI transitions and gesture animations. CX Codex +1 1,700installs motion-framer freshtechbro Guides an agent through Motion and Framer Motion animations for React interfaces, from hover effects to state and layout transitions. CX Codex +1 5,900installs framer-motion-scroll C-Jeril A Framer Motion skill that tells your agent how to build scroll-linked animations, parallax and progress indicators. CX Codex +1 803installs framer-motion-gestures C-Jeril A skill covering Framer Motion gesture animations: drag, pan, tap, hover and focus. Useful when you build interactive elements and need the prop details at hand. CX Codex +1 766installs motion-patterns jeff 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 4,700installs motion secondsky A skill that feeds your agent the Motion (Framer Motion) docs for React: drag-and-drop, scroll effects, layout transitions. Useful when the agent guesses at props. CX Codex +1 1,100installs motion-foundations jeff Defines motion tokens, spring presets, performance rules and prefers-reduced-motion support for motion/react. The foundation other motion skills inherit from. CX Codex +1 4,700installs

From the same set168

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor