audit-gsap-safety

Audits React and Next.js animation code for GSAP lifecycle violations, memory leaks, and jank.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/marketiv-id/marketiv-web --skill audit-gsap-safety-marketiv-id
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-gsap-safety
Source: https://github.com/marketiv-id/marketiv-web/tree/main/.github/skills/audit-gsap-safety
Command: npx skills add https://github.com/marketiv-id/marketiv-web --skill audit-gsap-safety-marketiv-id

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Animated Next.js/React components often suffer from frame drops, memory leaks, and Strict Mode breakage caused by unsafe GSAP setup, Lenis/ScrollTrigger conflicts, and unguarded DOM access. This Skill performs a strict audit of your animation code, pinpoints the root cause, and delivers refactor-ready fixes. ## Core Features & Use Cases - GSAP Lifecycle Audit: Detects useEffect/useLayoutEffect used for GSAP setup and migrates them to useGSAP with proper scope and cleanup, safe for React Strict Mode. - Lenis & ScrollTrigger Safety Checks: Flags production markers, duplicated Lenis setup, and evidence-based overflow-x: hidden issues affecting scroll metrics and pin spacing. - Render Loop & Media Optimization: Catches per-frame setState in GSAP callbacks and enforces correct next/image usage with priority only for true LCP hero media. - Use Case: Paste a TSX hero section that stutters on scroll, and receive a severity-ranked root cause analysis, an ordered action plan, and a complete copy-paste-ready code fix. ## Quick Start Audit this TSX animation component for GSAP lifecycle violations, memory leaks, and scroll jank, then give me the fixed code.

Frequently Asked Questions about audit-gsap-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix GSAP animations leaking memory in React?

GSAP memory leaks in React typically come from setting up animations in useEffect or useLayoutEffect without proper cleanup. Migrate the setup to useGSAP with a scoped container ref, which handles contextual cleanup automatically and is safe under React Strict Mode.

Why does my GSAP animation break in React Strict Mode?

Strict Mode double-invokes effects, so GSAP instances created in useEffect get duplicated or orphaned. Using useGSAP with a scope ensures animations are created and reverted correctly across the double-mount cycle.

Does overflow-x hidden break Lenis and ScrollTrigger?

Global overflow-x: hidden is not automatically a bug, but it can distort scroll metrics, pin spacing, and trigger offsets in some layouts. It should only be flagged when there is concrete evidence of jitter, offset mismatch, or pin misalignment.

How do I stop setState in GSAP onUpdate from causing jank?

Calling setState inside onUpdate runs a React render on every animation frame, causing render loops and frame drops. Move per-frame updates to direct DOM manipulation via refs or GSAP's own setters instead of React state.

When should I use priority on next/image in animated hero sections?

Apply priority only to hero media that sits in the first viewport and is a genuine LCP candidate. Adding priority to many non-LCP images harms loading performance and is flagged as a low-to-medium severity issue.