vibes-plug 2.11.0 → 3.9.0

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 (181) hide show
  1. package/.claude/rules/vibes-plug-core.md +5 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +8 -3
  3. package/.cursorrules +9 -3
  4. package/AGENTS.md +25 -4
  5. package/CHANGELOG.md +151 -0
  6. package/CLAUDE.md +15 -8
  7. package/README.md +216 -641
  8. package/bin/vibes.mjs +1104 -0
  9. package/index.js +1 -1
  10. package/package.json +11 -3
  11. package/plugin.json +4 -3
  12. package/scripts/check-anti-slop.js +53 -0
  13. package/scripts/check-anti-slop.mjs +53 -0
  14. package/scripts/generate_swarm_gif.py +2 -2
  15. package/scripts/install.js +3 -1
  16. package/scripts/update_skills.js +1 -1
  17. package/scripts/update_skills.mjs +86 -0
  18. package/scripts/validate-skills.mjs +111 -0
  19. package/skills/accessibility-testing-expert/SKILL.md +117 -116
  20. package/skills/affective-computing-emotion-ai/SKILL.md +83 -0
  21. package/skills/agentic-coding-workflow-expert/SKILL.md +297 -0
  22. package/skills/agentic-memory-architect/SKILL.md +52 -0
  23. package/skills/agentic-micro-economy-architect/SKILL.md +92 -0
  24. package/skills/ai-llm-integration-expert/SKILL.md +330 -187
  25. package/skills/ai-media-generation-expert/SKILL.md +173 -172
  26. package/skills/ai-prompt-engineering-expert/SKILL.md +170 -50
  27. package/skills/ai-safety-governance-expert/SKILL.md +223 -0
  28. package/skills/angular-expert/SKILL.md +149 -148
  29. package/skills/anti-slop/SKILL.md +134 -0
  30. package/skills/api-design-expert/SKILL.md +4 -3
  31. package/skills/api-gateway-proxy-expert/SKILL.md +3 -2
  32. package/skills/app-analyzer-optimizer/SKILL.md +4 -3
  33. package/skills/apple-ecosystem-expert/SKILL.md +6 -5
  34. package/skills/astro-framework-expert/SKILL.md +201 -200
  35. package/skills/async-queue-temporal-expert/SKILL.md +218 -240
  36. package/skills/authentication-identity-expert/SKILL.md +79 -184
  37. package/skills/autonomous-red-teamer/SKILL.md +338 -203
  38. package/skills/autonomous-tdd-debugger/SKILL.md +6 -5
  39. package/skills/biome-linter-formatter-expert/SKILL.md +90 -89
  40. package/skills/blockchain-web3-expert/SKILL.md +116 -115
  41. package/skills/brainstorming/SKILL.md +392 -377
  42. package/skills/browser-automation-expert/SKILL.md +260 -222
  43. package/skills/bun-runtime-expert/SKILL.md +5 -4
  44. package/skills/chatbot-messaging-expert/SKILL.md +115 -114
  45. package/skills/ci-cd-devops-architect/SKILL.md +3 -2
  46. package/skills/cloud-hosting-expert/SKILL.md +5 -4
  47. package/skills/coderabbit/SKILL.md +5 -4
  48. package/skills/compliance-gdpr-privacy-expert/SKILL.md +3 -2
  49. package/skills/composable-mach-architect/SKILL.md +338 -0
  50. package/skills/cron-scheduler-expert/SKILL.md +5 -4
  51. package/skills/data-pipeline-etl-expert/SKILL.md +3 -2
  52. package/skills/data-telemetry-expert/SKILL.md +5 -4
  53. package/skills/data-visualization-expert/SKILL.md +155 -154
  54. package/skills/database-orm-expert/SKILL.md +102 -240
  55. package/skills/deep-research-analyst/SKILL.md +182 -0
  56. package/skills/dependency-upgrade-migrator/SKILL.md +11 -10
  57. package/skills/design-system-architect/SKILL.md +34 -3
  58. package/skills/desktop-electron-expert/SKILL.md +129 -128
  59. package/skills/documentation-site-expert/SKILL.md +60 -59
  60. package/skills/doku-mcp-server/SKILL.md +5 -4
  61. package/skills/doku-payment-gateway/SKILL.md +250 -232
  62. package/skills/domain-driven-design-expert/SKILL.md +3 -2
  63. package/skills/e2e-testing-expert/SKILL.md +5 -4
  64. package/skills/ecommerce-expert/SKILL.md +88 -87
  65. package/skills/email-notification-expert/SKILL.md +35 -7
  66. package/skills/ephemeral-generative-ui-architect/SKILL.md +88 -0
  67. package/skills/error-resilience-expert/SKILL.md +26 -4
  68. package/skills/event-driven-architect/SKILL.md +5 -4
  69. package/skills/feature-flag-analytics-expert/SKILL.md +3 -2
  70. package/skills/file-upload-media-expert/SKILL.md +5 -4
  71. package/skills/firebase-security-expert/SKILL.md +5 -4
  72. package/skills/form-validation-expert/SKILL.md +7 -6
  73. package/skills/frontier-ai-models-expert/SKILL.md +116 -0
  74. package/skills/fullstack-expert/SKILL.md +68 -144
  75. package/skills/gemini-agent-booster/SKILL.md +248 -172
  76. package/skills/geospatial-maps-expert/SKILL.md +81 -80
  77. package/skills/global-a11y-i18n-expert/SKILL.md +5 -4
  78. package/skills/glsl-shader-expert/SKILL.md +155 -71
  79. package/skills/go-programming-expert/SKILL.md +5 -4
  80. package/skills/graph-rag-knowledge-expert/SKILL.md +201 -159
  81. package/skills/graphql-apollo-expert/SKILL.md +5 -4
  82. package/skills/headless-cms-expert/SKILL.md +182 -181
  83. package/skills/hig/SKILL.md +5 -4
  84. package/skills/js-backend-expert/SKILL.md +219 -218
  85. package/skills/legacy-code-translator/SKILL.md +6 -5
  86. package/skills/llm-finops-router/SKILL.md +52 -0
  87. package/skills/local-slm-edge-ai-expert/SKILL.md +168 -167
  88. package/skills/logging-error-tracking-expert/SKILL.md +5 -4
  89. package/skills/mcp-server-architect/SKILL.md +316 -294
  90. package/skills/micro-frontend-architect/SKILL.md +5 -4
  91. package/skills/mobile-expo-expert/SKILL.md +5 -4
  92. package/skills/modern-css-native-expert/SKILL.md +190 -189
  93. package/skills/monorepo-architect/SKILL.md +5 -4
  94. package/skills/mpa-orchestrator/SKILL.md +41 -4
  95. package/skills/multi-agent-orchestration/SKILL.md +388 -254
  96. package/skills/mvc-expert/SKILL.md +5 -4
  97. package/skills/n8n-automation-expert/SKILL.md +90 -89
  98. package/skills/nextjs-app-router-expert/SKILL.md +3 -2
  99. package/skills/openapi-swagger-codegen-expert/SKILL.md +4 -3
  100. package/skills/payment-gateway-expert/SKILL.md +131 -128
  101. package/skills/pdf-document-generation-expert/SKILL.md +92 -91
  102. package/skills/performance-web-vitals/SKILL.md +5 -4
  103. package/skills/post-quantum-crypto-migrator/SKILL.md +3 -2
  104. package/skills/prd-architect/SKILL.md +85 -109
  105. package/skills/proactive-background-watcher/SKILL.md +5 -4
  106. package/skills/production-ready-hardener/SKILL.md +25 -27
  107. package/skills/pwa-offline-first-expert/SKILL.md +227 -185
  108. package/skills/pydantic-ai-expert/SKILL.md +162 -0
  109. package/skills/python-programming-expert/SKILL.md +5 -4
  110. package/skills/rate-limit-abuse-prevention/SKILL.md +5 -4
  111. package/skills/realtime-collaboration-expert/SKILL.md +3 -2
  112. package/skills/rich-text-editor-expert/SKILL.md +178 -177
  113. package/skills/rust-programming-expert/SKILL.md +5 -4
  114. package/skills/saas-architect/SKILL.md +155 -0
  115. package/skills/saas-billing/SKILL.md +394 -382
  116. package/skills/saas-multi-tenant/SKILL.md +7 -6
  117. package/skills/scalability-clean-code/SKILL.md +5 -4
  118. package/skills/search-engine-expert/SKILL.md +90 -89
  119. package/skills/self-healing-cloud-orchestrator/SKILL.md +3 -2
  120. package/skills/senior-frontend/SKILL.md +21 -18
  121. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1 -1
  122. package/skills/seo/SKILL.md +4 -4
  123. package/skills/session-memory-manager/SKILL.md +129 -0
  124. package/skills/solidjs-expert/SKILL.md +81 -80
  125. package/skills/spa-orchestrator/SKILL.md +5 -4
  126. package/skills/sse-websocket-streaming-expert/SKILL.md +3 -2
  127. package/skills/state-management-expert/SKILL.md +5 -4
  128. package/skills/supabase-security-expert/SKILL.md +5 -4
  129. package/skills/svelte-sveltekit-expert/SKILL.md +92 -91
  130. package/skills/svg-animation-motion-expert/SKILL.md +3 -2
  131. package/skills/synthetic-data-finetuning-expert/SKILL.md +156 -0
  132. package/skills/tailwind-expert/SKILL.md +62 -5
  133. package/skills/tanstack-query-expert/SKILL.md +5 -4
  134. package/skills/tauri-expert/SKILL.md +5 -4
  135. package/skills/typescript-expert/SKILL.md +5 -4
  136. package/skills/ui-ux-pro-max/SKILL.md +7 -4
  137. package/skills/vector-db-rag-expert/SKILL.md +209 -208
  138. package/skills/vercel-ai-sdk-expert/SKILL.md +226 -0
  139. package/skills/voice-ai-realtime-agent/SKILL.md +243 -202
  140. package/skills/vue-frontend-expert/SKILL.md +5 -4
  141. package/skills/wasm-edge-computing-expert/SKILL.md +3 -2
  142. package/skills/web-3d-graphics-expert/SKILL.md +259 -82
  143. package/skills/web-game-engine-expert/SKILL.md +278 -50
  144. package/skills/web-scraper/SKILL.md +158 -157
  145. package/skills/website-design-cloner/SKILL.md +5 -4
  146. package/skills/webxr-ar-vr-expert/SKILL.md +105 -65
  147. package/skills/wordpress-headless-expert/SKILL.md +145 -144
  148. package/skills/zero-tech-debt-auditor/SKILL.md +115 -0
  149. package/skills/zero-to-prod-orchestrator/SKILL.md +281 -227
  150. package/skills/zero-trust-secret-vault/SKILL.md +3 -2
  151. package/BLUEPRINT.md +0 -309
  152. package/skills/ai-cost-token-optimizer/SKILL.md +0 -82
  153. package/skills/ai-evals-benchmark-expert/SKILL.md +0 -188
  154. package/skills/asisten-ramah/SKILL.md +0 -47
  155. package/skills/auto-doc-updater/SKILL.md +0 -220
  156. package/skills/autonomous-chaos-monkey/SKILL.md +0 -63
  157. package/skills/background-jobs-queue-expert/SKILL.md +0 -235
  158. package/skills/bootstrap-to-modern/SKILL.md +0 -94
  159. package/skills/database-migration-versioning-expert/SKILL.md +0 -90
  160. package/skills/edge-serverless-db-expert/SKILL.md +0 -99
  161. package/skills/mcp-client-orchestrator/SKILL.md +0 -76
  162. package/skills/mobile-push-notification-expert/SKILL.md +0 -71
  163. package/skills/monday-design-aesthetic/SKILL.md +0 -73
  164. package/skills/multiple-entry-points/SKILL.md +0 -91
  165. package/skills/project-context-mapper/SKILL.md +0 -85
  166. package/skills/saas-mvp-launcher/SKILL.md +0 -260
  167. package/skills/saas-transformer/SKILL.md +0 -500
  168. package/skills/saas-transformer/references/billing_integration_guide.md +0 -401
  169. package/skills/secure-fuzz-testing/SKILL.md +0 -207
  170. package/skills/self-evolving-memory-graph/SKILL.md +0 -91
  171. package/skills/session-context-loader/SKILL.md +0 -83
  172. package/skills/session-handoff-resume/SKILL.md +0 -164
  173. package/skills/skill-baru/SKILL.md +0 -178
  174. package/skills/supabase-migration/SKILL.md +0 -91
  175. package/skills/token-saver/SKILL.md +0 -119
  176. package/skills/ui-components-expert/SKILL.md +0 -166
  177. package/skills/vibe-code-gardener/SKILL.md +0 -181
  178. package/skills/visual-qa-vision-agent/SKILL.md +0 -71
  179. /package/skills/{saas-transformer → saas-architect}/references/feature_gating_patterns.md +0 -0
  180. /package/skills/{saas-transformer → saas-architect}/references/saas_transformation_checklist.md +0 -0
  181. /package/skills/{saas-transformer → saas-architect}/scripts/saas_transformation_scanner.py +0 -0
@@ -1,10 +1,11 @@
1
1
  ---
2
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"
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
+ version: "3.0.0"
5
6
  ---
6
7
 
7
- # Web 3D Graphics Expert (Three.js & Babylon.js)
8
+ # Web 3D Graphics Expert (WebGPU, Three.js, Babylon.js & PlayCanvas)
8
9
 
9
10
  [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
11
 
@@ -14,102 +15,252 @@ author: "Roedy Rustam"
14
15
  ## English
15
16
 
16
17
  ### 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
+ Connects and orchestrates with relevant domain skills:
19
+ - `senior-frontend` — Integrating React Three Fiber (R3F) in React 19 / Next.js 15.
20
+ - `vue-frontend-expert` — Integrating TresJS in Vue 3 / Nuxt 3.
21
+ - `svelte-sveltekit-expert` — Integrating Threlte in Svelte 5 (Runes).
22
+ - `web-game-engine-expert` — Physics simulations (Rapier, Jolt, Havok), game loops, and ECS.
23
+ - `glsl-shader-expert` — Shading languages, WGSL compute shaders, and TSL nodes.
24
+ - `webxr-ar-vr-expert` — WebXR immersive VR/AR experiences.
25
+ - `performance-web-vitals` — Minimizing Total Blocking Time (TBT), asset streaming, and bundle sizing.
18
26
 
19
27
  ### 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.
28
+ 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.
21
29
 
22
30
  ### Trigger Conditions
23
31
  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.
32
+ - Initializing a WebGPU or WebGL 3D scene.
33
+ - Using `three` (`three/webgpu`), `@react-three/fiber`, `@babylonjs/core`, `playcanvas`, `@tresjs/core`, or `@threlte/core`.
34
+ - Writing or refactoring shaders to Three Shading Language (TSL) or WGSL.
35
+ - Loading and optimizing 3D models (`.glb`, `.gltf`) with KTX2 texture compression or Meshopt.
36
+ - Implementing post-processing passes, compute shaders, or particle systems on the GPU.
37
+ - Diagnosing FPS drops, draw call bottlenecks, or VRAM memory leaks.
29
38
 
30
39
  ---
31
40
 
32
- ### Core Concepts & Framework Selection
41
+ ### Modern Web 3D Engine Landscape (2026)
33
42
 
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.
43
+ | Engine / Stack | Best Use Case | Rendering Backend | Key Strengths |
44
+ | :--- | :--- | :--- | :--- |
45
+ | **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. |
46
+ | **Babylon.js** | Enterprise 3D simulations, CAD viewers, AAA web games with Havok | WebGPU + WebGL2 | Snapshot rendering, native Havok physics, compute shaders, robust GUI & inspector. |
47
+ | **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. |
48
+ | **Threlte (Svelte 5)** | Svelte 5 apps requiring declarative 3D reactive components | Three.js WebGL/WebGPU | Svelte Runes reactivity (`$state`, `$derived`), lightweight bundle footprint. |
36
49
 
37
- ```tsx
38
- import { Canvas } from '@react-three/fiber'
39
- import { OrbitControls, Environment, useGLTF } from '@react-three/drei'
50
+ ---
40
51
 
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
- }
52
+ ### 1. Three.js WebGPU & TSL (Three Shading Language)
53
+
54
+ Starting with modern Three.js, transition from `WebGLRenderer` to `WebGPURenderer`. It natively uses WebGPU when available and falls back cleanly to WebGL2.
55
+
56
+ ```typescript
57
+ // Modern Three.js WebGPU Scene Setup
58
+ import * as THREE from 'three/webgpu';
59
+ import { color, float, positionLocal, time, vec3, Fn } from 'three/tsl';
60
+
61
+ const canvas = document.querySelector('#canvas') as HTMLCanvasElement;
62
+ const renderer = new THREE.WebGPURenderer({ canvas, antialias: true });
63
+ renderer.setSize(window.innerWidth, window.innerHeight);
64
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
65
+
66
+ // Initialize async WebGPU pipeline
67
+ await renderer.init();
68
+
69
+ const scene = new THREE.Scene();
70
+ const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
71
+ camera.position.set(0, 2, 5);
72
+
73
+ // TSL (Three Shading Language) Custom Node Material
74
+ // Compiles automatically to WGSL on WebGPU and GLSL on WebGL2!
75
+ const customMaterial = new THREE.MeshStandardNodeMaterial();
76
+
77
+ // Node-based animated color shader function
78
+ const animatedColor = Fn(() => {
79
+ const t = time.mul(2.0);
80
+ const wave = positionLocal.y.add(t).sin().mul(0.5).add(0.5);
81
+ return color(0x00ffff).mul(wave);
82
+ });
83
+
84
+ customMaterial.colorNode = animatedColor();
85
+
86
+ const mesh = new THREE.Mesh(new THREE.TorusKnotGeometry(1, 0.3, 128, 32), customMaterial);
87
+ scene.add(mesh);
88
+
89
+ // Render loop using setAnimationLoop (WebGPU & WebXR compatible)
90
+ renderer.setAnimationLoop(() => {
91
+ mesh.rotation.y += 0.01;
92
+ renderer.render(scene, camera);
93
+ });
53
94
  ```
54
- *Note: Always use `@react-three/drei` for common helpers (OrbitControls, Text, Environment).*
55
95
 
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.
96
+ ---
97
+
98
+ ### 2. Babylon.js WebGPU Engine & Snapshot Rendering
99
+
100
+ 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.
59
101
 
60
102
  ```typescript
61
- // Basic Babylon.js Setup
62
- import { Engine, Scene, FreeCamera, Vector3, MeshBuilder, HemisphericLight } from '@babylonjs/core'
103
+ import { WebGPUEngine, Scene, ArcRotateCamera, Vector3, HemisphericLight, MeshBuilder } from '@babylonjs/core';
104
+
105
+ async function initBabylonWebGPU() {
106
+ const canvas = document.getElementById('renderCanvas') as HTMLCanvasElement;
107
+ const engine = new WebGPUEngine(canvas, { antialiasing: true });
108
+ await engine.initAsync();
63
109
 
64
- const canvas = document.getElementById('renderCanvas') as HTMLCanvasElement
65
- const engine = new Engine(canvas, true)
66
- const scene = new Scene(engine)
110
+ const scene = new Scene(engine);
111
+ const camera = new ArcRotateCamera('camera', -Math.PI / 2, Math.PI / 2.5, 10, Vector3.Zero(), scene);
112
+ camera.attachControl(canvas, true);
67
113
 
68
- const camera = new FreeCamera('camera1', new Vector3(0, 5, -10), scene)
69
- camera.setTarget(Vector3.Zero())
70
- camera.attachControl(canvas, true)
114
+ const light = new HemisphericLight('light', new Vector3(0, 1, 0), scene);
71
115
 
72
- const light = new HemisphericLight('light', new Vector3(0, 1, 0), scene)
73
- const sphere = MeshBuilder.CreateSphere('sphere', { diameter: 2 }, scene)
116
+ // Enable Snapshot Rendering for extreme draw call reduction
117
+ engine.snapshotRendering = true;
118
+ engine.snapshotRenderingMode = WebGPUEngine.SNAPSHOTRENDERING_FAST;
74
119
 
75
- engine.runRenderLoop(() => {
76
- scene.render()
77
- })
120
+ engine.runRenderLoop(() => {
121
+ scene.render();
122
+ });
123
+ }
78
124
  ```
79
125
 
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.
126
+ ---
127
+
128
+ ### 3. PlayCanvas Engine (Ultra-Lightweight & Fast-Loading)
129
+
130
+ When bundle size and instant mobile loading are the primary constraints, use the standalone PlayCanvas Engine:
131
+
132
+ ```typescript
133
+ import * as pc from 'playcanvas';
134
+
135
+ const canvas = document.getElementById('application-canvas') as HTMLCanvasElement;
136
+ const app = new pc.Application(canvas, {
137
+ graphicsDeviceOptions: { alpha: false, antialias: true, preferWebGpu: true }
138
+ });
139
+ app.start();
140
+ app.setCanvasFillMode(pc.FILLMODE_FILL_WINDOW);
141
+ app.setCanvasResolution(pc.RESOLUTION_AUTO);
142
+
143
+ // Create Entity: Camera
144
+ const camera = new pc.Entity('camera');
145
+ camera.addComponent('camera', { clearColor: new pc.Color(0.1, 0.1, 0.15) });
146
+ camera.translate(0, 2, 6);
147
+ camera.lookAt(0, 0, 0);
148
+ app.root.addChild(camera);
149
+
150
+ // Create Entity: Clustered Directional Light
151
+ const light = new pc.Entity('light');
152
+ light.addComponent('light', { type: 'directional', castShadows: true });
153
+ light.setEulerAngles(45, 30, 0);
154
+ app.root.addChild(light);
155
+
156
+ // Create Entity: Box with Standard Material
157
+ const box = new pc.Entity('box');
158
+ box.addComponent('render', { type: 'box' });
159
+ app.root.addChild(box);
160
+
161
+ app.on('update', (dt: number) => {
162
+ box.rotate(10 * dt, 20 * dt, 30 * dt);
163
+ });
164
+ ```
84
165
 
85
166
  ---
86
167
 
87
- ### Best Practices for Performance
168
+ ### 4. React Three Fiber (R3F) with React 19
88
169
 
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.
170
+ ```tsx
171
+ import { Canvas } from '@react-three/fiber';
172
+ import { OrbitControls, Environment, useGLTF, Float } from '@react-three/drei';
173
+
174
+ function ModelViewer() {
175
+ const { scene } = useGLTF('/models/drone.glb');
176
+ return (
177
+ <Float speed={2} rotationIntensity={0.5} floatIntensity={1}>
178
+ <primitive object={scene} />
179
+ </Float>
180
+ );
181
+ }
182
+
183
+ export default function App() {
184
+ return (
185
+ <Canvas
186
+ gl={(canvas) => new THREE.WebGPURenderer({ canvas, antialias: true })}
187
+ camera={{ position: [0, 1.5, 4], fov: 45 }}
188
+ dpr={[1, 2]}
189
+ >
190
+ <ambientLight intensity={0.6} />
191
+ <directionalLight position={[5, 10, 5]} castShadow intensity={1.5} />
192
+ <ModelViewer />
193
+ <Environment preset="city" />
194
+ <OrbitControls makeDefault enableDamping dampingFactor={0.05} />
195
+ </Canvas>
196
+ );
197
+ }
198
+
199
+ // Preload critical assets outside component tree
200
+ useGLTF.preload('/models/drone.glb');
201
+ ```
98
202
 
99
203
  ---
100
204
 
101
- ### Integration with Other Skills (MANDATORY)
205
+ ### Modern Asset Pipeline & GPU Memory Optimization
206
+
207
+ #### 1. GPU Texture Compression: KTX2 + Basis Universal (`KHR_texture_basisu`)
208
+ > **CRITICAL RULE**: Never deploy raw PNG or JPG textures for 3D production models.
209
+ - **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**.
210
+ - **KTX2 with Basis Universal** transcodes in real-time into native GPU-compressed formats:
211
+ - Mobile: ASTC / ETC2.
212
+ - Desktop: BC7 / BC1.
213
+ - **Result:** Saves **75% to 85% of GPU VRAM**, prevents mobile browser tab crashes, and eliminates texture upload GPU hitches.
214
+ - **Tooling:** Compress glTF files with `gltf-transform`:
215
+ ```bash
216
+ npx @gltf-transform/cli optimize input.glb output.glb --texture-compress ktx2
217
+ ```
218
+
219
+ #### 2. Geometry Optimization: Meshopt (`EXT_meshopt_compression`)
220
+ - Prefer **Meshopt** over Draco for high-framerate interactive apps and games.
221
+ - **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.
222
+ ```bash
223
+ npx @gltf-transform/cli meshopt input.glb output.glb
224
+ ```
225
+
226
+ #### 3. Strict Memory Lifecycle Management (`.dispose()`)
227
+ Garbage collection does NOT clean up WebGL/WebGPU buffers:
228
+ - When removing an object from Three.js or Babylon.js, explicitly traverse and dispose:
229
+ ```typescript
230
+ export function purgeObject(object: THREE.Object3D) {
231
+ object.traverse((child) => {
232
+ if ((child as THREE.Mesh).isMesh) {
233
+ const mesh = child as THREE.Mesh;
234
+ mesh.geometry?.dispose();
235
+ if (Array.isArray(mesh.material)) {
236
+ mesh.material.forEach((m) => disposeMaterial(m));
237
+ } else if (mesh.material) {
238
+ disposeMaterial(mesh.material);
239
+ }
240
+ }
241
+ });
242
+ }
102
243
 
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).
244
+ function disposeMaterial(material: THREE.Material) {
245
+ Object.keys(material).forEach((prop) => {
246
+ const value = (material as any)[prop];
247
+ if (value && typeof value.dispose === 'function') {
248
+ value.dispose();
249
+ }
250
+ });
251
+ material.dispose();
252
+ }
253
+ ```
107
254
 
108
- ### Referenced By Orchestrators (MANDATORY)
255
+ ---
109
256
 
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).
257
+ ### Production Checklist
258
+ - [ ] Render with `WebGPURenderer` (Three.js) or `WebGPUEngine` (Babylon.js) with fallback enabled.
259
+ - [ ] Use KTX2 / Basis Universal compressed textures on all `.glb` assets.
260
+ - [ ] Use Meshopt geometry compression to eliminate model loading CPU stalls.
261
+ - [ ] Clamp `devicePixelRatio` to `Math.min(window.devicePixelRatio, 2)` to prevent 4K/Retina mobile GPU thermal throttling.
262
+ - [ ] Use `InstancedMesh` (Three.js) or `Thin Instances` (Babylon.js) for repetitive assets (>10 meshes).
263
+ - [ ] Implement explicit `.dispose()` cleanup in `useEffect` or component unmount hooks.
113
264
 
114
265
  ---
115
266
 
@@ -117,21 +268,47 @@ This skill should be referenced by the following orchestrators:
117
268
  ## Bahasa Indonesia
118
269
 
119
270
  ### 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.
271
+ Terhubung dan mengorkestrasi skill domain yang relevan:
272
+ - `senior-frontend` — Integrasi React Three Fiber (R3F) pada React 19 / Next.js 15.
273
+ - `vue-frontend-expert` — Integrasi TresJS pada Vue 3 / Nuxt 3.
274
+ - `svelte-sveltekit-expert` — Integrasi Threlte pada Svelte 5 (Runes).
275
+ - `web-game-engine-expert` — Simulasi fisika (Rapier, Jolt, Havok), game loop, dan ECS.
276
+ - `glsl-shader-expert` — Bahasa shader, compute shader WGSL, dan node TSL.
277
+ - `webxr-ar-vr-expert` — Pengalaman WebXR VR/AR imersif.
278
+ - `performance-web-vitals` — Meminimalkan TBT (Total Blocking Time) dan optimasi ukuran bundle.
121
279
 
122
280
  ### 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.
281
+ 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.
124
282
 
125
283
  ### 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.
284
+ Aktifkan skill ini ketika pengguna:
285
+ - Menginisialisasi *scene* WebGPU atau WebGL 3D.
286
+ - Menggunakan `three` (`three/webgpu`), `@react-three/fiber`, `@babylonjs/core`, `playcanvas`, `@tresjs/core`, atau `@threlte/core`.
287
+ - Menulis atau merefaktor shader ke Three Shading Language (TSL) atau WGSL.
288
+ - Memuat dan mengoptimalkan model 3D (`.glb`, `.gltf`) menggunakan kompresi tekstur KTX2 atau Meshopt.
289
+ - Mengimplementasikan post-processing, compute shader, atau sistem partikel pada GPU.
290
+ - Mengatasi penurunan FPS (*frame drop*), hambatan *draw call*, atau kebocoran memori VRAM.
291
+
292
+ ---
293
+
294
+ ### Panduan Inti & Rekomendasi Mesin 3D
295
+
296
+ 1. **Three.js WebGPU + TSL**:
297
+ - Gunakan `WebGPURenderer` alih-alih `WebGLRenderer` standar.
298
+ - 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.
299
+
300
+ 2. **Babylon.js Snapshot Rendering**:
301
+ - 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.
302
+
303
+ 3. **PlayCanvas Engine (Performa Mobile Ekstrem)**:
304
+ - 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.
305
+
306
+ 4. **Kompresi Tekstur GPU KTX2 (Wajib)**:
307
+ - Jangan menyajikan file PNG/JPG mentah di produksi. Format PNG/JPG diekspansi menjadi uncompressed RGBA di VRAM GPU (tekstur 4K memakan 64MB VRAM).
308
+ - Gunakan **KTX2 / Basis Universal** yang tetap terkompresi langsung di VRAM GPU (menghemat 75%-85% VRAM dan mencegah browser mobile crash).
309
+
310
+ 5. **Kompresi Geometri Meshopt**:
311
+ - 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).
312
+
313
+ 6. **Pembersihan Memori Bersih (`.dispose()`)**:
314
+ - Browser garbage collector tidak dapat menghapus buffer GPU secara otomatis. Selalu panggil method `.dispose()` pada geometry, material, dan texture saat komponen di-unmount.