The Complete Production SOP: How to Deploy and Run Framer Motion Spring Physics & Micro-Interactions in Autonomous AI Agents
Production SOP to install and run Framer Motion Spring Physics & Micro-Interactions in Codex, Claude Code, and Cursor. Includes verified prompts and fixes.
Technical Overview & Architectural Context
Autonomous coding agents frequently generate unoptimized and brittle animation code in React applications. Without the strict boundaries defined in the Framer Motion Spring Physics & Micro-Interactions skill, models frequently animate non-composite layout properties (such as width, height, margin, or top/left offsets). This causes heavy browser layout thrashing, dropped frames, and broken rendering lifecycles. Furthermore, LLMs routinely omit mandatory unique 'key' props when nesting components inside AnimatePresence, completely disabling unmount exit animations. By mounting this deterministic SKILL.md, Codex, Claude Code, Cursor, and Windsurf are constrained to GPU-accelerated transforms (translate3d, scale, rotate) and opacity. The SOP strictly enforces standard spring dynamics (transition={{ type: 'spring', stiffness: 400, damping: 25 }}), automatically corrects DOM nesting traps with motion.create/motion.div, and enforces strict cleanup contracts during component unmount cycles.
Prerequisites & Environment Requirements
Verified Search Intents & Long-Tail Queries Solved
This operational tutorial is engineered to provide deterministic solutions for these developer search queries:
Step-by-Step Execution Playbook
Local Environment Setup & SKILL.md Mounting
Create the local skill manifest directory and inject verified procedural rules.
To make the Framer Motion skill available across agent runtimes (Codex, Claude Code, Cursor, or Windsurf), mount the specification file directly into your global agent skill root or project-level `.agents/skills` repository. The agent runtime parses YAML frontmatter triggers during intent resolution to activate declarative physics constraints.
mkdir -p .agents/skills/framer-motion-micro-interactions && curl -fsSL https://askills.dev/api/skills/framer-motion-micro-interactions/raw -o .agents/skills/framer-motion-micro-interactions/SKILL.md---
name: "framer-motion-micro-interactions"
description: "Build natural, responsive UI micro-interactions and gestures with Framer Motion."
metadata:
author: "Framer"
version: "1.0.0"
runtime_compatibility:
- "codex"
- "claude-code"
- "cursor"
- "windsurf"
triggers:
- "create framer motion button"
- "use animatepresence exit animation"
- "configure spring physics framer"
permissions:
fs_read: true
fs_write: "workspace"
shell_exec: false
net_access: false
---
# Framer Motion Spring Physics & Micro-Interactions
Implements declarative React motion components: whileHover, whileTap, drag constraints, spring physics (damping, stiffness, mass), and AnimatePresence exit animations.
## Execution SOP & Rules
1. Use motion.div rather than standard div elements for animated interactive wrappers.
2. Configure spring transitions: transition={{ type: 'spring', stiffness: 400, damping: 25 }}.
3. Always supply unique, stable key props to elements wrapped in <AnimatePresence>.
4. Animate only GPU-accelerated CSS properties: transform (x, y, scale, rotate) and opacity.Keep the runtime triggers in frontmatter concise; LLM context tokens stay minimal when definitions avoid redundant prose.
Ensure that the agent sandbox possesses write access to the targeted component directory; SKILL.md sets `shell_exec: false` to ensure safety.
Environment Secrets & Dependency Validation
Verify package installation and ensure React peer dependencies do not collide.
Check package.json to verify that `framer-motion` (or `motion` for Motion One/v12) is properly registered. Because this skill operates entirely in client UI code with a 98/100 security score, zero external API keys or remote secrets are required.
pnpm add framer-motion clsx tailwind-merge{
"dependencies": {
"framer-motion": "^11.18.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
}
}In Next.js App Router projects, instruct the agent to append 'use client'; at the top of motion wrappers to prevent SSR serialization errors.
Mixing versions of motion and framer-motion in the same node_modules can induce dual-context bundle bloat and broken layout animations.
Intent Matching & Trigger Invocation
Verify deterministic activation using tested natural language prompts.
Agent runtimes match user requests against the skill's triggers list: 'create framer motion button', 'use animatepresence exit animation', or 'configure spring physics framer'. When matched, the agent switches from emitting standard inline styles to strictly typed, GPU-accelerated Motion components.
"use client";
import { motion } from "framer-motion";
import React from "react";
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children: React.ReactNode;
}
export const InteractiveButton: React.FC<ButtonProps> = ({ children, onClick, ...props }) => {
return (
<motion.button
whileHover={{ scale: 1.03 }}
whileTap={{ scale: 0.97 }}
transition={{ type: "spring", stiffness: 400, damping: 25 }}
className="px-4 py-2 bg-indigo-600 text-white rounded-lg shadow-md focus:outline-none focus:ring-2 focus:ring-indigo-400"
onClick={onClick}
{...props}
>
{children}
</motion.button>
);
};Explicitly mention 'configure spring physics framer' in prompts when creating bespoke micro-interactions to invoke calibrated mass/damping dynamics.
Avoid wrapping children in separate motion tags without layoutId or layout props if you want seamless shared element transitions.
Verification, Linting & Output Quality Gate
Execute automated self-healing checks before accepting agent deliverables.
Instruct the agent to execute TypeScript type-checking and component linting. The verification gate validates that motion props (initial, animate, exit) conform to TargetAndTransition contracts and that no non-GPU properties are being interpolated.
pnpm tsc --noEmit && pnpm eslint src/components/InteractiveButton.tsx#!/usr/bin/env bash
set -euo pipefail
pnpm tsc --noEmit
pnpm buildAsk the agent to run a quick bundle inspection to verify tree-shaking on framer-motion components.
Never allow an agent to use `any` cast to silence motion prop type mismatch errors.
Real-World Scenario: Build an Accessible, Animated Notification Center Toast with Exit Physics
“create framer motion button that triggers a toast notification system, and use animatepresence exit animation with spring physics to slide toasts into view from the right and exit cleanly when dismissed.”
Runtime Troubleshooting & Failure Modes
Root Cause: Directly animating dimensional CSS properties triggers reflow instead of compositing. Framer Motion issues warnings and stutters when dimensional styles compete with layout projection.
// Replace layout reflows with scale transforms:
// BAD: animate={{ width: 300 }}
// GOOD:
animate={{ scaleX: 1, scaleY: 1 }}
initial={{ scaleX: 0.8, scaleY: 0.8 }}
transition={{ type: 'spring', stiffness: 400, damping: 25 }}Root Cause: Children of <AnimatePresence> lack stable, non-index key attributes, or <AnimatePresence> is placed inside the component being conditionalized rather than wrapping the conditional expression in the parent.
// Ensure AnimatePresence is in parent and keys are stable:
<AnimatePresence mode="wait">
{isVisible && (
<motion.div
key={item.id} // Must be unique and persistent across renders
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -10 }}
transition={{ type: 'spring', stiffness: 400, damping: 25 }}
/>
)}
</AnimatePresence>Frequently Asked Questions (Framer Motion Spring Physics & Micro-Interactions SOP)
Q:Can I use Framer Motion Spring Physics & Micro-Interactions across Codex, Claude Code, and Cursor simultaneously?
Yes. This skill adheres strictly to the universal SKILL.md specification. Whether running Claude Code via terminal or Cursor in an IDE, the agent parses the same triggers, constraints, and execution boundaries seamlessly.
Q:How does Framer Motion Spring Physics & Micro-Interactions prevent context window overflow during long agent sessions?
Instead of feeding large documentation chunks to the LLM on every turn, the skill establishes minimal procedural SOPs (GPU transforms, standard stiffness/damping parameters, and AnimatePresence keying), keeping token consumption minimal while eliminating hallucinated motion properties.
Q:Does this skill require escalated root or container permissions?
No. The skill is rated 98/100 on safety: shell execution is disabled by default, network access is not required, and file modifications are strictly constrained to the local workspace directory.
Ready to equip your autonomous agent with Framer Motion Spring Physics & Micro-Interactions?
Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.