Index of every page on this site: llms.txt
All skills
johnpolacek avatar

/gsap-astro

@8ddf542
Run it yourself

Build or review Astro animation: GSAP page transitions, ClientRouter swap hooks, persisted islands, repeated setup, and cleanup. Use for missing or duplicated motion after navigation and choosing transition:animate versus GSAP. Without ClientRouter, use gsap-vanilla. Also covers hidden-content recovery and first-load performance. Not for standalone island frameworks or isolated GSAP API questions.

Use this Skill: https://skilld.dev/gh/johnpolacek/animaxxing-skills/gsap-astro

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈103 tokens for metadata: the name and description. ≈1.6k when used: this file. ≈22k more on demand in 10 files.

Description uses 5.2% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈413 characters, or 5.2%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

GSAP Astro

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

Without <ClientRouter />, use gsap-vanilla for full document loads. With it, mount and unmount correspond to body swaps; module scripts, global listeners, timelines, and persisted elements can survive. Animation owns the five phases between swaps.

Keep the requested look and existing project conventions. Add GSAP/plugins only as needed; do not replace the chosen animation library unless asked.

This skill decides when motion runs. For what moves, and for a feel such as premium or playful, also load the animaxxing skill when it is installed: its recipes and its guide to finding the vibe plug into this lifecycle.

Start with the project

Read repository instructions, existing animation, layouts, navigation, CSS, accessibility conventions, and checks. Then:

  1. Read the installed Astro version. Read node_modules/astro/dist/transitions/router.js, swap-functions.js, and node_modules/astro/components/ClientRouter.astro before trusting memory; the package ships no changelog, so check the release notes for that version. Version gates: <ClientRouter /> (5.0; <ViewTransitions /> in 4.x, removed in 6.0), lifecycle events with loader and newDocument (3.6), form navigation (4.0), transition:persist-props and data-astro-rerun (4.5), swapFunctions (4.15).
  2. Find where <ClientRouter /> is: the shared head, some pages, or nowhere, and its fallback prop. Nowhere means gsap-vanilla, including CSS @view-transition.
  3. Find which framework integrations render islands and which client:* directives are in use.
  4. Check astro.config for prefetch and experimental.clientPrerender.

Choose the engine

Use transition:name / transition:animate for snapshot morphs, fades, or slides under ClientRouter. Use GSAP for live-DOM outros that hold the swap, interruptible sequences, split text, or scroll-linked motion. One engine per element; see combining engines.

Read only what you need

Install the official GSAP skills alongside this repository. Load gsap-core for API details and gsap-frameworks for component setup only as needed.

Rules

  • Preserve invisible intros on successful setup; recover the current incoming owner on failure. Follow the initialization contract before adding hiding rules.
  • GSAP runs after the DOM it targets exists. Scope selectors with gsap.context to the page or component root. Clean up every tween, trigger, split, and listener before the swap that removes its owner.
  • A module script runs once per visit, not once per page. Setup runs from astro:page-load and is correct when it runs again on a new body or twice on the same one.
  • Listeners on document and window outlive the page. Register router listeners once, in one place, and have each handler find the current page before acting.
  • Reserve final geometry with normal CSS and a stable wrapper; overlap outgoing/incoming content without doubling layout space.
  • Set initial values before paint, then reveal. On first load that is the inline head script; after a swap it is astro:before-swap and astro:after-swap. Successful initialization never flashes settled content before the intro, and never a blank page without JavaScript.
  • Clear temporary styles at settled. Use will-change only while animating; this overrides gsap-performance's static hint.
  • Use capability queries for device tiers. Touch states release; controls work without hover.
  • The outro plays on live DOM inside event.loader in astro:before-preparation, and the router waits for it. Never animate in astro:before-swap: the user is looking at a snapshot.
  • Back and forward get an intro-only path. A traverse fires every event, so skip the outro on navigationType === "traverse" on purpose.
  • Keep transition:persist elements out of page-level cleanup and page-level intros. They cross the swap alive, timelines included.
  • Keep native link behavior, the router's history, scroll restoration, and route announcement. Do not add a click interceptor beside the router for motion; the only click listener is the capture-phase guard that holds the lock while a navigation is in flight.
  • Cleanup before the swap kills the page context; it does not revert it. A revert writes the intro's start values back onto a body that is still attached.
  • Reduced motion reaches the same settled state and still fires every completion callback. The router already disables its own animations under prefers-reduced-motion.
  • Use timelines for sequences. Decide up front what happens on rapid clicks and interrupted animations: the router lets a second click abort the first navigation while its outro is running, so first-click-wins needs the lock guard.
  • Verify in a real browser when practical, including a page visited twice, back, forward, and a click during an outro.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts24d3 checks · Risk SAFE
  • Gen Agent Trust Hub26d

    This skill provides technical guidance for implementing GSAP animations and page transitions in Astro projects. It focuses on lifecycle management, performance optimization, and framework-specific integrations. No malicious patterns or security vulnerabilities were detected.

  • Socket24d

    No alerts

  • Snyk26d

    Risk: LOW · No issues

Signed by skilld at 8ddf542. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Activeupdated 4 weeks ago
metadata
{
  "short-description": "GSAP page and component lifecycles in Astro"
}

README badge

README badge for johnpolacek/animaxxing-skills/gsap-astro