agentleFS
ucsandmanucsandman/claude-skills/gsap-nextjs/SKILL.md

gsap-nextjs

Skill5 starsChanged 2 months agoMITView on GitHub

Build or review GSAP animation in Next.js App Router projects: page transitions, enter and exit motion, animated show and hide of conditional content, and scroll-driven effects. Use whenever a Next.js App Router project needs any of these, even if GSAP is not named, and whenever layout jank, interrupted animations, or cleanup matter. Also use to choose between GSAP and React View Transitions for a navigation effect. Not for Pages Router, non-Next.js sites, or isolated GSAP API questions.

2 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 11 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every animated page or component runs through the same lifecycle:

    line 11
  2. Very specific:

    If the Next config has cacheComponents on, the router hides old routes instead of unmounting them.

    line 17
  3. Distinctive:

    Read repository instructions and the current code.

    line 21
  4. Very specific:

    Read the installed Next.js version.

    line 23
  5. Very specific:

    Check the Next config for cacheComponents.

    line 24
  6. Distinctive:

    Look at layouts, navigation components, global CSS, accessibility conventions, tests, and any animation library already in use.

    line 25
  7. Distinctive:

    Keep the project's package manager, language, file layout, styling, and component conventions.

    line 26
  8. Very specific:

    Add GSAP, @gsap/react, or a plugin only when the requested motion needs it.

    line 28
  9. Distinctive:

    Use GSAP when the effect needs:

    line 42
  10. Distinctive:

    Before calling work done: Verification.

    line 59
  11. Distinctive:

    Keep outgoing pages and components mounted and visible through outro and end state.

    line 81
  12. Distinctive:

    When outgoing and incoming content overlap, only the stable wrapper takes up space in the layout.

    line 84
  13. Distinctive:

    Keep native link behavior, focus, scroll, and no-JavaScript readability.

    line 85
  14. Very specific:

    Prefer transforms and autoAlpha.

    line 88
  15. Distinctive:

    Use timelines for sequences.

    line 89
  16. Distinctive:

    Verify in a real browser when practical.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GSAP Next.js

Every animated page or component runs through the same lifecycle:

mount → initial state → intro → settled → outro → end state → unmount

Mount and unmount belong to React. The five phases between them belong to your animation code and happen while the node exists. This skill covers getting those phases right: stable layout, navigation timing, interruptions, and cleanup. The user's request and the existing design decide how things look.

If the Next config has cacheComponents on, the router hides old routes instead of unmounting them. Treat hide as unmount and re-show as mount. See Route lifetime under cacheComponents.

Start with the project

  1. Read repository instructions and the current code.
  2. Confirm the App Router. If the project uses the Pages Router, say this skill does not cover it and stop.
  3. Read the installed Next.js version. Prefer its bundled docs in node_modules/next/dist/docs/ over memory. Version gates: onNavigate and useLinkStatus (15.3), <ViewTransition> and transitionTypes (16.2), <Activity> route preservation when cacheComponents is enabled (16.0, opt-in).
  4. Check the Next config for cacheComponents. It changes how long routes live.
  5. Look at layouts, navigation components, global CSS, accessibility conventions, tests, and any animation library already in use.
  6. Keep the project's package manager, language, file layout, styling, and component conventions.

Add GSAP, @gsap/react, or a plugin only when the requested motion needs it. Do not replace an animation library the project already chose unless asked.

Pick GSAP or View Transitions per effect

Next.js 16.2+ activates React <ViewTransition> on every route navigation with no setup.

Use <ViewTransition> for:

  • A shared element that morphs between two routes.
  • A whole-page slide or crossfade keyed by transitionTypes.
  • A Suspense fallback giving way to loaded content.

These need no lifecycle code and fall back to an instant swap in unsupported browsers.

Use GSAP when the effect needs:

  • An outro that finishes on the live outgoing page before navigation.
  • Interruption, reversal, or scrubbing mid-transition. A view transition is a fixed pair of snapshots.
  • Sequenced timing across many targets, split text, or scroll-linked progress.
  • A completion callback that gates navigation, focus, or unmount.

Mixing is fine: the browser morphs one image while GSAP animates the rest. Never give one element to both in the same transition. See Combining with View Transitions.

Follow the requested motion

The user's request decides effects, direction, timing, easing, and intensity. Map it onto the five phases without changing the look. For anything unspecified, keep the project's existing convention or pick a quiet default.

Read only what you need

  • Page intros and outros, transition-aware links, back and forward, focus, route swaps: App Router navigation.
  • The five phases, GSAP setup, React lifecycle, show and hide, layout stability, scroll, text, plugins: Lifecycle implementation.
  • Before calling work done: Verification.

The official GSAP skills (gsap-core, gsap-react, gsap-timeline, gsap-scrolltrigger, gsap-plugins, gsap-utils, gsap-performance, gsap-frameworks) cover the GSAP API. This skill covers how GSAP fits React and Next.js.

Pieces to add, only as needed

  • One client-only module that registers GSAP and plugins.
  • A route transition boundary around page content.
  • A transition-aware Link and a navigate helper, when the outro must finish before navigation.
  • Refs or data attributes marking the elements a page animates.
  • A controller per page or component that owns its five phases.
  • Intro and outro timeline builders.
  • A presence controller when conditional content must stay mounted through its outro.

Persistent header, nav, and footer live outside the route boundary. A component owns its own lifecycle; the route boundary owns page lifecycles.

Rules

  • GSAP runs only on the client. Scope selectors. Clean up every tween, trigger, split, and listener.
  • Lay out the final page with normal CSS first. One stable wrapper owns the geometry through every phase.
  • Mount, then set initial values, then paint. Users never see the settled state before the intro.
  • Animate to one settled state and clear temporary styles there.
  • Keep outgoing pages and components mounted and visible through outro and end state. Unmount, or let the router hide, only after the end callback.
  • Under cacheComponents, a page lifecycle runs again on re-show against DOM that already holds settled values. Never assume a fresh node.
  • Back and forward never run an outro. Give them an intro-only path.
  • When outgoing and incoming content overlap, only the stable wrapper takes up space in the layout.
  • Keep native link behavior, focus, scroll, and no-JavaScript readability.
  • Prepare incoming targets before revealing the swap. Never flash settled or stale content.
  • Reduced motion reaches the same settled state and still fires every completion callback.
  • Prefer transforms and autoAlpha. Set will-change only while animating, then clear it.
  • Use timelines for sequences. Decide up front what happens on rapid clicks and interrupted animations.
  • Verify in a real browser when practical. Use a production build for route, config, dependency, or release changes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.