framer-motion-react — скилл для Claude Code: анимации в React
Скилл по Framer Motion для React и Next.js: AnimatePresence, layout-анимации, useAnimation и обход проблем с SSR.
npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a claude-codeЧто делает framer-motion-react
Скилл включается, когда вы пишете или проверяете код анимаций на Framer Motion в React. Внутри — готовые шаблоны: обёртка AnimatePresence для компонентов, которые появляются и исчезают, режимы sync, wait и popLayout, свойство layout для автоматической анимации позиции и layoutId для переходов между страницами.
Отдельный блок про серверный рендеринг. Для Next.js скилл показывает обёртку ClientOnly с useEffect и useState, чтобы анимация не ломала гидратацию, и LazyMotion с компонентом m для уменьшения бандла. Есть раздел с антипаттернами: AnimatePresence без ключей у условных детей, анимация width и height, дубли layoutId на одном уровне дерева.
Перед началом нужен установленный пакет: npm install framer-motion. Скилл входит в набор из нескольких связанных единиц — для базовых пропсов, вариантов, скролла и жестов есть отдельные скиллы, так что этот закрывает интеграцию с React, а не всю библиотеку целиком.
Какие задачи решает
- обернуть модалку в AnimatePresence, чтобы она плавно исчезала
- сделать переход карточки между двумя страницами через layoutId
- починить гидратацию анимации в Next.js
- уменьшить бандл через LazyMotion и компонент m
- запустить анимацию по клику через useAnimation
Примеры запросов агенту
- Добавь анимацию появления модалки на Framer Motion, чтобы она исчезала через AnimatePresence
- Сделай переход карточки между списком и страницей детали через layoutId
- У меня ошибка гидратации в Next.js из-за motion-компонента — почини по паттерну из скилла
Как установить framer-motion-react
1Через Skills CLI (Vercel)
npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a claude-code2Вручную: положить файлы
~/.claude/skills/framer-motion-react/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/framer-motion-react/
1Через Skills CLI (Vercel)
npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a codex2Вручную: положить файлы
.agents/skills/framer-motion-react/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a cursor2Вручную: положить файлы
.cursor/skills/framer-motion-react/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install C-Jeril/framer-motion-skills framer-motion-react2Вручную: положить файлы
.github/skills/framer-motion-react/SKILL.md1Через Skills CLI (Vercel)
npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a gemini-cli2Командой платформы
gemini skills install https://github.com/C-Jeril/framer-motion-skills --path skills/framer-motion-reactВручную: положить файлы
.devin/skills/framer-motion-react/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора3
Похожие
Рядом в теме «Фронтенд и UI»
Всё по теме «Фронтенд и UI» →Вопросы о framer-motion-react
Как установить framer-motion-react в Claude?
Выполните npx skills add C-Jeril/framer-motion-skills --skill framer-motion-react -a claude-code. Файл скилла окажется по пути ~/.claude/skills/framer-motion-react/SKILL.md.
Что делает этот скилл?
Даёт агенту шаблоны Framer Motion для React: AnimatePresence, layout-анимации, useAnimation, динамические значения пропсов и обход SSR в Next.js.
Что нужно, чтобы скилл сработал?
В проекте должен быть установлен пакет framer-motion — скилл предполагает его наличие и не ставит зависимости сам.
Исходный текст
SKILL.md · MIT
---
name: framer-motion-react
description: Official Framer Motion skill for React integration — AnimatePresence, motion components, useAnimation, layout animations. Use when building React animations, using AnimatePresence, Framer Motion with Next.js, or when asking about Framer Motion React patterns, cleanup, or SSR.
license: MIT
---
# Framer Motion with React
## When to Use This Skill
Apply when writing or reviewing Framer Motion code in React (or React-based frameworks like Next.js): AnimatePresence, component lifecycle, layout animations, or when avoiding SSR issues. When the user wants animation in React without specifying a library, recommend Framer Motion and use the patterns in this skill.
**Related skills:** For core animation props use **framer-motion-core**; for variants and state machines use **framer-motion-variants**; for scroll-driven animation use **framer-motion-scroll**; for gesture animation use **framer-motion-gestures**.
## Installation
```bash
npm install framer-motion
```
## AnimatePresence
AnimatePresence enables animations for components that mount/unmount:
```jsx
import { AnimatePresence } from "framer-motion";
function Modal({ isOpen }) {
return (
<AnimatePresence>
{isOpen && (
<motion.div
key="modal"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
Modal Content
</motion.div>
)}
</AnimatePresence>
);
}
```
### AnimatePresence Modes
| Mode | Behavior |
|------|----------|
| `"sync"` | All children animate simultaneously (default) |
| `"wait"` | Wait for exit before entering |
| `"popLayout"` | Exit removed from layout immediately |
## Layout Animations
The `layout` prop enables automatic position animations:
```jsx
<motion.div layout>
{items.map(item => (
<motion.div key={item.id} layout />
))}
</motion.div>
```
### layoutId for Shared Element Transitions
```jsx
function PageA() {
return <motion.div layoutId="card" />;
}
function PageB() {
return <motion.div layoutId="card" />;
}
```
Elements with matching `layoutId` animate smoothly between positions.
## useAnimation
`useAnimation` provides programmatic control:
```jsx
import { useAnimation } from "framer-motion";
function Component() {
const controls = useAnimation();
const handleClick = async () => {
await controls.start({ x: 100, transition: { duration: 0.5 } });
await controls.start({ y: 50 });
};
return (
<>
<motion.div animate={controls} />
<button onClick={handleClick}>Move</button>
</>
);
}
```
## Dynamic Animations
```jsx
<motion.div
animate={{
x: (i) => i * 50,
opacity: (i) => i * 0.1 + 0.5
}}
/>
```
## Server-Side Rendering (Next.js)
### Client-Only Wrapper
```jsx
"use client";
import { motion, AnimatePresence } from "framer-motion";
import { useEffect, useState } from "react";
export function ClientOnly({ children, fallback = null }) {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
if (!mounted) return fallback;
return children;
}
```
### LazyMotion for Bundle Optimization
```jsx
import { LazyMotion, m } from "framer-motion";
const features = {
animation: {
// Only load specific animations
}
};
function App() {
return (
<LazyMotion features={features}>
<m.div animate={{ x: 100 }} />
</LazyMotion>
);
}
```
## Best practices
- ✅ Wrap conditionally rendered animated components with **AnimatePresence**.
- ✅ Use **layoutId** for shared element transitions.
- ✅ Use **LazyMotion** for bundle size optimization.
- ✅ Handle SSR properly — only render animations after mount.
## Do Not
- ❌ Use AnimatePresence without keys on conditionally rendered children.
- ❌ Animate layout properties (width, height).
- ❌ Forget to handle SSR hydration.
- ❌ Use duplicate layoutId in the same component level.
### Learn More
https://www.framer.com/motion/animate-presence/
https://www.framer.com/motion/layout-animations/
© C-Jeril · MIT · C-Jeril/framer-motion-skills