@needle-tools/engine 4.16.0-next.0798cbb → 4.16.0-next.34e2848

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.
package/SKILL.md CHANGED
@@ -1,33 +1,22 @@
1
1
  ---
2
2
  name: needle-engine
3
- description: Automatically provides Needle Engine context when working in a Needle Engine web project. Use this skill when editing TypeScript components, Vite config, GLB assets, or anything related to @needle-tools/engine.
4
- license: MIT
5
- compatibility: Designed for Claude Code and similar AI coding agents.
6
- metadata:
7
- author: Needle Tools
8
- reviewed-against: "@needle-tools/engine@4.15.0"
9
- last-reviewed: "2026-03"
3
+ description: >
4
+ Provides Needle Engine context for web-based 3D projects built on Three.js
5
+ with the @needle-tools/engine component system. Use this skill whenever the user
6
+ is working with Needle Engine components, GLB files exported from Unity or Blender,
7
+ Vite configs with needlePlugins, TypeScript classes extending Behaviour, or anything
8
+ involving @needle-tools/engine imports. Also trigger when the user mentions
9
+ "needle engine", "needle tools", serializable decorators (@serializable, @syncField,
10
+ @registerType), the <needle-engine> web component, or 3D scenes loaded from GLB
11
+ in a web context — even if they don't explicitly name the engine.
12
+ compatibility:
13
+ - optional: needle_search MCP tool (search Needle Engine docs, forum posts, and community answers)
10
14
  ---
11
15
 
12
16
  # Needle Engine
13
17
 
14
18
  You are an expert in Needle Engine — a web-first 3D engine built on Three.js with a component system and Unity/Blender-based workflow.
15
19
 
16
- ## When to Use This Skill
17
-
18
- **Use when the user is:**
19
- - Editing TypeScript files that import from `@needle-tools/engine`
20
- - Working on a project with `vite.config.ts` that uses `needlePlugins`
21
- - Loading or debugging `.glb` files exported from Unity or Blender
22
- - Using the Needle Engine Blender addon or Unity package
23
- - Asking about component lifecycle, serialization, XR, networking, or deployment
24
-
25
- **Do NOT use for:**
26
- - Pure Three.js projects with no Needle Engine
27
- - Non-web Unity/Blender work with no GLB export
28
-
29
- ---
30
-
31
20
  ## Quick Start
32
21
 
33
22
  ```html
@@ -51,7 +40,7 @@ export class HelloWorld extends Behaviour {
51
40
  }
52
41
  ```
53
42
 
54
- > **TypeScript config required:** `tsconfig.json` must have `"experimentalDecorators": true` and `"useDefineForClassFields": false` for decorators to work.
43
+ > ⚠️ **TypeScript config required:** `tsconfig.json` must have `"experimentalDecorators": true` and `"useDefineForClassFields": false` for decorators to work. Without `useDefineForClassFields: false`, TypeScript overwrites `@serializable()` properties with their default values *after* the decorator runs, silently breaking deserialization.
55
44
 
56
45
  ---
57
46
 
@@ -211,26 +200,26 @@ Use this *before* guessing at API details — the docs are the source of truth.
211
200
 
212
201
  ## Common Gotchas
213
202
 
214
- - `@registerType` is required or the component won't be instantiated from GLB (Unity/Blender export adds this automatically, but hand-written components need it)
215
- - GLB assets go in `assets/`, static files (fonts, images) in `public/` (configurable via `needle.config.json`)
216
- - `useDefineForClassFields: false` must be set in `tsconfig.json` — otherwise decorators silently break field initialization
217
- - `@syncField()` only triggers on reassignment — mutating an array/object in place won't sync; do `this.arr = this.arr`
218
- - Physics callbacks (`onCollisionEnter` etc.) require a Needle `Collider` component on the GameObject
219
- - `removeComponent()` does NOT call `onDestroy` — use `destroy(obj)` for full cleanup
220
- - Prefer `instantiate()` and `destroy()` functions over `GameObject.instantiate()` / `GameObject.destroy()`
203
+ - `@registerType` is required or the component won't be instantiated from GLB. Unity/Blender export adds this automatically via codegen; hand-written components need it explicitly.
204
+ - GLB assets go in `assets/`, static files (fonts, images, videos) in `public/` (configurable via `needle.config.json`)
205
+ - `useDefineForClassFields: false` must be set in `tsconfig.json` — otherwise TypeScript overwrites decorated fields with their defaults after the decorator runs, silently breaking serialization
206
+ - `@syncField()` only triggers on reassignment — mutating an array/object in place won't sync. Do `this.arr = this.arr` to force a sync event.
207
+ - Physics callbacks (`onCollisionEnter` etc.) require a Needle `Collider` component (BoxCollider, SphereCollider ...) on the GameObject — they won't fire on mesh-only objects
208
+ - `removeComponent()` does NOT call `onDestroy` — any cleanup logic in `onDestroy` (event listeners, timers, allocated resources) will be skipped. Use `destroy(obj)` for full cleanup.
209
+ - Prefer the standalone `instantiate()` and `destroy()` functions over `GameObject.instantiate()` / `GameObject.destroy()` — the standalone versions are the current API
221
210
  - `loadAsset()` returns a model wrapper (not an Object3D) — use `.scene` to get the root Object3D
222
- - `AssetReference.getOrCreateFromUrl()` caches by URL — loading the same URL twice returns the same Object3D. Use `.instantiate()` or `loadAsset()` with `{ context }` for multiple copies
211
+ - `AssetReference.getOrCreateFromUrl()` caches by URL — loading the same URL twice returns the same Object3D. Use `.instantiate()` or `loadAsset()` with `{ context }` for multiple independent copies
223
212
 
224
213
  ---
225
214
 
226
215
  ## References
227
216
 
228
- For detailed API usage, read these reference files:
217
+ Read these **only when needed** don't load them all upfront:
229
218
 
230
- - [Full API Reference](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/api.md) — lifecycle, decorators, context API, animation, networking, XR, physics
231
- - [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — React, Svelte, Vue, vanilla JS examples + SSR patterns
232
- - [Troubleshooting](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/troubleshooting.md) — common errors and fixes
233
- - [Component Template](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/templates/my-component.ts) — annotated starter component
219
+ - 📖 [Full API Reference](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/api.md) — read when writing component code (lifecycle, decorators, context API, animation, networking, XR, physics)
220
+ - 🔗 [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — read when integrating with React, Svelte, Vue, or vanilla JS
221
+ - 🐛 [Troubleshooting](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/troubleshooting.md) — read when debugging errors or unexpected behavior
222
+ - 🧩 [Component Template](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/templates/my-component.ts) — use as a starting point for new components
234
223
 
235
224
  ## Important URLs
236
225