vibes-plug 2.11.0 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.cursor/rules/vibes-plug-core.mdc +3 -3
  2. package/.cursorrules +3 -3
  3. package/AGENTS.md +4 -4
  4. package/BLUEPRINT.md +16 -6
  5. package/CHANGELOG.md +37 -0
  6. package/CLAUDE.md +8 -8
  7. package/README.md +85 -115
  8. package/index.js +1 -1
  9. package/package.json +2 -2
  10. package/plugin.json +2 -2
  11. package/scripts/check-anti-slop.js +53 -0
  12. package/scripts/generate_swarm_gif.py +2 -2
  13. package/skills/ai-llm-integration-expert/SKILL.md +22 -15
  14. package/skills/ai-prompt-engineering-expert/SKILL.md +133 -83
  15. package/skills/anti-slop/SKILL.md +133 -0
  16. package/skills/async-queue-temporal-expert/SKILL.md +135 -158
  17. package/skills/authentication-identity-expert/SKILL.md +172 -278
  18. package/skills/brainstorming/SKILL.md +26 -26
  19. package/skills/database-orm-expert/SKILL.md +164 -303
  20. package/skills/deep-research-analyst/SKILL.md +136 -0
  21. package/skills/design-system-architect/SKILL.md +31 -1
  22. package/skills/email-notification-expert/SKILL.md +31 -4
  23. package/skills/error-resilience-expert/SKILL.md +21 -0
  24. package/skills/fullstack-expert/SKILL.md +183 -260
  25. package/skills/glsl-shader-expert/SKILL.md +190 -107
  26. package/skills/graph-rag-knowledge-expert/SKILL.md +42 -1
  27. package/skills/mcp-server-architect/SKILL.md +15 -1
  28. package/skills/prd-architect/SKILL.md +181 -206
  29. package/skills/production-ready-hardener/SKILL.md +16 -19
  30. package/skills/pwa-offline-first-expert/SKILL.md +42 -1
  31. package/skills/pydantic-ai-expert/SKILL.md +161 -0
  32. package/skills/saas-architect/SKILL.md +154 -0
  33. package/skills/senior-frontend/SKILL.md +9 -11
  34. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1 -1
  35. package/skills/session-memory-manager/SKILL.md +128 -0
  36. package/skills/synthetic-data-finetuning-expert/SKILL.md +155 -0
  37. package/skills/ui-ux-pro-max/SKILL.md +4 -2
  38. package/skills/vercel-ai-sdk-expert/SKILL.md +181 -0
  39. package/skills/voice-ai-realtime-agent/SKILL.md +41 -1
  40. package/skills/web-3d-graphics-expert/SKILL.md +313 -137
  41. package/skills/web-game-engine-expert/SKILL.md +329 -102
  42. package/skills/webxr-ar-vr-expert/SKILL.md +162 -123
  43. package/skills/zero-to-prod-orchestrator/SKILL.md +26 -24
  44. package/skills/ai-cost-token-optimizer/SKILL.md +0 -82
  45. package/skills/ai-evals-benchmark-expert/SKILL.md +0 -188
  46. package/skills/asisten-ramah/SKILL.md +0 -47
  47. package/skills/auto-doc-updater/SKILL.md +0 -220
  48. package/skills/autonomous-chaos-monkey/SKILL.md +0 -63
  49. package/skills/background-jobs-queue-expert/SKILL.md +0 -235
  50. package/skills/database-migration-versioning-expert/SKILL.md +0 -90
  51. package/skills/edge-serverless-db-expert/SKILL.md +0 -99
  52. package/skills/mcp-client-orchestrator/SKILL.md +0 -76
  53. package/skills/mobile-push-notification-expert/SKILL.md +0 -71
  54. package/skills/monday-design-aesthetic/SKILL.md +0 -73
  55. package/skills/project-context-mapper/SKILL.md +0 -85
  56. package/skills/saas-mvp-launcher/SKILL.md +0 -260
  57. package/skills/saas-transformer/SKILL.md +0 -500
  58. package/skills/saas-transformer/references/billing_integration_guide.md +0 -401
  59. package/skills/self-evolving-memory-graph/SKILL.md +0 -91
  60. package/skills/session-context-loader/SKILL.md +0 -83
  61. package/skills/session-handoff-resume/SKILL.md +0 -164
  62. package/skills/skill-baru/SKILL.md +0 -178
  63. package/skills/supabase-migration/SKILL.md +0 -91
  64. package/skills/token-saver/SKILL.md +0 -119
  65. package/skills/ui-components-expert/SKILL.md +0 -166
  66. package/skills/vibe-code-gardener/SKILL.md +0 -181
  67. /package/skills/{saas-transformer → saas-architect}/references/feature_gating_patterns.md +0 -0
  68. /package/skills/{saas-transformer → saas-architect}/references/saas_transformation_checklist.md +0 -0
  69. /package/skills/{saas-transformer → saas-architect}/scripts/saas_transformation_scanner.py +0 -0
@@ -1,137 +1,313 @@
1
- ---
2
- name: web-3d-graphics-expert
3
- description: "Expert guide for WebGL and 3D graphics in the browser using Three.js, Babylon.js, React Three Fiber (R3F), and TresJS. Covers scene optimization, shaders, lighting, 3D model loading (GLTF/GLB), and performance tuning."
4
- author: "Roedy Rustam"
5
- ---
6
-
7
- # Web 3D Graphics Expert (Three.js & Babylon.js)
8
-
9
- [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
-
11
- ---
12
-
13
- <a name="english"></a>
14
- ## English
15
-
16
- ### Orchestration & Integration
17
- Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `project-context-mapper` to ensure cohesive execution.
18
-
19
- ### Description
20
- Production-level guidance for developing high-performance 3D graphics in the browser. Covers the raw APIs of **Three.js** and **Babylon.js**, as well as framework-specific wrappers like **React Three Fiber (R3F)** for React and **TresJS** for Vue. Focuses on rendering performance, efficient memory management, and realistic lighting/material setups.
21
-
22
- ### Trigger Conditions
23
- Activate this skill when the user is:
24
- - Initializing a WebGL/WebGPU 3D scene.
25
- - Using `three`, `@react-three/fiber`, `@babylonjs/core`, or `@tresjs/core`.
26
- - Loading 3D models (`.glb`, `.gltf`, `.obj`).
27
- - Adding advanced lighting, shadows, or Post-Processing effects (Bloom, Depth of Field).
28
- - Asking about framerate drops, memory leaks, or rendering performance in 3D apps.
29
-
30
- ---
31
-
32
- ### Core Concepts & Framework Selection
33
-
34
- #### 1. React Three Fiber (R3F) vs Vanilla Three.js
35
- When building with React, always use **React Three Fiber**. It manages the scene graph, object lifecycles, and `requestAnimationFrame` natively within the React component tree.
36
-
37
- ```tsx
38
- import { Canvas } from '@react-three/fiber'
39
- import { OrbitControls, Environment, useGLTF } from '@react-three/drei'
40
-
41
- export default function App() {
42
- const { scene } = useGLTF('/model.glb')
43
- return (
44
- <Canvas camera={{ position: [0, 2, 5] }}>
45
- <ambientLight intensity={0.5} />
46
- <directionalLight position={[10, 10, 5]} castShadow />
47
- <primitive object={scene} />
48
- <Environment preset="city" />
49
- <OrbitControls />
50
- </Canvas>
51
- )
52
- }
53
- ```
54
- *Note: Always use `@react-three/drei` for common helpers (OrbitControls, Text, Environment).*
55
-
56
- #### 2. Babylon.js vs Three.js
57
- - **Three.js**: Lighter, more flexible, vast community, excellent for creative coding, landing page animations, and React/Vue integrations.
58
- - **Babylon.js**: Robust, game-engine-like architecture, built-in physics, excellent for web-based games, AR/VR (WebXR), and complex interactive simulations. Fully written in TypeScript.
59
-
60
- ```typescript
61
- // Basic Babylon.js Setup
62
- import { Engine, Scene, FreeCamera, Vector3, MeshBuilder, HemisphericLight } from '@babylonjs/core'
63
-
64
- const canvas = document.getElementById('renderCanvas') as HTMLCanvasElement
65
- const engine = new Engine(canvas, true)
66
- const scene = new Scene(engine)
67
-
68
- const camera = new FreeCamera('camera1', new Vector3(0, 5, -10), scene)
69
- camera.setTarget(Vector3.Zero())
70
- camera.attachControl(canvas, true)
71
-
72
- const light = new HemisphericLight('light', new Vector3(0, 1, 0), scene)
73
- const sphere = MeshBuilder.CreateSphere('sphere', { diameter: 2 }, scene)
74
-
75
- engine.runRenderLoop(() => {
76
- scene.render()
77
- })
78
- ```
79
-
80
- #### 3. Asset Loading & Optimization
81
- - **Format:** ALWAYS use `.glb` or `.gltf`. Avoid `.obj` or `.fbx` in the browser as they are unoptimized.
82
- - **Compression:** Use Draco compression (`glTF-Transform` or `gltf-pipeline`) to dramatically reduce file sizes.
83
- - **Loading:** Preload models if they are critical to the first paint.
84
-
85
- ---
86
-
87
- ### Best Practices for Performance
88
-
89
- 1. **Geometry and Material Reuse:**
90
- Never create new Geometries or Materials inside the render loop. Instantiate them once and reuse them. Use `InstancedMesh` (Three.js) or `Thin Instances` (Babylon.js) when rendering hundreds of identical objects.
91
- 2. **Memory Management (Disposing):**
92
- WebGL does not automatically garbage collect textures and geometries. When an object is removed from the scene, you MUST call `.dispose()` on its geometry and material.
93
- *(Note: R3F handles this automatically when components unmount).*
94
- 3. **Shadows & Lighting:**
95
- Limit the number of shadow-casting lights to 1 or 2. Use baked shadows (lightmaps) for static scenes. Use `Environment` maps (HDRI) instead of multiple lights for realistic reflections.
96
- 4. **Post-Processing:**
97
- Post-processing requires rendering the scene multiple times. Use it sparingly. Group passes together when possible.
98
-
99
- ---
100
-
101
- ### Integration with Other Skills (MANDATORY)
102
-
103
- This skill works best when combined with:
104
- - `senior-frontend` — When integrating React Three Fiber into Next.js/React applications.
105
- - `vue-frontend-expert` — When integrating TresJS into Vue 3/Nuxt 3 applications.
106
- - `performance-web-vitals` — To optimize the bundle size of 3D libraries and reduce Total Blocking Time (TBT).
107
-
108
- ### Referenced By Orchestrators (MANDATORY)
109
-
110
- This skill should be referenced by the following orchestrators:
111
- - `brainstorming` — Add to "UI/UX & Design Systems" or create a "3D & Graphics" category.
112
- - `zero-to-prod-orchestrator` — Phase 5 (Frontend Implementation).
113
-
114
- ---
115
-
116
- <a name="bahasa-indonesia"></a>
117
- ## Bahasa Indonesia
118
-
119
- ### Integrasi Orkestrasi
120
- Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `project-context-mapper` untuk memastikan eksekusi yang kohesif.
121
-
122
- ### Deskripsi
123
- Panduan produksi untuk pengembangan grafis 3D performa tinggi di browser. Mencakup **Three.js** dan **Babylon.js**, serta integrasi framework seperti **React Three Fiber (R3F)** untuk React dan **TresJS** untuk Vue. Fokus pada performa render, manajemen memori, dan pencahayaan realistis.
124
-
125
- ### Kondisi Pemicu
126
- Aktifkan skill ini ketika pengguna sedang:
127
- - Menginisialisasi *scene* WebGL 3D.
128
- - Menggunakan library `three`, `@react-three/fiber`, atau `@babylonjs/core`.
129
- - Memuat model 3D (terutama format `.glb`/`.gltf`).
130
- - Mengoptimalkan FPS (frame-rate) atau menangani masalah *memory leak* pada aplikasi 3D.
131
-
132
- ### Panduan Singkat
133
- - **Pemilihan Alat:** Gunakan **React Three Fiber** jika menggunakan React. Gunakan **TresJS** jika menggunakan Vue. Gunakan **Babylon.js** jika membuat game berbasis web yang membutuhkan mesin fisika kuat (physics engine).
134
- - **Format Aset:** Selalu gunakan format `.glb` dengan kompresi Draco.
135
- - **Performa:** Jangan membuat *Geometry* atau *Material* baru di dalam *render loop* (`requestAnimationFrame`).
136
- - **Manajemen Memori:** Panggil method `.dispose()` pada geometry, material, dan texture yang sudah tidak digunakan di vanilla Three.js/Babylon.js untuk mencegah kebocoran memori.
137
- - **Pencahayaan:** Gunakan *Environment map* (HDRI) untuk pencahayaan realistis yang lebih ringan diproses daripada banyak lampu *directional/point*. Batasi lampu yang memancarkan bayangan maksimal 1-2 saja.
1
+ ---
2
+ name: web-3d-graphics-expert
3
+ description: "Expert guide for modern WebGPU and WebGL 3D graphics in the browser using Three.js (WebGPURenderer + TSL), Babylon.js, PlayCanvas, React Three Fiber (R3F), and TresJS. Covers scene optimization, compute shaders, KTX2/Meshopt compression, and memory management / Panduan ahli grafis 3D web dan WebGPU modern."
4
+ author: "vibes-plug-swarm"
5
+ ---
6
+
7
+ # Web 3D Graphics Expert (WebGPU, Three.js, Babylon.js & PlayCanvas)
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Orchestration & Integration
17
+ Connects and orchestrates with relevant domain skills:
18
+ - `senior-frontend` — Integrating React Three Fiber (R3F) in React 19 / Next.js 15.
19
+ - `vue-frontend-expert` — Integrating TresJS in Vue 3 / Nuxt 3.
20
+ - `svelte-sveltekit-expert` — Integrating Threlte in Svelte 5 (Runes).
21
+ - `web-game-engine-expert` — Physics simulations (Rapier, Jolt, Havok), game loops, and ECS.
22
+ - `glsl-shader-expert` — Shading languages, WGSL compute shaders, and TSL nodes.
23
+ - `webxr-ar-vr-expert` — WebXR immersive VR/AR experiences.
24
+ - `performance-web-vitals` — Minimizing Total Blocking Time (TBT), asset streaming, and bundle sizing.
25
+
26
+ ### Description
27
+ Production-grade guidance for architecting high-fidelity, high-framerate 3D experiences in the browser. Covers the modern **WebGPU-first** paradigm with automatic WebGL2 fallbacks, **Three.js (r170+) WebGPURenderer** and **TSL (Three Shading Language)**, **Babylon.js WebGPUEngine** with Snapshot Rendering, and **PlayCanvas Engine** for ultra-lightweight, mobile-first commercial applications.
28
+
29
+ ### Trigger Conditions
30
+ Activate this skill when the user is:
31
+ - Initializing a WebGPU or WebGL 3D scene.
32
+ - Using `three` (`three/webgpu`), `@react-three/fiber`, `@babylonjs/core`, `playcanvas`, `@tresjs/core`, or `@threlte/core`.
33
+ - Writing or refactoring shaders to Three Shading Language (TSL) or WGSL.
34
+ - Loading and optimizing 3D models (`.glb`, `.gltf`) with KTX2 texture compression or Meshopt.
35
+ - Implementing post-processing passes, compute shaders, or particle systems on the GPU.
36
+ - Diagnosing FPS drops, draw call bottlenecks, or VRAM memory leaks.
37
+
38
+ ---
39
+
40
+ ### Modern Web 3D Engine Landscape (2026)
41
+
42
+ | Engine / Stack | Best Use Case | Rendering Backend | Key Strengths |
43
+ | :--- | :--- | :--- | :--- |
44
+ | **Three.js (WebGPU + TSL)** | Creative landing pages, interactive portfolios, R3F React ecosystems | WebGPU (primary) + WebGL2 (fallback) | Vast community, huge ecosystem, TSL cross-compiles to WGSL & GLSL, node materials. |
45
+ | **Babylon.js** | Enterprise 3D simulations, CAD viewers, AAA web games with Havok | WebGPU + WebGL2 | Snapshot rendering, native Havok physics, compute shaders, robust GUI & inspector. |
46
+ | **PlayCanvas Engine** | High-performance mobile 3D, instant-load web games, e-commerce configurators | WebGPU + WebGL2 | Tiny runtime (~200KB gzipped), clustered lighting, zero-overhead scene graph. |
47
+ | **Threlte (Svelte 5)** | Svelte 5 apps requiring declarative 3D reactive components | Three.js WebGL/WebGPU | Svelte Runes reactivity (`$state`, `$derived`), lightweight bundle footprint. |
48
+
49
+ ---
50
+
51
+ ### 1. Three.js WebGPU & TSL (Three Shading Language)
52
+
53
+ Starting with modern Three.js, transition from `WebGLRenderer` to `WebGPURenderer`. It natively uses WebGPU when available and falls back cleanly to WebGL2.
54
+
55
+ ```typescript
56
+ // Modern Three.js WebGPU Scene Setup
57
+ import * as THREE from 'three/webgpu';
58
+ import { color, float, positionLocal, time, vec3, Fn } from 'three/tsl';
59
+
60
+ const canvas = document.querySelector('#canvas') as HTMLCanvasElement;
61
+ const renderer = new THREE.WebGPURenderer({ canvas, antialias: true });
62
+ renderer.setSize(window.innerWidth, window.innerHeight);
63
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
64
+
65
+ // Initialize async WebGPU pipeline
66
+ await renderer.init();
67
+
68
+ const scene = new THREE.Scene();
69
+ const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
70
+ camera.position.set(0, 2, 5);
71
+
72
+ // TSL (Three Shading Language) Custom Node Material
73
+ // Compiles automatically to WGSL on WebGPU and GLSL on WebGL2!
74
+ const customMaterial = new THREE.MeshStandardNodeMaterial();
75
+
76
+ // Node-based animated color shader function
77
+ const animatedColor = Fn(() => {
78
+ const t = time.mul(2.0);
79
+ const wave = positionLocal.y.add(t).sin().mul(0.5).add(0.5);
80
+ return color(0x00ffff).mul(wave);
81
+ });
82
+
83
+ customMaterial.colorNode = animatedColor();
84
+
85
+ const mesh = new THREE.Mesh(new THREE.TorusKnotGeometry(1, 0.3, 128, 32), customMaterial);
86
+ scene.add(mesh);
87
+
88
+ // Render loop using setAnimationLoop (WebGPU & WebXR compatible)
89
+ renderer.setAnimationLoop(() => {
90
+ mesh.rotation.y += 0.01;
91
+ renderer.render(scene, camera);
92
+ });
93
+ ```
94
+
95
+ ---
96
+
97
+ ### 2. Babylon.js WebGPU Engine & Snapshot Rendering
98
+
99
+ For scenes with thousands of static meshes, Babylon.js **Snapshot Rendering** records GPU command buffers once and replays them, bypassing JavaScript CPU draw call overhead.
100
+
101
+ ```typescript
102
+ import { WebGPUEngine, Scene, ArcRotateCamera, Vector3, HemisphericLight, MeshBuilder } from '@babylonjs/core';
103
+
104
+ async function initBabylonWebGPU() {
105
+ const canvas = document.getElementById('renderCanvas') as HTMLCanvasElement;
106
+ const engine = new WebGPUEngine(canvas, { antialiasing: true });
107
+ await engine.initAsync();
108
+
109
+ const scene = new Scene(engine);
110
+ const camera = new ArcRotateCamera('camera', -Math.PI / 2, Math.PI / 2.5, 10, Vector3.Zero(), scene);
111
+ camera.attachControl(canvas, true);
112
+
113
+ const light = new HemisphericLight('light', new Vector3(0, 1, 0), scene);
114
+
115
+ // Enable Snapshot Rendering for extreme draw call reduction
116
+ engine.snapshotRendering = true;
117
+ engine.snapshotRenderingMode = WebGPUEngine.SNAPSHOTRENDERING_FAST;
118
+
119
+ engine.runRenderLoop(() => {
120
+ scene.render();
121
+ });
122
+ }
123
+ ```
124
+
125
+ ---
126
+
127
+ ### 3. PlayCanvas Engine (Ultra-Lightweight & Fast-Loading)
128
+
129
+ When bundle size and instant mobile loading are the primary constraints, use the standalone PlayCanvas Engine:
130
+
131
+ ```typescript
132
+ import * as pc from 'playcanvas';
133
+
134
+ const canvas = document.getElementById('application-canvas') as HTMLCanvasElement;
135
+ const app = new pc.Application(canvas, {
136
+ graphicsDeviceOptions: { alpha: false, antialias: true, preferWebGpu: true }
137
+ });
138
+ app.start();
139
+ app.setCanvasFillMode(pc.FILLMODE_FILL_WINDOW);
140
+ app.setCanvasResolution(pc.RESOLUTION_AUTO);
141
+
142
+ // Create Entity: Camera
143
+ const camera = new pc.Entity('camera');
144
+ camera.addComponent('camera', { clearColor: new pc.Color(0.1, 0.1, 0.15) });
145
+ camera.translate(0, 2, 6);
146
+ camera.lookAt(0, 0, 0);
147
+ app.root.addChild(camera);
148
+
149
+ // Create Entity: Clustered Directional Light
150
+ const light = new pc.Entity('light');
151
+ light.addComponent('light', { type: 'directional', castShadows: true });
152
+ light.setEulerAngles(45, 30, 0);
153
+ app.root.addChild(light);
154
+
155
+ // Create Entity: Box with Standard Material
156
+ const box = new pc.Entity('box');
157
+ box.addComponent('render', { type: 'box' });
158
+ app.root.addChild(box);
159
+
160
+ app.on('update', (dt: number) => {
161
+ box.rotate(10 * dt, 20 * dt, 30 * dt);
162
+ });
163
+ ```
164
+
165
+ ---
166
+
167
+ ### 4. React Three Fiber (R3F) with React 19
168
+
169
+ ```tsx
170
+ import { Canvas } from '@react-three/fiber';
171
+ import { OrbitControls, Environment, useGLTF, Float } from '@react-three/drei';
172
+
173
+ function ModelViewer() {
174
+ const { scene } = useGLTF('/models/drone.glb');
175
+ return (
176
+ <Float speed={2} rotationIntensity={0.5} floatIntensity={1}>
177
+ <primitive object={scene} />
178
+ </Float>
179
+ );
180
+ }
181
+
182
+ export default function App() {
183
+ return (
184
+ <Canvas
185
+ gl={(canvas) => new THREE.WebGPURenderer({ canvas, antialias: true })}
186
+ camera={{ position: [0, 1.5, 4], fov: 45 }}
187
+ dpr={[1, 2]}
188
+ >
189
+ <ambientLight intensity={0.6} />
190
+ <directionalLight position={[5, 10, 5]} castShadow intensity={1.5} />
191
+ <ModelViewer />
192
+ <Environment preset="city" />
193
+ <OrbitControls makeDefault enableDamping dampingFactor={0.05} />
194
+ </Canvas>
195
+ );
196
+ }
197
+
198
+ // Preload critical assets outside component tree
199
+ useGLTF.preload('/models/drone.glb');
200
+ ```
201
+
202
+ ---
203
+
204
+ ### Modern Asset Pipeline & GPU Memory Optimization
205
+
206
+ #### 1. GPU Texture Compression: KTX2 + Basis Universal (`KHR_texture_basisu`)
207
+ > **CRITICAL RULE**: Never deploy raw PNG or JPG textures for 3D production models.
208
+ - **Why?** PNG/JPG files decompress into uncompressed 32-bit RGBA inside GPU VRAM. A 2048x2048 PNG consumes **16MB of VRAM**; an uncompressed 4K texture consumes **64MB of VRAM**.
209
+ - **KTX2 with Basis Universal** transcodes in real-time into native GPU-compressed formats:
210
+ - Mobile: ASTC / ETC2.
211
+ - Desktop: BC7 / BC1.
212
+ - **Result:** Saves **75% to 85% of GPU VRAM**, prevents mobile browser tab crashes, and eliminates texture upload GPU hitches.
213
+ - **Tooling:** Compress glTF files with `gltf-transform`:
214
+ ```bash
215
+ npx @gltf-transform/cli optimize input.glb output.glb --texture-compress ktx2
216
+ ```
217
+
218
+ #### 2. Geometry Optimization: Meshopt (`EXT_meshopt_compression`)
219
+ - Prefer **Meshopt** over Draco for high-framerate interactive apps and games.
220
+ - **Advantage:** Meshopt WASM decompressor runs at **gigabytes per second** (up to 10x faster decompression than Draco on mobile CPUs) and organizes vertex attributes for maximum GPU vertex cache efficiency.
221
+ ```bash
222
+ npx @gltf-transform/cli meshopt input.glb output.glb
223
+ ```
224
+
225
+ #### 3. Strict Memory Lifecycle Management (`.dispose()`)
226
+ Garbage collection does NOT clean up WebGL/WebGPU buffers:
227
+ - When removing an object from Three.js or Babylon.js, explicitly traverse and dispose:
228
+ ```typescript
229
+ export function purgeObject(object: THREE.Object3D) {
230
+ object.traverse((child) => {
231
+ if ((child as THREE.Mesh).isMesh) {
232
+ const mesh = child as THREE.Mesh;
233
+ mesh.geometry?.dispose();
234
+ if (Array.isArray(mesh.material)) {
235
+ mesh.material.forEach((m) => disposeMaterial(m));
236
+ } else if (mesh.material) {
237
+ disposeMaterial(mesh.material);
238
+ }
239
+ }
240
+ });
241
+ }
242
+
243
+ function disposeMaterial(material: THREE.Material) {
244
+ Object.keys(material).forEach((prop) => {
245
+ const value = (material as any)[prop];
246
+ if (value && typeof value.dispose === 'function') {
247
+ value.dispose();
248
+ }
249
+ });
250
+ material.dispose();
251
+ }
252
+ ```
253
+
254
+ ---
255
+
256
+ ### Production Checklist
257
+ - [ ] Render with `WebGPURenderer` (Three.js) or `WebGPUEngine` (Babylon.js) with fallback enabled.
258
+ - [ ] Use KTX2 / Basis Universal compressed textures on all `.glb` assets.
259
+ - [ ] Use Meshopt geometry compression to eliminate model loading CPU stalls.
260
+ - [ ] Clamp `devicePixelRatio` to `Math.min(window.devicePixelRatio, 2)` to prevent 4K/Retina mobile GPU thermal throttling.
261
+ - [ ] Use `InstancedMesh` (Three.js) or `Thin Instances` (Babylon.js) for repetitive assets (>10 meshes).
262
+ - [ ] Implement explicit `.dispose()` cleanup in `useEffect` or component unmount hooks.
263
+
264
+ ---
265
+
266
+ <a name="bahasa-indonesia"></a>
267
+ ## Bahasa Indonesia
268
+
269
+ ### Integrasi Orkestrasi
270
+ Terhubung dan mengorkestrasi skill domain yang relevan:
271
+ - `senior-frontend` — Integrasi React Three Fiber (R3F) pada React 19 / Next.js 15.
272
+ - `vue-frontend-expert` — Integrasi TresJS pada Vue 3 / Nuxt 3.
273
+ - `svelte-sveltekit-expert` — Integrasi Threlte pada Svelte 5 (Runes).
274
+ - `web-game-engine-expert` — Simulasi fisika (Rapier, Jolt, Havok), game loop, dan ECS.
275
+ - `glsl-shader-expert` — Bahasa shader, compute shader WGSL, dan node TSL.
276
+ - `webxr-ar-vr-expert` — Pengalaman WebXR VR/AR imersif.
277
+ - `performance-web-vitals` — Meminimalkan TBT (Total Blocking Time) dan optimasi ukuran bundle.
278
+
279
+ ### Deskripsi
280
+ Panduan produksi untuk membangun grafis 3D performa tinggi di browser. Mengutamakan paradigma modern **WebGPU-first** dengan fallback otomatis ke WebGL2, **Three.js (r170+) WebGPURenderer** dan **TSL (Three Shading Language)**, **Babylon.js WebGPUEngine** dengan Snapshot Rendering, serta **PlayCanvas Engine** untuk aplikasi komersial mobile yang sangat ringan dan cepat dimuat.
281
+
282
+ ### Kondisi Pemicu
283
+ Aktifkan skill ini ketika pengguna:
284
+ - Menginisialisasi *scene* WebGPU atau WebGL 3D.
285
+ - Menggunakan `three` (`three/webgpu`), `@react-three/fiber`, `@babylonjs/core`, `playcanvas`, `@tresjs/core`, atau `@threlte/core`.
286
+ - Menulis atau merefaktor shader ke Three Shading Language (TSL) atau WGSL.
287
+ - Memuat dan mengoptimalkan model 3D (`.glb`, `.gltf`) menggunakan kompresi tekstur KTX2 atau Meshopt.
288
+ - Mengimplementasikan post-processing, compute shader, atau sistem partikel pada GPU.
289
+ - Mengatasi penurunan FPS (*frame drop*), hambatan *draw call*, atau kebocoran memori VRAM.
290
+
291
+ ---
292
+
293
+ ### Panduan Inti & Rekomendasi Mesin 3D
294
+
295
+ 1. **Three.js WebGPU + TSL**:
296
+ - Gunakan `WebGPURenderer` alih-alih `WebGLRenderer` standar.
297
+ - Manfaatkan TSL (*Three Shading Language*) dan *Node Materials*. Kode shader TSL ditulis secara deklaratif dalam TypeScript/JavaScript dan otomatis dikompilasi menjadi WGSL pada WebGPU dan GLSL pada WebGL2.
298
+
299
+ 2. **Babylon.js Snapshot Rendering**:
300
+ - Untuk skenario dengan ribuan mesh statis, aktifkan `engine.snapshotRendering = true` untuk merekam *command buffer* GPU sekali saja, memotong hampir 100% *overhead* CPU draw call JavaScript.
301
+
302
+ 3. **PlayCanvas Engine (Performa Mobile Ekstrem)**:
303
+ - Jika waktu muat (*initial load*) dan ukuran bundle adalah prioritas utama (misalnya iklan interaktif, 3D e-commerce configurator, game web mobile), PlayCanvas hanya memakan ~200KB gzipped dengan fitur *clustered lighting* yang sangat cepat.
304
+
305
+ 4. **Kompresi Tekstur GPU KTX2 (Wajib)**:
306
+ - Jangan menyajikan file PNG/JPG mentah di produksi. Format PNG/JPG diekspansi menjadi uncompressed RGBA di VRAM GPU (tekstur 4K memakan 64MB VRAM).
307
+ - Gunakan **KTX2 / Basis Universal** yang tetap terkompresi langsung di VRAM GPU (menghemat 75%-85% VRAM dan mencegah browser mobile crash).
308
+
309
+ 5. **Kompresi Geometri Meshopt**:
310
+ - Gunakan kompresi **Meshopt** (`EXT_meshopt_compression`) alih-alih Draco jika membutuhkan dekompresi super cepat di browser (hingga 10x lebih cepat dibanding Draco pada CPU mobile).
311
+
312
+ 6. **Pembersihan Memori Bersih (`.dispose()`)**:
313
+ - Browser garbage collector tidak dapat menghapus buffer GPU secara otomatis. Selalu panggil method `.dispose()` pada geometry, material, dan texture saat komponen di-unmount.