agentleFS
RuneStone-TechRuneStone-Tech/optimize-anything/skills/motion/threejs/SKILL.md

threejs

Skill1 starsChanged 8 days agoMITView on GitHub

Audit how a codebase uses three.js, report what leaks or wastes GPU/CPU, agree a plan, then fix. Bare three.js failure modes: render loops created per component (stacked RAF callbacks, hot-reload pile-ups, callbacks that keep running after unmount), missing dispose() for geometries, materials, textures, and the renderer (GPU memory grows until contexts die), per-frame heap allocations, and pixel-ratio/shadow settings tuned for screenshots rather than the web. Report first, plan approved, then edit. - Project root (package.json — three version; note framework…

19 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use Problem-Solving Techniques, mobile-development and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • truongtv22Skill

    Problem-Solving Techniques

    Apply systematic problem-solving techniques for complexity spirals (simplification cascades), innovation blocks (collision-zone thinking), recurring patterns (meta-pattern recognition), assumption constraints (inversion exercise), scale uncertainty (scale game), and dispatch when stuck. Techniques derived from Microsoft Amplifier project patterns adapted for immediate application.

    Also in 5 projects that use this

  • truongtv22Skill

    mobile-development

    Build modern mobile applications with React Native, Flutter, Swift/SwiftUI, and Kotlin/Jetpack Compose. Covers mobile-first design principles, performance optimization (battery, memory, network), offline-first architecture, platform-specific guidelines (iOS HIG, Material Design), testing strategies, security best practices, accessibility, app store deployment, and mobile development mindset. Use when building mobile apps, implementing mobile UX patterns, optimizing for mobile constraints, or making native vs cross-platform decisions.

    Also in 4 projects that use this

  • AWSSkill

    planning

    Discovers user intent and generates a structured, step-by-step plan for model customization workflows. This skill must always be activated alongside any other skill when the user's request relates to model customization — including fine-tuning, training, building, customizing, reviewing data, or getting advice on approach, regardless of domain. Do not skip this skill even if the immediate ask is narrow (e.g., reviewing data format or a single workflow step), because planning discovers the full scope of work needed. Also activate when the user wants to resume, continue, or modify an existing plan.

    Also in 5 projects that use this

  • StrayDragonSkill

    ui-ux-pro-max

    UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

    Also in 5 projects that use this

  • NVIDIASkill

    research

    Before designing a feature, research how comparable libraries solve the problem, check best practices, known pitfalls, and upstream changes. Use when starting a new feature, investigating an unfamiliar area, or the user asks to research something.

    Also in 5 projects that use this

  • AnthropicSkill

    design-system

    Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Run python <skill-dir>/scripts/audit.py <project-root> [--json] — inventories renderer creations, loop patterns (requestAnimationFrame vs …

    line 21
  2. Distinctive:

    Read what the script flagged.

    line 27

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “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

name: threejs-optimizer description: Audit and optimize bare three.js usage (WebGLRenderer, scene/camera, geometry/material/texture lifecycle) — render loop hygiene (one renderer.setAnimationLoop vs scattered requestAnimationFrame, RAF callbacks that never cancel on unmount/hot-reload), dispose() coverage for geometries/materials/textures/renderer (GPU memory leaks, context exhaustion), per-frame allocations (new Vector3/Color inside loop bodies), geometry rebuilds per frame vs setAttribute updates, texture settings (anisotropy, colorSpace, mipmaps), unbounded setPixelRatio, shadow map costs, and old three/examples/jsm import paths. Report with evidence and a plan approved before edits. Use when the user mentions three.js, THREE, WebGLRenderer, renderer.setAnimationLoop, or canvas 3D scenes in vanilla JS/framework components -- even if they don't say "optimize". Not for react-three-fiber (see the react-three-fiber skill).

three.js (vanilla) Optimizer

Audit how a codebase uses three.js, report what leaks or wastes GPU/CPU, agree a plan, then fix. Bare three.js failure modes: render loops created per component (stacked RAF callbacks, hot-reload pile-ups, callbacks that keep running after unmount), missing dispose() for geometries, materials, textures, and the renderer (GPU memory grows until contexts die), per-frame heap allocations, and pixel-ratio/shadow settings tuned for screenshots rather than the web. Report first, plan approved, then edit.

Workflow

1. Scope (quick)

  • Project root (package.json — three version; note framework wrappers; this skill is for bare three.js — route react-three-fiber projects to the react-three-fiber skill).
  • Run python <skill-dir>/scripts/audit.py <project-root> [--json] — inventories renderer creations, loop patterns (requestAnimationFrame vs setAnimationLoop, cancellation), dispose coverage, per-frame allocation candidates, pixel ratio/shadow settings, import paths.

2. Audit

Read what the script flagged. Load references as fit:

AreaReference
Render loop & component lifecycle: RAF stacking, teardownreferences/loop-lifecycle.md
Scene resources: geometry/material/texture lifecycle, disposereferences/scene-resources.md
Per-frame cost: allocations, geometry updates, shadows, DPRreferences/perf-frame.md

Runtime checks you do by hand: memory over time (DevTools performance monitor — GPU/JS heap should stabilize), navigating repeatedly through the page holding the canvas (context loss?), hot-reload loops (multiple scenes?), reduced-motion relevance for background scenes.

Mark findings Confirmed or Suspected.

3. Report

Fill in assets/report-template.md, save as THREEJS_REPORT.md in the project root. Group: loop/lifecycle, resources, per-frame cost.

4. Plan — stop for approval

  1. Quick wins — cancel/clean RAF callbacks in unmount/effect cleanup; add renderer.dispose() and resource disposal at teardown; bound setPixelRatio(Math.min(devicePixelRatio, 2)); hoist per-frame new THREE.* allocations.
  2. Structural — consolidate to one render loop per canvas (renderer.setAnimationLoop); swap per-frame geometry rebuilds for setAttribute updates with needsUpdate; scope shadows (cast/receive + bounded map size) where used.
  3. Optional — texture budget (size/anisotropy/colorSpace), visibility-based pause (skip frames when tab hidden or canvas offscreen). Per step: files, expected effect, verification, rollback. Let the user drop or reorder.

5. Fix

Approved items only. Verify visually scene by scene: identical framing/materials after changes, no z-fighting or lighting shifts from shadow scope changes.

6. Verify and wrap up

  • Memory soak: run/teardown repeatedly, watch GPU + JS heap plateau.
  • FPS deltas where loop/per-frame changes landed; skipped rendering when hidden.
  • Deferred items + next step.

Principles

  • One renderer per canvas, one loop per renderer. Additional RAF callbacks should piggyback on the frame loop or be explicitly cancelled, not stack new loops.
  • Everything GPU-resident gets disposed. geometry.dispose(), material.dispose(), texture.dispose(), renderer.dispose() when a scene dies; leaking contexts crash sites.
  • The loop should allocate nothing per frame. Pre-create vectors/colors/objects, reuse.
  • Update attributes, not geometry objects. Per-frame rebuild of BufferGeometry (or new THREE.BufferAttribute) churns upload bandwidth.
  • DPR and shadow maps are quality dials, not defaults. Bound pixel ratio, scope shadows.
  • Live boundaries matter. Offscreen or hidden canvases shouldn't render at all.
  • Docs over memory. three.js releases rename/remove APIs (examples/jsm → three/addons, outputEncoding → outputColorSpace) — check the release notes for the installed version.

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.