agentsclimarketplace

Enhance web web3d

Skill kensaurus/cursor-kenji/skills/enhance-web-web3d

πŸ¦–Curated Cursor AI agent skills, slash commands, MCP configs, subagents & rules for full-stack dev β€” React 19, Next.js 15, Supabase, Tailwind v4, TypeScript

Install
npx -y skills add kensaurus/cursor-kenji --skill enhance-web-web3d

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Add 3D and scroll-driven motion to an existing website or web app β€” Three.js / React Three Fiber for the scene, GSAP ScrollTrigger for scroll-driven choreography, and Motion / React Spring for UI and physics. Works with any web stack (Next.js, Vite, Astro, Remix, vanilla) and any styling system. Use when the user asks to "add 3D", "add a WebGL hero", "make it cinematic", "scroll-driven 3D", "three.js scene", "React Three Fiber", "GSAP scroll animation", "product configurator", "make the landing page feel immersive", "add a 3D model viewer", "parallax / pinned scroll storytelling", or wants to add a "wow factor" / hero effect to a real, existing repo. Scans the codebase, picks the right library combination, and ships the effect with performance budgets, mobile + no-WebGL fallbacks, reduced-motion support, and SSR/hydration safety baked in β€” no rewrites, no broken builds, no janky scroll.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

21.3 KB, as published. Nobody here has run it

Which enhance skill? (surface router)

Your surfaceUse
Web product page / dashboard β€” composition, hierarchy, spacing, motionenhance-web-ui
Web product page β€” UX heuristics, flows, data wiringenhance-web-ux
Web landing / marketing / portfolio (greenfield, anti-slop)enhance-web-landing
Web existing site upgrade (audit-first, preserve behavior)enhance-web-redesign
Web 3D / WebGL / cinematic scroll on an existing site (audit-first)enhance-web-web3d
React Native screen (Expo / bare)mobile-rn-screen
Capacitor / hybrid shell (one web app shipped to iOS + Android)enhance-capacitor-ui (axis architecture first) β†’ then the web or rn skill
Repo README showcaseenhance-readme

You are here: enhance-web-web3d. Native iOS/Android (SwiftUI / Compose, no web layer) is out of scope for all of these β€” use Apple HIG / Material directly.

Enhance Web with 3D & Cinematic Motion

Add Three.js / React Three Fiber scenes, GSAP scroll choreography, and physics motion to an existing web project β€” without rewriting it, breaking the build, blowing the performance budget, or shipping a blank canvas to users on weak devices or with WebGL disabled.

This is not a "drop a spinning cube on the homepage" skill. It audits the repo first, decides whether 3D actually serves the page, picks the smallest library combination that fits the existing stack, and ships the effect with fallbacks and reduced-motion support from the first commit.

For greenfield / from-scratch 3D library mechanics (raw Three.js scene setup, R3F primitives, shader authoring), this skill points you at the deeper references but stays focused on integrating into a live repo. For pure visual composition (no 3D) use enhance-web-ui; for anti-slop landing pages use enhance-web-landing.


How This Works

When applied to an existing project, follow this sequence. Never skip the audit and jump to code β€” that is how 3D ends up as a 4 MB hero nobody on mobile can load.

  1. Scan β€” Read the codebase. Identify framework, rendering model (SSR / SSG / SPA), styling system, existing motion/3D libraries, build tool, and the current performance baseline.
  2. Fit check β€” Decide whether 3D/cinematic motion belongs on this surface and where. Reject 3D-for-3D's-sake.
  3. Diagnose β€” Map concrete opportunities (hero, product viewer, scroll-story, background ambience) and the constraints around each.
  4. Choose stack β€” Use the Decision Matrix to pick the minimal library combination that fits the existing stack.
  5. Implement β€” Build with the chosen pattern, wiring performance budget, fallbacks, reduced-motion, and SSR/hydration safety in the same change.
  6. Verify β€” Profile on a mid-tier device, test the no-WebGL and reduced-motion paths, confirm Lighthouse / Web Vitals didn't regress.

Phase 0: Fit Check (does 3D belong here?)

Before touching any library, answer these. If you can't justify the effect, the right move is enhance-web-ui or enhance-web-landing, not WebGL.

  • Does the effect serve comprehension or brand, or is it decoration? A product configurator, a data-driven globe, a hero that shows the actual product in 3D β€” these earn their cost. A generic floating-blob background usually does not.
  • What is the performance budget? A marketing landing page can spend more than a dashboard a user opens 40Γ— a day. Name the budget (KB, LCP, INP, target FPS) before designing.
  • Who is the audience / device mix? Heavy mobile traffic β†’ design the mobile fallback first, then enhance up. Desktop-only internal tool β†’ you have more headroom.
  • Is there a non-3D alternative that's 90% as good for 10% of the cost? A pre-rendered <video>, an animated SVG, a CSS scroll effect, or a high-quality image sequence often beats live WebGL. The DEV community lesson holds: a scripted DOM/GSAP walkthrough can be under 40 KB gzip vs a multi-MB MP4/GIF β€” reach for real WebGL only when interactivity or true 3D depth is the point.
  • Reduced-motion + no-WebGL story exists? If you can't describe what a prefers-reduced-motion user and a no-WebGL user see, you're not ready to build.

Anti-slop guardrail. A spinning torus knot, a particle field with no meaning, or a tilt-on-mouse card that fights scrolling are the 3D equivalent of the purple-gradient hero. Motion and depth must explain, demo, or brand β€” never just sparkle.


Phase 1: Recon β€” Learn the Existing Stack

Read the entry point, layout, and any existing animated component. Then record:

FRAMEWORK: [Next.js (app/pages?) / Vite+React / Astro / Remix / SvelteKit / vanilla]
RENDER MODEL: [SSR / SSG / CSR β€” matters for hydration + dynamic import]
REACT?: [yes β†’ R3F is on the table | no β†’ vanilla three.js]
STYLING: [Tailwind v3/v4 / CSS modules / styled-components / vanilla]
BUILD TOOL: [Vite / Webpack / Turbopack / esbuild β€” affects code-split + worker setup]
EXISTING MOTION: [framer-motion/motion? GSAP? Lenis? CSS only?]
EXISTING 3D: [three? @react-three/fiber? drei? none?]
PERF BASELINE: [current LCP / bundle size / Lighthouse, if measurable]
ASSET PIPELINE: [is there a /public model dir? a CDN? Draco/KTX2 already set up?]

Check the dependency manifest before importing anything β€” reuse what's installed, match the installed major version (three, @react-three/fiber, gsap, motion vs framer-motion), and never hallucinate an import.

Search for prior art and guard comments:

rg -l "three|@react-three|gsap|ScrollTrigger|Lenis|framer-motion|\"motion\"" --type ts --type tsx package.json
rg -n "useGSAP|registerPlugin|<Canvas|useFrame|frameloop" src/
rg -n "prefers-reduced-motion|matchMedia|DO NOT|deprecated" src/

Phase 2: Opportunity Audit β€” Where 3D Earns Its Place

Map the page to one (rarely more than two) of these archetypes. Each has a different cost/benefit and a different stack.

OpportunityWhat it isEarns its cost whenDefault stack
Hero sceneFirst-fold 3D centerpieceThe product is visual/physicalThree.js or R3F + a light entrance tween
Product viewer / configuratorRotate/zoom/customize a modelUsers decide based on the objectR3F + drei (OrbitControls, Environment)
Scroll story (pinned)Camera/model animates as you scrollThere's a narrative or process to revealGSAP ScrollTrigger (pin + scrub) driving the scene
Ambient backgroundSubtle depth behind contentBrand texture, low-distractionCheap shader / instanced particles, frameloop="demand"
Data viz in 3DGlobe, graph, point cloudThe data is inherently spatialR3F + instancing; or 2D if it reads better flat
Micro-interactionHover/drag physics on a cardDelight on a key CTAMotion / React Spring (often no Three.js at all)

Rule: one focal 3D moment per page beats five. If everything moves, nothing is special β€” the same hierarchy logic as enhance-web-ui applies in three dimensions.


Phase 3: Decision Matrix β€” Pick the Minimal Stack

GSAP is 100% free for all use since April 2025 (all former Club/bonus plugins β€” ScrollTrigger, SplitText, MorphSVG, etc. β€” included), so plugin licensing is no longer a reason to avoid it.

Use caseRecommended stackRationale
Marketing page, scroll-driven 3DThree.js (or R3F) + GSAP ScrollTrigger + HTML/Motion overlaysGSAP owns scroll orchestration; clean layer separation
React app, interactive 3D viewerR3F + drei + MotionDeclarative, state-driven, component-based
Timeline-choreographed sequencesR3F + GSAP (timeline in useGSAP)GSAP timeline control over R3F objects
Physics-y drag / momentum / gesturesR3F + React Spring (@react-spring/three)Spring physics feel natural
High-count particles / instancesThree.js + GSAP, InstancedMesh/BatchedMeshImperative control, minimal overhead
Smooth-scroll feel under GSAPadd Lenis (lenis / react-lenis)Inertia scroll that ScrollTrigger can drive
Pure UI delight (no real 3D)Motion or React Spring onlyDon't pull in WebGL for a hover effect
Non-React repovanilla three.js + GSAPR3F requires React; don't add React for one scene

One animation system per property. GSAP or React Spring or Motion animating a given transform β€” never two on the same property. Coordinate by timing or split properties (GSAP drives position, Spring drives scale).


Phase 4: Integration Patterns

Pick the pattern that matches the stack from Phase 3. Full, current code lives in the foundation references (see Research & Foundation Skills); below are the load-bearing shapes and the integration glue.

Pattern A β€” Layered Separation (vanilla three.js + GSAP + HTML)

Best for non-React repos and marketing sites. Three layers: a 3D layer (scene/camera/render loop), an animation layer (GSAP ScrollTrigger), and an HTML/UI overlay. The scene exposes refs (camera, key meshes); GSAP animates those refs on scroll; HTML sits on top.

// scroll.js β€” GSAP drives the scene's exposed refs
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);

export function initScrollAnimations({ camera, model }) {
 const tl = gsap.timeline({
 scrollTrigger: { trigger: "#stage", start: "top top", end: "+=3000", scrub: 1, pin: true },
 });
 tl.to(camera.position, { x: 5, z: 10, onUpdate: () => camera.lookAt(0, 0, 0) })
 .to(model.rotation, { y: Math.PI * 2 }, 0);
 return () => tl.scrollTrigger?.kill(); // always return teardown
}

Pattern B β€” Unified React (R3F + Motion)

Best for React apps with interactive, state-driven 3D. <Canvas> holds the scene; motion.div overlays carry HTML. Keep per-frame work in useFrame mutating refs, never React state.

// Lazy-load the canvas so WebGL never blocks first paint / SSR
const Scene = dynamic(() => import("./Scene"), { ssr: false, loading: () => <Poster /> });

<Canvas camera={{ position: [0, 2, 5], fov: 45 }} dpr={[1, 1.5]} frameloop="demand">
 <Suspense fallback={null}><Scene /></Suspense>
</Canvas>

Pattern C β€” Hybrid (R3F + GSAP timelines)

R3F renders; GSAP choreographs. Create the timeline inside useGSAP (scoped, auto-cleaned) and target the R3F object's .current.

import { useGSAP } from "@gsap/react";
useGSAP(() => {
 const tl = gsap.timeline({ scrollTrigger: { trigger: ref.current, scrub: 1 } });
 tl.to(groupRef.current.position, { y: 2, ease: "power2.inOut" });
}, { scope: ref }); // useGSAP reverts on unmount β€” handles Strict Mode double-invoke

Pattern D β€” Physics (R3F + React Spring)

@react-spring/three for drag/momentum/gesture feedback that should feel weighty. Spring owns scale/position; nothing else touches those props.


Phase 5: Performance Budget (bake in, don't bolt on)

WebGL is expensive and degrades hard on weak devices. Apply these from the first commit, not after a complaint.

Render loop

  • Cap DPR: dpr={[1, 1.5]} (R3F) / renderer.setPixelRatio(Math.min(devicePixelRatio, 2)).
  • Render on demand where possible: R3F frameloop="demand" + invalidate() on change; vanilla β†’ only render when something changed or controls are active.
  • Pause off-screen. IntersectionObserver stops the loop when the canvas leaves the viewport.
  • Never read/write React state in useFrame β€” mutate refs. State in the loop forces 60 fps re-renders.

Draw calls & geometry

  • Aim for < 100 draw calls/frame. Use InstancedMesh / BatchedMesh for repeated objects; merge static geometry.
  • Reuse geometries and materials; don't allocate inside the loop.
  • LOD for large scenes; simpler shaders + reduced geometry on mobile.

Assets

  • glTF + Draco for meshes (50–80% smaller); KTX2/Basis for textures (3–5Γ— smaller, lower GPU memory).
  • Power-of-two textures, mipmaps, correct colorSpace (SRGBColorSpace).
  • Lazy-load 3D below the fold; code-split the Three.js/R3F bundle; preload only critical assets. Never lazy-load the LCP element itself.

Modern renderer (optional, current)

  • WebGPU is production-ready since three r171: import { WebGPURenderer } from "three/webgpu" ships one renderer with automatic WebGL2 fallback. Use forceWebGL: true to test the fallback path. No urgent migration if a WebGL2 app already runs smoothly.

Main thread (advanced)

  • For heavy scenes, consider OffscreenCanvas + Web Worker to keep the main thread free for UI/INP.

Cleanup

  • dispose() every geometry / material / texture / render target on unmount; renderer.dispose(). Kill GSAP tweens/ScrollTriggers (useGSAP does this for you).

Phase 6: Accessibility & Graceful Degradation

A 3D enhancement that breaks for some users is a regression, not an upgrade.

  • Reduced motion. Respect prefers-reduced-motion: disable scroll scrub / auto-rotation / parallax, or swap to a static poster frame. Gate at the source so the whole scene honors it.
const reduce = typeof window !== "undefined"
 && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
// reduce ? render static poster / no scrub : full experience
  • No-WebGL fallback. Feature-detect; if WebGL/WebGPU is unavailable, render a static image/<video>/SVG that preserves the visual language and the conversion path. Never a blank canvas.
  • Mobile fallback designed first, then enhanced up β€” simpler scene, fewer particles, no heavy post-processing, fewer transparent layers.
  • Keep semantic HTML for anything interactive. Buttons, links, and text content live in real DOM (overlay), not as click targets inside the canvas β€” screen readers and keyboard users need them, and it protects INP.
  • Don't trap scroll or focus. Pinned scroll sections must release; the canvas must not steal keyboard focus or block tabbing.
  • Protect LCP. The hero's largest contentful element should not wait on WebGL init β€” show a poster immediately, hydrate the scene after.

Phase 7: SSR / Hydration Safety

The most common way 3D breaks an existing app is server rendering and React Strict Mode.

  • Don't render WebGL on the server. Next.js: dynamic(() => import("./Scene"), { ssr: false }). Guard any window/document access with a client check.
  • Use useGSAP() from @gsap/react, not bare useEffect β€” it scopes selectors and auto-reverts animations on unmount, surviving route changes and Strict Mode's double-invoke. Never create tweens in the render body (a new animation per re-render).
  • Clean up everything on unmount β€” ScrollTriggers, RAF loops, resize listeners, IntersectionObservers, disposables.
  • Lenis (if used): integrate with ScrollTrigger via the recommended lenis.on("scroll", ScrollTrigger.update) + ticker wiring so scroll position stays in sync.

Common Pitfalls

PitfallFix
Two libraries animate the same propertyOne system per property; split or sequence
React state mutated in useFrameMutate refs; lift state out of the loop
Scene renders every frame while idle/off-screenframeloop="demand" + IntersectionObserver pause
GSAP tween created in render bodyWrap in useGSAP / contextSafe
Blank canvas on no-WebGL / slow deviceFeature-detect + poster/video fallback
WebGL initialized on serverssr: false dynamic import; window guards
Multi-MB model on the heroDraco/KTX2 + lazy-load + poster + device-tier scene
Scroll jank under ScrollTriggerscrub numeric (smoothing), Lenis, refs not state
Memory grows on route changeDispose geometries/materials/textures + kill tweens
Parallax/tilt fights native scrollReduced-motion gate + clamp; don't hijack the wheel

Verification Checklist (run before declaring done)

  • Builds and type-checks; no hallucinated imports; installed versions matched.
  • Profiled on a mid-tier / mobile device or throttled DevTools β€” holds target FPS.
  • Draw calls within budget (renderer.info / stats-gl); DPR capped.
  • prefers-reduced-motion path verified (motion off / poster shown).
  • No-WebGL path verified (DevTools disable WebGL, or forceWebGL + simulated failure) β€” graceful fallback, never blank.
  • Mobile layout + fallback scene verified at a real narrow viewport.
  • LCP/INP/CLS not regressed vs the Phase 1 baseline (Lighthouse before/after).
  • SSR/hydration clean β€” no window is not defined, no hydration mismatch, no Strict Mode double-mount leak.
  • Unmount is clean β€” disposables freed, tweens/observers killed (navigate away and back, watch memory).
  • Interactive elements remain real DOM, keyboard-reachable; canvas doesn't trap focus/scroll.
  • One focal 3D moment per page; the effect explains/demos/brands (passes the Phase 0 fit check).

Rules

  • Work with the existing stack. Don't add React for one scene; don't swap build tools or styling systems.
  • Don't break existing functionality or the build. Lazy-load and feature-gate so the page still works if WebGL fails.
  • Check the dependency manifest before importing; match installed major versions (three, @react-three/fiber, @react-three/drei, gsap, @gsap/react, motion/framer-motion, @react-spring/three, lenis).
  • Keep changes reviewable and scoped to the surface being enhanced.
  • Performance budget, fallbacks, reduced-motion, and SSR safety ship in the same change as the effect β€” not as a follow-up.
  • Add comments only for non-obvious intent (why a DPR cap, why ssr: false), not narration.

When Not To Use

  • Pure visual composition / hierarchy / spacing, no 3D β†’ enhance-web-ui.
  • Greenfield anti-slop landing page β†’ enhance-web-landing.
  • Generic existing-site premium upgrade (no 3D) β†’ enhance-web-redesign.
  • UX heuristics / flows / data wiring β†’ enhance-web-ux.
  • A hover/drag delight that needs no WebGL β†’ design-motion / design-motion.

Research & Foundation Skills

Foundation / deeper mechanics (in this repo):

  • enhance-web-web3d β€” Three.js, R3F, shaders, particle systems (greenfield mechanics).
  • design-motion β€” Framer Motion / Motion, GSAP, CSS animation patterns.
  • design-motion β€” physics-y micro-interactions and delight.
  • audit-performance β€” Core Web Vitals (LCP/INP/CLS), bundle analysis.
  • audit-accessibility β€” reduced-motion, keyboard, screen-reader compliance.

Current external anchors:

Adapted and generalized from the web3d-integration-patterns meta-skill in freshtechbro/claudedesignskills (and its threejs-webgl / gsap-scrolltrigger / react-three-fiber / motion-framer / react-spring-physics foundation skills) into an audit-first, repo-elevation skill in the enhance-web-* family.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.