Verified SOP & TutorialAudited Score 98/100

The Complete Production SOP: How to Deploy and Run Framer Motion layoutId Shared Morphs in Autonomous AI Agents

Step-by-step SOP to install and run Framer Motion layoutId Shared Morphs in Codex, Claude Code, and Cursor. Includes verified prompts, fixes, and code.

Target Runtimes:codexclaude-codecursorwindsurf
5 min read • Updated for 2026

Technical Overview & Architectural Context

Autonomous coding agents frequently stumble when implementing shared-element transitions with Framer Motion. Without strict boundary definitions, agents routinely duplicate layoutId attributes simultaneously across unmounted branches, apply conflicting CSS transforms that fight Framer Motion's FLIP (First, Last, Invert, Play) calculation, or neglect setting the 'layout' prop alongside layoutId. This triggers distorted border radii, jarring snap-jumps between UI states, and silent runtime warnings that degrade 60 FPS animation targets. The Framer Motion layoutId Shared Morphs skill (framer-motion-layout-id-morph) introduces an automated, deterministic SOP for AI agents. It constrains agents to mutual-exclusion rendering patterns via AnimatePresence, enforces spring-physics defaults (bounce: 0.2, duration: 0.6), and mandates clean layout projection rules. This guarantees fluid, GPU-accelerated pill tabs, sliding indicator highlights, and expandable cards across modern React codebases without context pollution.

Prerequisites & Environment Requirements

Codex Desktop, Claude Code CLI (v0.2.9+), Cursor IDE, or Windsurf installed
Node.js 20+ with pnpm, npm, or bun in workspace sandbox
React 18+ or React 19 with framer-motion 11+ or motion library installed
Git 2.40+ with initialized workspace repository

Verified Search Intents & Long-Tail Queries Solved

SEO Audit Score: 98/100

This operational tutorial is engineered to provide deterministic solutions for these developer search queries:

#install framer-motion-layout-id-morph in cursor ide#claude code framer-motion-layout-id-morph rules#codex desktop framer-motion-layout-id-morph setup tutorial#framer motion shared element layoutId react tab morph#framer motion card to modal morph layoutId bug fix#deterministic design agent SOP framer motion#framer-motion-layout-id-morph sandbox permissions and security score#framer motion layoutId duplicate key console warning fix

Step-by-Step Execution Playbook

1

Local Environment Setup & SKILL.md Mounting

Mount the skill manifest into your agent's configuration directory for instant hot-reloading.

Autonomous runtimes such as Claude Code, Cursor, and Codex automatically parse local skill repositories when placed in `.agents/skills` or `.claude/skills`. This step fetches the raw SKILL.md specification and verifies file permissions within the designated workspace boundary.

Terminal Command
mkdir -p .agents/skills/framer-motion-layout-id-morph && curl -fsSL https://askills.dev/api/skills/framer-motion-layout-id-morph/raw -o .agents/skills/framer-motion-layout-id-morph/SKILL.md
.agents/skills/framer-motion-layout-id-morph/SKILL.md
---
name: "framer-motion-layout-id-morph"
description: "Morph active tabs, selection indicators, and cards using Framer Motion layoutId."
metadata:
  author: "Framer"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "animate active tab pill layoutId"
  - "shared element transition framer"
  - "morph card to modal layoutId"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---
Production Pro-Tip

Place the SKILL.md at your project root under `.claude/skills` or `.cursor/rules` to keep agent instructions localized rather than leaking into global machine profiles.

Sandbox Gotcha

Ensure directory permissions match `fs_write: 'workspace'`. If the agent runs inside a strict container sandbox, relative paths outside `./` will trigger read-only execution exceptions.

2

Dependency & Peer Package Validation

Ensure framer-motion is installed with compatible React bindings in package.json.

Framer Motion layout animations require exact peer dependency alignment with React DOM. In framer-motion v11+, ensure the unified package or the newer lightweight `motion` export is resolvable within the agent's AST parsing boundary.

Terminal Command
pnpm list framer-motion || pnpm add framer-motion
Production Pro-Tip

Instruct the agent to use `import * as motion from 'framer-motion/client'` when authoring Next.js App Router components to prevent server component serialization failures.

Sandbox Gotcha

Never allow agents to install mismatched major versions (e.g., mixing `framer-motion` v10 with React 19 RC) without explicit package-lock updates.

3

Intent Matching & Trigger Invocation

Trigger the deterministic SOP using unambiguous domain prompts.

Agent intent routers evaluate incoming prompts against the skill YAML `triggers` array. Prompts specifying tab morphing, indicator transitions, or card expansion invoke the standardized layoutId design rules directly.

src/components/ActiveTabIndicator.tsx
import { motion } from 'framer-motion';
import { useState } from 'react';

const TABS = ['Overview', 'Analytics', 'Settings'] as const;

export function SegmentedNav() {
  const [activeTab, setActiveTab] = useState<string>(TABS[0]);

  return (
    <nav className="flex space-x-1 rounded-xl bg-slate-900 p-1.5">
      {TABS.map((tab) => {
        const isActive = activeTab === tab;
        return (
          <button
            key={tab}
            onClick={() => setActiveTab(tab)}
            className="relative rounded-lg px-4 py-2 text-sm font-medium text-white outline-none transition-colors"
          >
            {isActive && (
              <motion.span
                layoutId="activeTabPill"
                className="absolute inset-0 z-10 rounded-lg bg-indigo-600 shadow-md"
                transition={{ type: 'spring', bounce: 0.2, duration: 0.6 }}
              />
            )}
            <span className="relative z-20">{tab}</span>
          </button>
        );
      })}
    </nav>
  );
}
Production Pro-Tip

Explicitly mention 'layoutId' and 'spring bounce 0.2' in the user prompt to prime the LLM's attention heads toward this exact skill rule.

Sandbox Gotcha

Do not assign dynamic randomized strings to `layoutId` during re-renders; the ID must remain strictly identical across switching components.

4

Verification, Linting & Output Quality Gate

Execute TypeScript type-checks and test assertions before finalizing the task.

The skill mandates that the agent run project-level type verification to catch invalid prop bindings on `motion.div` or missing `AnimatePresence` imports prior to marking the task complete.

Terminal Command
pnpm tsc --noEmit && pnpm lint
Production Pro-Tip

Instruct the agent to inspect the git diff using `git diff -U1` to verify no extra CSS transitions are fighting Framer Motion layout projections.

Sandbox Gotcha

CSS transitions set to `transition: all 0.3s ease` on the same element with `layoutId` will stutter severely during FLIP transforms. Always strip conflicting CSS transitions.

Real-World Scenario: Build a Shared-Element Morphing Card to Modal Overlay

Tested Trigger Prompt (Feed directly into Codex, Claude, or Cursor):

“Create an interactive portfolio grid using Framer Motion layoutId shared morphs. When clicking an item card, animate and expand it into a modal dialog with shared image and title elements. Follow the framer-motion-layout-id-morph rules.”

Deterministic Agent Verification Pipeline:
Identifies the trigger matching 'morph card to modal layoutId' and activates the Framer Motion skill manifest.
Builds a unified state container tracking `selectedId` with `AnimatePresence` wrapping the expanded modal view.
Applies identical `layoutId={`card-${id}`}` to both the collapsed grid card and the expanded overlay card.
Applies the `layout` prop to inner container wrappers to prevent warped typography and border-radius distortion.
Executes `tsc --noEmit` to verify type safety and ensures return code 0 before concluding the response.

Runtime Troubleshooting & Failure Modes

Error: Warning: Multiple children were found with the same layoutId: "activeTabPill". Ensure all children with this layoutId have unique keys or are not rendered simultaneously.

Root Cause: Two React components rendered with the identical layoutId concurrently in the DOM tree without mutually exclusive conditional rendering or missing AnimatePresence presence tracking.

Resolution Command / Fix:
// Ensure mutual exclusion via strict ternary or unique key in mapped lists:
{isActive && (
  <motion.div
    layoutId="activeTabPill"
    key="active-pill"
    className="absolute inset-0 bg-blue-500 rounded-md"
  />
)}
Error: Layout projection distortion: Text stretches or border-radius collapses abruptly during shared element transition

Root Cause: The motion element changes aspect ratio while morphing, but child elements lack the `layout` prop, causing CSS transform scale distortions rather than correct bounding box recalculation.

Resolution Command / Fix:
// Add layout prop to both parent and internal text/image elements:
<motion.div layout layoutId={`card-${item.id}`} className="rounded-2xl overflow-hidden">
  <motion.h3 layout>{item.title}</motion.h3>
</motion.div>

Frequently Asked Questions (Framer Motion layoutId Shared Morphs SOP)

Q:Can I use Framer Motion layoutId Shared Morphs across Codex, Claude Code, and Cursor simultaneously?

Yes. The skill conforms to the universal SKILL.md specification. Placing it in your repository under `.agents/skills/framer-motion-layout-id-morph/SKILL.md` allows Codex, Claude Code CLI, Cursor, and Windsurf to discover and enforce the exact same layoutId procedural rules.

Q:How does Framer Motion layoutId Shared Morphs prevent context window overflow during long agent sessions?

The skill provides concise, highly targeted procedural constraints (exact spring tuning parameters, presence conditions, and AST patterns) rather than loading entire framework documentation libraries into context, conserving thousands of LLM input tokens.

Q:Does this skill require escalated root or container permissions?

No. The skill is audited with a Security Score of 98/100. It requires only standard workspace file read/write permissions (`fs_read: true`, `fs_write: 'workspace'`) and operates safely without requiring root privileges or unrestricted shell execution.

Ready to equip your autonomous agent with Framer Motion layoutId Shared Morphs?

Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.

Get 1-Click Install Spec