Most apps ship 46 KB of Framer Motion just to fade cards in and scale buttons on hover. This skill audits every animation file-by-file, solves exact CSS linear() springs to match your physics, leaves complex gesture work alone, and tells you how many KB you deleted.

Damped spring · Bouncy (680ms)Identical path · 0 KB JS
framer-motion
46.2 KB gz
CSS linear()
0 KB JS
transition: transform 680ms linear(0, 0.068, 0.483, 1.226, 0.903, 1)

Install

Copy the skill URL or pick your coding agent below. One file, no npm packages, MIT licensed.

https://hairlineui.com/skills/kill-framer-motion.md

Claude Code

Works in: Claude Code CLI, VS Code & JetBrains extensions, and Claude Desktop Code tab

Run this once inside your project (or use ~/.claude/skills for every project).

terminal
mkdir -p .claude/skills/kill-framer-motion && curl -sL https://hairlineui.com/skills/kill-framer-motion.md -o .claude/skills/kill-framer-motion/SKILL.md

Restart or type /kill-framer-motion in Claude Code. It scans the repo, runs the Chromium verifier, and reports every fix.

  • Zero redesign risk. Leaves your layout, brand colours, typography and component library alone.

  • Verified, not guessed. Every skill pairs static checks with a standalone verifier that proves the before and after counts.

  • No lock-in, MIT. Plain markdown plus a standalone script. Works on React, Next.js, Vue, Svelte, Astro or plain HTML.

What it catches

Every rule targets an objective browser defect and pairs a detection check with a root-cause fix.

  1. whileHover & whileTap pulling 46 KB of JS

    Mounting motion.button just for a 3% press or hover scale drags the entire animation runtime into first-load hydration.

    Replaces with pure CSS transition-[scale,transform] driven by a solved CSS linear() spring token and reduced-motion guards.

  2. AnimatePresence height:"auto" accordions

    Measuring DOM height in JS for FAQ rows and collapsible sections adds runtime overhead and layout jitter.

    Replaces with pure CSS grid-template-rows: 0fr -> 1fr plus overflow-clip and inert on the closed inner panel.

  3. Mount fades & whileInView scroll reveals

    Using motion.div purely for opacity 0 -> 1 and translateY(12px) -> 0 adds JS overhead to static marketing sections.

    Replaces with lightweight CSS @keyframes (fill-mode: backwards) and a 15-line IntersectionObserver hook.

  4. Single-row layoutId tab indicators

    Sliding a pill between tabs in one bar rarely needs a full layout-projection engine.

    Measures active offsetLeft/offsetWidth once in useLayoutEffect and glides a single indicator with transform.

  5. Exact spring physics preserved in CSS linear()

    Hand-guessing ease-out ruins the bounce and feel of existing spring transitions.

    Runs the bundled closed-form damped oscillator (--spring stiffness,damping,mass) to emit the exact CSS linear() curve and settle time.

  6. Honest KEEP list for real gesture physics

    Blindly ripping out complex drag-and-drop constraints or cross-route shared-element FLIP breaks UX.

    Leaves files using useDragControls, dragConstraints, or complex scroll timelines untouched and flags them clearly.

Static analyzer & spring solver

Pure Node.js with zero dependencies (runs in under 200ms). Reads package.json and scans every .tsx/.jsx/.ts/.js file to classify imports into REPLACEABLE (whileHover, whileTap, whileInView, initial/animate, simple AnimatePresence) vs KEEP (dragConstraints, useDragControls, multi-track useScroll/useTransform), estimates gzipped KB saved, and includes --spring k,c,m to solve exact CSS linear() curves.

curl -sL https://hairlineui.com/skills/kill-framer-motion-check.mjs -o /tmp/kill-framer-motion-check.mjsnode /tmp/kill-framer-motion-check.mjs .  # or --spring 320,24,1

Then just run it

Run it on a single page while building, or across your main routes before shipping.

  • “Run /kill-framer-motion on this repo — tell me which files are trivially replaceable vs worth keeping, then migrate the simple ones.”

  • “Use /kill-framer-motion to replace our FAQ accordion and hover cards with CSS linear() springs and remove framer-motion if zero imports remain.”

  • “Generate CSS linear() spring tokens for stiffness 320 / damping 24 using /kill-framer-motion and migrate our pricing toggle.”

Source

Read every line before installing. Both files are plain text under the MIT licence.

---name: kill-framer-motiondescription: Audit Framer Motion, Motion, and GSAP usage across your codebase, classify the ~90% of simple animations that do not need a JS animation runtime, replace them with mathematically matched CSS linear() springs, grid-template-rows folds, @starting-style, and WAAPI, and report the exact gzipped KB removed. Leaves genuinely complex shared-layout or gesture physics untouched.license: MITmetadata:  author: Hairline UI  url: https://hairlineui.com/skills/kill-framer-motion  version: "1.0.0"---# /kill-framer-motionFind the 90% of `framer-motion`, `motion/react`, `gsap`, and `aos` animations in your app that don't need a 35–50 KB JavaScript runtime, replace them with mathematically matched **CSS `linear()` springs**, `grid-template-rows: 0fr -> 1fr`, `@starting-style`, and the Web Animations API (`element.animate`), and report the exact bundle KB deleted.This skill is **honest and surgical**: it never destroys complex animations that genuinely benefit from a JS orchestration engine (cross-route `layoutId` shared elements, multi-axis spring drag physics, complex timelines). It only replaces the trivial hovers, taps, fades, modals, accordions, and tab slides that bloat hydration for zero visual gain.## Guardrails (never break these)- **Preserve the exact spring feel.** Never replace a crisp spring (`stiffness: 300, damping: 24`) with a lazy `ease-in-out`. Use the bundled `--spring` solver to generate the exact matching CSS `linear()` curve and settle duration.- **Leave truly complex animations alone.** If a component relies on cross-component `layoutId`, complex `useScroll` + `useTransform` multi-track scrubbing, or `dragConstraints` + `useDragControls`, keep it — and report clearly why it stayed.- **Respect `prefers-reduced-motion: reduce`** on every CSS transition, keyframe, and WAAPI replacement (`motion-reduce:transition-none motion-reduce:animate-none`).- **Only uninstall the package once 0 imports remain** across the entire codebase, and verify with typecheck + production build.---## Step 1 — Run the zero-dependency migration analyzerFetch and run the standalone analyzer directly against your repo root (pure Node.js, zero dependencies, runs in `< 200ms`):```bashcurl -sL https://hairlineui.com/skills/kill-framer-motion-check.mjs -o /tmp/kill-framer-motion-check.mjsnode /tmp/kill-framer-motion-check.mjs .```*(On Windows PowerShell: `curl.exe -sL https://hairlineui.com/skills/kill-framer-motion-check.mjs -o $env:TEMP\kill-framer-motion-check.mjs` then `node $env:TEMP\kill-framer-motion-check.mjs .`.)*The analyzer prints:- Installed animation packages and estimated gzipped runtime size (`framer-motion`, `motion`, `gsap`, `aos`, `animejs`, `@react-spring/web`).- Every importing file classified into **`REPLACEABLE`** vs **`KEEP`** with the exact APIs used (`whileHover`, `whileTap`, `initial/animate`, `whileInView`, `AnimatePresence`, vs `layoutId`, `drag`, `useTransform`).- Whether the package can be fully uninstalled and total estimated gzipped KB saved.### Generate exact CSS `linear()` springs from any Framer Motion configWhenever you replace a `transition={{ type: "spring", stiffness, damping, mass }}`, run the built-in physics solver so the CSS curve matches the JS spring frame for frame:```bashnode /tmp/kill-framer-motion-check.mjs --spring 320,24,1```It outputs the exact `linear(...)` timing function and settle duration in milliseconds, ready to drop into CSS or Tailwind v4 `@theme`.---## Step 2 — Replace each replaceable pattern with zero-dep equivalents### 2.1 `whileHover` & `whileTap` (hover lift / tactile press)```tsx// Before (pulls 46 KB framer-motion runtime onto a button)<motion.button whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.97 }} transition={{ type: "spring", stiffness: 400, damping: 25 }}>  Save</motion.button>// After (0 KB JS — exact CSS linear() spring, Tailwind v4 transitions `scale` explicitly)<button  type="button"  className="transition-[scale,background-color] duration-[380ms] ease-[var(--spring-snappy)] hover:scale-[1.02] active:scale-[0.97] motion-reduce:transition-none motion-reduce:hover:scale-100 motion-reduce:active:scale-100">  Save</button>```### 2.2 `initial={{ opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }}` (mount entrance)Use a tiny CSS `@keyframes` rule (or `@starting-style` for elements toggled from `display: none`):```css@keyframes fade-up {  from { opacity: 0; translate: 0 12px; }}.enter-fade-up {  animation: fade-up 480ms cubic-bezier(0.16, 1, 0.3, 1) backwards;}@media (prefers-reduced-motion: reduce) {  .enter-fade-up { animation: none; }}```*(Use `backwards` fill mode, never `both`, so later inline/hover transitions are never overridden by the finished keyframe.)*### 2.3 `AnimatePresence` + `height: "auto"` accordions & collapsiblesNever measure DOM height in JS for simple expand/collapse panels:```tsx<div  className="grid transition-[grid-template-rows,opacity] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none"  style={{ gridTemplateRows: open ? '1fr' : '0fr', opacity: open ? 1 : 0 }}>  <div className="min-h-0 overflow-clip" inert={!open}>    {children}  </div></div>```### 2.4 Sliding active tab indicators (`layoutId="active-tab"`)Single-row tab/pill indicators do not need Framer Motion's layout projection engine. Measure `offsetLeft` / `offsetWidth` of the active button once in `useLayoutEffect` and glide a single `<span>` pinned to `left-0` with `transform: translateX(...)` and `width` — zero transition on first paint (`ready` flag), then `cubic-bezier(0.34, 1.36, 0.64, 1)` on `transform`.### 2.5 `whileInView` scroll revealsReplace `motion.div whileInView` with a 15-line shared `IntersectionObserver` hook (`threshold: 0.2`, `unobserve` after first reveal so it runs once) toggling `data-shown="true"`, paired with pure CSS transitions. Keep above-the-fold hero elements animating via CSS on load — never gate first paint behind `IntersectionObserver`.### 2.6 Modal / popover enter & exit transitionsUse native `<dialog>` or mounted phase transitions (`closed | opening | open | closing`) with CSS `opacity` + `scale` (or `@starting-style` + `transition-behavior: allow-discrete` for modern browsers) — zero `AnimatePresence` wrapper needed.### 2.7 Clean up unused packagesOnce `node /tmp/kill-framer-motion-check.mjs .` reports `0` remaining imports for an animation library:1. Remove it from `package.json` (`pnpm remove framer-motion` / `npm uninstall framer-motion`).2. Define any reused CSS `linear()` springs once as custom properties in `globals.css` (`--spring-snappy`, `--spring-bouncy`) generated by `--spring`.---## Step 3 — Verify zero regressions and measure real KB saved1. Re-run the analyzer:   ```bash   node /tmp/kill-framer-motion-check.mjs .   ```2. Run typecheck (`npm run typecheck` / `tsc --noEmit`) and production build (`npm run build`).3. Inspect the replaced interactions in a browser (hover, tap, accordion, modal, tabs, and `prefers-reduced-motion: reduce`) to confirm identical visual feel.---## Step 4 — Report (keep it tight)```text/kill-framer-motion — migration complete  Replaced animations:       21 / 21  (100% migrated)  Kept in JS runtime:             0  Packages removed:          framer-motion (-46.4 KB gzipped est.)  CSS springs generated:          2  (--spring-snappy, --spring-bouncy)Files changed:- src/app/globals.css — added --spring-snappy and --spring-bouncy linear() tokens- src/components/PricingTabs.tsx — replaced layoutId pill with offsetLeft transform glide- src/components/FaqAccordion.tsx — replaced AnimatePresence height:auto with 0fr -> 1fr grid- src/components/HeroCard.tsx — replaced motion.div whileHover/whileTap with CSS scale spring- package.json — removed framer-motionNot replaced (if any):- none```
/skills/kill-framer-motion.md
The full skill in plain markdown with YAML frontmatter. Drop into .claude/skills, .cursor/rules or .agents/skills.
/skills/kill-framer-motion-check.mjs
Standalone Node verifier for /kill-framer-motion. Runs locally with --json and --fail flags.

Templates

Every Hairline template passes these out of the box

65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.