agentleFS
ohnoshivmohnoshivm/creative-engineering-os/skills/ceos-frontend-architecture/SKILL.md

ceos-frontend-architecture

Skill0 starsChanged 12 days agoMITView on GitHub

Chooses and structures the frontend for creative websites — Astro vs Vite vs Next.js/React, TypeScript, modern CSS (cascade layers, container queries, custom properties), component boundaries, rendering lifecycle, animation and WebGL integration, state ownership, asset loading and maintainability. Use when starting a project's codebase, deciding a stack, integrating GSAP/Three.js into a framework, structuring components, or when an animated/3D site has leaks, double render loops or tangled state.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never default to React. Write the choice and its rejected alternatives in docs/ARCHITECTURE.md.

    line 22
  2. Distinctive:

    DOM is the layout engine: All content, links and headings are HTML.

    line 26
  3. Distinctive:

    No component reaches into another's internals.

    line 32
  4. Very specific:

    Lifecycle: every module exports init() / destroy().

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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

Frontend architecture for creative sites

Purpose

The smallest architecture that carries the concept, with explicit ownership of DOM, scroll, render loop and state.

Stack decision (default to the lightest)

SituationChooseWhy
Content-led, editorial, few interactive islandsAstro (static, islands)HTML-first, zero JS by default, great SEO
One-page or few-page cinematic / WebGL experience, no app stateVite + TypeScript (vanilla modules)Full control of the render loop, minimal runtime
Many routes + CMS + app-like features, team on ReactNext.js (App Router)Routing, data, image pipeline
React team needs declarative 3DReact Three Fiber inside Vite/NextOnly if the team is React-native; otherwise raw three
Tiny WebGL effect, no scene graphOGL or raw WebGL2~a few KB vs three.js

Never default to React. Write the choice and its rejected alternatives in docs/ARCHITECTURE.md.

Ownership model (write it down)

  • DOM is the layout engine. All content, links and headings are HTML. Canvas reads DOM rects to place GL objects (DOM-synced planes) — never the other way round.
  • One render loop owner (gsap.ticker or a single requestAnimationFrame scheduler) that ticks: input → scroll → animation → render. Pause it when the canvas is offscreen (IntersectionObserver) or the tab is hidden.
  • One scroll source (native or Lenis), exposed as a read-only store (scroll.y, velocity, progress).
  • State: small explicit stores (signals or a tiny observable) for app state; scene state derived from it. No component reaches into another's internals.
  • Lifecycle: every module exports init() / destroy(); destroy disposes geometries, materials, textures, render targets, listeners, observers, timelines.

Modern CSS baseline

@layer reset, tokens, base, components, utilities; · custom properties for all tokens · container queries for components · clamp() type · logical properties · :focus-visible · prefers-reduced-motion and prefers-contrast · content-visibility: auto for long below-fold sections (with contain-intrinsic-size).

Loading strategy

  • Ship HTML + CSS first; the hero text renders without JS.
  • Load heavy 3D/JS after first paint (import() on idle or on intersection); show a designed poster, not a spinner.
  • Budget: initial JS (excluding the 3D chunk) ≤ 150–200 KB gz; hero assets ≤ 2–3 MB; fonts ≤ 2 families, subset woff2.
  • Preload only the LCP image/font. Use fetchpriority="high" on the LCP element.

Project structure (vanilla Vite example)

src/
  main.ts            boot: feature-detect → init modules → start loop
  core/loop.ts       single RAF scheduler
  core/scroll.ts     scroll store (native or Lenis)
  core/pointer.ts    pointer store (normalised, smoothed)
  gl/                scene, materials, passes (no DOM queries except via sync helpers)
  motion/            timelines per section (gsap.context per section)
  sections/          DOM behaviour per section
  styles/            tokens.css, base.css, sections/*.css
tests/               Playwright smoke + visual

Verification

npm run build passes with no warnings worth fixing; bundle report reviewed; route/section mount-unmount 20× shows no growth in JS heap, WebGL contexts, listeners (DevTools Memory / performance.memory + renderer.info).

Failure criteria

React chosen "because default"; content rendered only in canvas; two RAF loops; scroll read in several places; no destroy(); heavy 3D blocking first paint; global CSS without layers fighting component styles.

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.