AgentSkillsCN

build-experience

以 Svelte 为先的前端体验工程。适用于构建交互式体验:动画效果、3D/WebGL、滚动叙事、数据可视化,或任何视觉/交互类工作。涵盖 GSAP、Threlte 8、D3、Layer Cake、PixiJS、Melt UI、字体排版,以及各类设计模式。触发因素包括:(1) 动画与运动设计;(2) 3D/WebGL 项目;(3) 滚动驱动的叙事;(4) 数据可视化;(5) 无头 UI;(6) 图形与精灵动画。

SKILL.md
--- frontmatter
name: build-experience
description: Svelte-first frontend experience engineering. Use when building interactive experiences: animations, 3D/WebGL, scrollytelling, data visualization, or any visual/interactive work. Covers GSAP, Threlte 8, D3, Layer Cake, PixiJS, Melt UI, typography, and design patterns. Triggers on (1) animation/motion design, (2) 3D/WebGL work, (3) scroll-driven storytelling, (4) data visualization, (5) headless UI, (6) graphics/sprites.

Experience Engineering

Svelte-first patterns for interactive frontend experiences. Uses bun, not npm.

Before visual implementation: Aesthetic direction should be established. If unclear, invoke the artist agent to conduct discovery. The designer and architect need direction to work from.

Claims cite sources inline [Author Year] or in the Sources section.


Framework Decision

ProjectUseWhy
Interactive experienceSvelte 5 + Threlte 8Compiler, smaller bundles, performance
Content siteAstro + Svelte islandsStatic-first, hydrate sparingly
Data journalismSvelte + Layer CakeThe Pudding's stack
Quick prototypeVanilla + GSAPNo build, direct control

Tooling: Always bun, never npm.

Animation Decision Tree

code
Need animation?
├── Simple enter/exit → Svelte transition:fade, in:fly
├── State-driven values → Svelte spring(), tweened()
├── Complex timeline/sequence → GSAP timeline
├── Scroll-driven
│   ├── Simple triggers → Scrollama
│   └── Complex scrub/pin → GSAP ScrollTrigger + Lenis
├── 3D per-frame → Threlte useTask
└── 2D graphics → PixiJS ticker

Motion Library Landscape

LibraryBundleBest ForGotcha
Svelte transitions0KBEnter/exit, simpleBuilt-in
GSAP~23KB coreTimelines, scroll, SVGFree but prohibits Webflow competitors [GSAP License 2025]
Lenis~3KBSmooth scrollProduction standard (not Locomotive)

What Claude doesn't know:

  • Lenis + ScrollTrigger is the Awwwards stack [Darkroom Engineering, Lusion SOTD]
  • GSAP Standard License prohibits "Competitive Products" — tools for visual animation building [GSAP 2025]
  • CSS animation-timeline: scroll() landed in Safari 26 [WebKit 2025]
  • View Transitions API became Baseline Oct 2025 [web.dev 2025]
  • linear() timing function enables CSS springs [Comeau 2024]

Performance Rules

DoDon'tWhy
Animate transform, opacityAnimate width, height, topCompositor-only = 60fps
Batch reads, then writesInterleave reads/writesLayout thrashing
will-change sparinglywill-change: transform everywhereGPU memory on mobile
scrub: 0.5scrub: trueSmoothness without lag

GSAP cleanup is mandatory — memory leaks are common:

svelte
<script>
  import { onMount } from 'svelte';
  import gsap from 'gsap';

  onMount(() => {
    const tl = gsap.timeline();
    // ... animations
    return () => tl.kill(); // REQUIRED
  });
</script>

3D / WebGL Decision Tree

code
Need 3D?
├── Svelte app → Threlte 8
├── Vanilla/other → Three.js direct
├── Banner/tiny → Vanilla WebGL
└── Low-code → Spline (max 1-2 per page)

Need 2D graphics?
├── < 1,000 elements → SVG + GSAP
├── 1,000-10,000 → Canvas 2D
└── 10,000+ → PixiJS (WebGL)

See references/graphics-primitives.md for SVG, Canvas, PixiJS patterns.

Object Count Decision

CountGeometryUseWhy
1-50AnyIndividual meshesSimple, full control
50-10,000SameInstancedMeshOne draw call
1,000+Points onlyPoints/ParticlesGPU particles

Mobile Reality Check

PlatformIssueFix
iOSPhong drops 60→15fpsUse Lambert
iPadisMobilePlatform returns falseFeature detect, not device detect
SafariNo OffscreenCanvasFallback to main thread
All mobileContext drops for inactive tabsHandle contextlost event

Think 2015 mobile for draw call budget.

See references/3d-experiences.md for full patterns.

Scrollytelling Decision

ToolUse WhenGotcha
ScrollamaStep triggers, lightweightIntersection-based, not scroll position
GSAP ScrollTriggerComplex scrub/pin/snapMust kill on destroy
LenisSmooth scroll foundationCombine with ScrollTrigger
CSS scroll-drivenProgressive enhancementStill limited support

What Claude doesn't know:

  • Locomotive Scroll breaks position: sticky [GitHub Issues #282, #30, #401]
  • scroll-snap-type: mandatory dangerous with tall content
  • Passive listeners are non-negotiable
  • NYT Snow Fall team "toned down" flashy transitions for reader focus [OpenNews 2012]

See references/scrollytelling.md for Sticky+Steps pattern, CSS scroll-driven examples, and award-winning implementations.

Typography

Use clamp() for fluid scaling (never pure vw — fails WCAG 1.4.4 [WCAG 2.1]).

See references/typography.md for fluid type patterns, system font stacks, and variable fonts.

Color Systems

OKLCH over HSL: Perceptually uniform, predictable contrast, P3 support [CSS Color Level 4 spec].

Dark mode: Deep grays (not pure black), off-white text, desaturated colors.

See references/color-systems.md for OKLCH syntax, dark mode patterns, and accessible palettes.

"Designed" vs "AI-Generated"

AI TellFix
Sterile, hollowAdd personality, point of view
Symmetric everythingIntentional asymmetry, tension
Generic gradientsContext-specific color choices
Mathematically equal spacingOptical adjustments
No micro-polishHover states, 300-500ms transitions
Linear timingCubic-bezier curves

The gap: Technically correct but emotionally hollow. Visual equality ≠ mathematical equality.

Design System Tooling

ApproachUse WhenTrade-off
TailwindRapid development, utility-firstHTML verbosity
vanilla-extractTypeScript-first, build-time CSSSetup complexity
Panda CSSTailwind-like + CSS-in-JS patternsNewer, smaller ecosystem
CSS ModulesSimple scoping, no runtimeLess dynamic

See references/design-systems.md for design tokens (primitives → semantic → component slots) and production patterns.

Headless UI

LibraryUseWhy
Melt UIMaximum flexibilityBuilder pattern, you render
Bits UIFaster startPre-composed from Melt
shadcn-svelteRapid prototypingBits + Tailwind, own the code

Why headless: Behavior and accessibility are the hard parts. Styling is the easy part you want control over.

See references/headless-ui.md for Melt UI, Bits UI, shadcn-svelte patterns.

Component Patterns

ProblemPatternWhy
3+ layout regionsCompound componentsFlexible composition
Deep prop passingSvelte contextAvoids drilling
Modal/overlayPortal renderingClean z-index
Shared UI stateLocal state, not globalScoped, predictable
Animation sequencesState machineExplicit phases

See references/component-patterns.md for full patterns.

Cognitive Design

Attention & Load

principleapplication
7±2 chunksApplies to recall, NOT visible menus
F-patternFailure mode — indicates poor content
Serial positionFirst AND last positions privileged
Line length45-75 chars optimal

Animation Psychology

durationuse
100-200msMicro-interactions
200-300msComponents
300-500msPage transitions

Asymmetric timing: Enter slower than exit (300ms in, 200ms out).

Audience Targeting

factorevidence
Age decline0.8%/year task slowdown ages 25-60 [Nielsen 2013]
Tailored UIs+30% improvement for older adults [NNg research]
Cultural colorWhite = death in China; red = luck

What Claude gets wrong:

  • 7±2 everywhere (it's recall, not recognition)
  • F-pattern as natural (it's a failure mode)
  • 300ms for everything (different elements need different durations)
  • Western color meanings as universal

See references/cognitive-design.md for full research.

Microcopy & Interaction

Microcopy test: Can you remove a word without losing meaning? Remove it. ("copy" not "click to copy")

Focus states: Use :focus-visible (not :focus), add opacity: 0 transitions (not display: none).

Positioning: Absolute elements need containing blocks; test min AND max content lengths.

Pre-Ship Checklist

Animation: GSAP cleanup on unmount, SSR guards, prefers-reduced-motion, mobile test (iOS), passive listeners.

Design: Optical adjustments, personality, audience (age/culture).

Interaction: Minimal microcopy, visible focus states, edge-case content lengths.

Aesthetic Discovery (Non-Conformist by Design)

Categorical aesthetic agents converge output. Instead: help users discover and articulate their own visual voice.

The Collaboration Model

RoleWhoWhat
Creative directionHumanSpark, synthesis, "I want it to feel like X meets Y"
Articulation supportartist agentHelp explore/express intent, show references, ask questions
Evidencelabcoat agent"For that audience, research shows..."
Structurefront-end-architect agent"That interaction needs this component pattern"
Executionexpert-* agents"Here's how to build that in Svelte/GSAP/etc"

Discovering Your Aesthetic

The skill doesn't prescribe style. It helps users crystallize their own influences through a structured interview process (see assets/aesthetic-interview.md):

  1. Influences - Surface what has moved you (films, games, art, spaces)
  2. Qualities - Extract underlying patterns (density, temperature, precision, energy)
  3. Context - Ground in the specific project and constraints
  4. Synthesis - Build vocabulary and reference shorthand
  5. Crystallization - Optionally persist as personal skill using plugin-dev/extension-builder

Example influences (demonstration, not prescription):

  • Film: Blade Runner, Kubrick's geometric dread, Villeneuve's restrained atmosphere
  • Anime: Ghibli warmth → Death Note tension → Ghost in the Shell density
  • Games: BOTW's invitation vs Elden Ring's hostility (same openness, different emotional register)
  • Web: The Boat (SBS), Wix space exploration

Agents

Four collaborative agents - each with values-based construction and references to internalize:

AgentRole
artistFacilitate aesthetic discovery through dialogue - surfaces influences, builds vocabulary
experience-designerImplement aesthetic vision - typography, color, spacing, visual craft
experience-architectTechnical architecture - components, state, animation structure, performance
experience-labcoatExperience science - UX research, behavioral evidence, validation

The artist + human discover direction. The designer implements it. The architect structures it. The labcoat validates it.

References

Technical knowledge domains - agents internalize relevant references before working.

Fundamentals:

ReferenceContent
references/html.mdSemantic structure, accessibility, ARIA, document architecture
references/css.mdModern CSS, layout, custom properties, container queries, layers
references/javascript.mdLanguage patterns, async, performance, Web APIs

Svelte Ecosystem:

ReferenceContent
references/svelte-patterns.mdSvelte 5 runes, SvelteKit, Threlte 8

Visual Implementation:

ReferenceContent
references/typography.mdFluid type, variable fonts, type scales
references/color-systems.mdOKLCH, accessible palettes, dark mode
references/design-systems.mdTokens, Tailwind, CSS-in-JS decisions

Motion & Animation:

ReferenceContent
references/motion-design.mdGSAP, CSS animations, timing functions
references/scrollytelling.mdScrollTrigger, Scrollama, Lenis patterns

Graphics & 3D:

ReferenceContent
references/3d-experiences.mdThree.js, Threlte 8, WebGL performance
references/graphics-primitives.mdSVG, Canvas, sprites, PixiJS
references/data-visualization.mdD3, Layer Cake, uPlot, high-performance viz

Components & UI:

ReferenceContent
references/component-patterns.mdCompound, composition patterns
references/headless-ui.mdMelt UI, Bits UI, shadcn-svelte

Cognitive & Sources:

ReferenceContent
references/cognitive-design.mdAttention, load, timing, audience targeting
references/sources.mdFull citations for all claims

Assets:

AssetContent
assets/aesthetic-interview.mdInterview template for aesthetic discovery process