[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FQM6P3CC2RY9XE1Q9CCA13":3,"skill-same:01M6FQM6P3CC2RY9XE1Q9CCA13":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":54,"updatedAt":55,"install":56,"resources":69},"01M6FQM6P3CC2RY9XE1Q9CCA13","xr-live-plugin-dev",null,"Adds or modifies \u003Cthree-live> and \u003Cxr-live> plugins, userData.xr spatial traits, glTF ANDROID_xr_scenecore extensions, USDZ customData.xr metadata, and native Android (Filament \u002F SceneCore) or iOS\u002FvisionOS (RealityKit) runtime features. Use when contributing new capabilities to the three-live monorepo or keeping Web, Rust, Android, and iOS\u002FvisionOS runtimes in parity.","google\u002Fthree-live","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6FQKY2F8Z0ZCYTZXQDHNZH2",390,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fthree-live\u002Fblob\u002Fmain\u002Fskills\u002Fxr-live-plugin-dev\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"dev","plugin dev","plugin","live","xr live plugin dev","usdz","new","when","extensions","contributing","native","web","gltf","android","capabilities","traits","use","rust","runtime","monorepo","three","runtimes","2026-11-10 10:12:30",false,"---\nname: xr-live-plugin-dev\ndescription: >-\n  Adds or modifies \u003Cthree-live> and \u003Cxr-live> plugins, userData.xr spatial\n  traits, glTF ANDROID_xr_scenecore extensions, USDZ customData.xr metadata,\n  and native Android (Filament \u002F SceneCore) or iOS\u002FvisionOS (RealityKit)\n  runtime features. Use when contributing new capabilities to the three-live\n  monorepo or keeping Web, Rust, Android, and iOS\u002FvisionOS runtimes in parity.\n---\n\n# Developing Cross-Platform `\u003Cthree-live>` & `\u003Cxr-live>` Plugins\n\nEvery `\u003Cxr-live>` feature is authored once and executes across **Web (`WebGL2` \u002F `WebXR`)**, **Android (`Filament` \u002F Jetpack XR `SceneCore`)**, and **iOS & visionOS (`RealityKit`)**. Follow this 5-step workflow whenever adding or modifying a plugin or `userData.xr` trait so the platforms never drift.\n\n---\n\n## Step 1: Canonical Trait Schema (`three-live\u002Fsrc\u002Fxr-trait-schema.ts`)\n\n`three-live\u002Fsrc\u002Fxr-trait-schema.ts` is the single source of truth for trait validation, clamping, and export serialization:\n\n1. **Define the normalized TypeScript interface** and a pure parser `parse\u003CFeature>(raw: unknown)` using `clampNum(v, lo, hi, fallback)`, `isFiniteVec3(v)`, `shortString(v, max)`, and `safeMediaUrl(v)`.\n2. **Add the field to `NormalizedXRTraits` and `normalizeXRTraits(raw)`** so both web plugins and exporters see identical defaults and bounds.\n3. **Export to glTF (`buildXRSceneCoreExtension`)**: Map the normalized field into `nodes[i].extensions.ANDROID_xr_scenecore`.\n4. **Export to USDZ (`flattenXRTraitsForUsd`)**: Flatten nested objects into camelCase scalar\u002Fvec3 keys (`\u003Ctrait>\u003CField>`) so `buildUsdXRLines()` emits valid USDA `customData = { dictionary xr = { ... } }` lines without injection risk.\n\n---\n\n## Step 2: Web Plugin (`xr-live\u002Fsrc\u002Fplugins\u002F\u003Cname>.ts`)\n\n1. Implement `ThreeLivePlugin` (`three-live\u002Fsrc\u002Fplugin.ts`):\n   - `name`: Unique `'xr-live-\u003Cname>'` identifier.\n   - `onElementConnected(element)` \u002F `onElementDisconnected(element)`: Attach and clean up DOM event listeners (`xr-select-start`, `xr-select-move`, `xr-select-end`) via `WeakMap` state.\n   - `onConfigureXRSessionInit(element, sessionInit)`: Add required\u002Foptional WebXR features (e.g. `'plane-detection'`, `'mesh-detection'`, `'hand-tracking'`).\n   - `onXRFrame(viewer, session, frame, refSpace)` & `onUpdate(viewer, dt)`: Step per-frame simulation and dynamic meshes (`createDynamicMesh`, `updateDynamicMesh`, `removeDynamicMesh`, `setWorldTRS` from `xr-live\u002Fsrc\u002Fplugins\u002Fcommon.ts`).\n2. **Register and export** the plugin in `xr-live\u002Fsrc\u002Fplugins\u002Findex.ts`.\n3. **Bound all resources:** Enforce explicit constants (`MAX_*`) on any dynamic geometry, array, or network\u002Fevent payload.\n\n---\n\n## Step 3: Native Android Parity (`mobile\u002Fandroid\u002F`)\n\nUpdate the Android runtime so compiled `.glb` scenes and scripts execute the trait identically:\n\n1. **`mobile\u002Fandroid\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002FXRLiveSceneCoreHelper.kt`:** Parse the new `extras.xr` \u002F `ANDROID_xr_scenecore` fields with the exact same clamping ranges as `xr-trait-schema.ts`.\n2.  **Modular Feature File\n    (`mobile\u002Fandroid\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002F\u003CFeatureName>.kt`) &\n    `XRSpatialMath.kt`:** Implement pure, allocation-free math and per-feature\n    state machines in a dedicated Kotlin file (e.g. `SpatialMeasure.kt`,\n    `MagneticSnap.kt`, `GazeDwell.kt`, `ExplodedView.kt`,\n    `PersistentAnchors.kt`, `SpatialLocomotion.kt`, `SharedRoom.kt`) rather than\n    bloating a single monolith.\n3.  **`mobile\u002Fandroid\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002FXRSpatialFeatures.kt` &\n    `XRLiveRuntimeSession.kt`:** Wire the modular controller into\n    `stepFrame(dtSeconds)` and emit dynamic `ThreeLiveMeshPrimitive` geometry\n    (and optional `sectionPlane` uniforms) for `ThreeLiveFilamentRenderer.kt`.\n\n---\n\n## Step 4: Native iOS & visionOS Parity (`mobile\u002Fios\u002F`)\n\nUpdate the Swift package under `mobile\u002Fios\u002FSources\u002FThreeLiveCompiler\u002F`:\n\n1. **`XRLiveRuntimeSession.swift` & `XRLiveRealityKit.swift`:** Parse the trait from GLB `extras.xr` and USDZ `customData.xr`.\n2.  **Modular Feature File (`\u003CFeatureName>.swift`),\n    `XRSpatialRealityKitFeatures.swift`, & `XRLiveRealityKitSession.swift`:**\n    Mirror the math and dynamic entity updates in a dedicated Swift file (e.g.\n    `SpatialMeasure.swift`, `MagneticSnap.swift`, `GazeDwell.swift`,\n    `ExplodedView.swift`, `PersistentAnchors.swift`, `SpatialLocomotion.swift`,\n    `SharedRoom.swift`) orchestrated by `XRSpatialRealityKitFeatures.swift`.\n3. **Parity Test Check:** Android's `mobile\u002Fandroid\u002Fsrc\u002Ftest\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002FXRLiveSwiftSourceParityTest.kt` verifies that the Swift sources implement all required symbols and trait keys even when building on Linux.\n\n---\n\n## Step 5: Build, Bundle Budget & Test Verification\n\n1. **Rebuild Web bundles & embedded Rust engine asset:**\n\n    ```bash\n    node scripts\u002Fbuild.js\n    ```\n\n    Verify that all 15 `.min.js.gz` bundles in `scripts\u002Fbuild.js` remain within\n    their enforced byte budgets:\n\n    -   `three-live-viewer.min.js`: `\u003C 30 KB gz`\n    -   `three-live.min.js`: `\u003C 73 KB gz`\n    -   `three-live-studio.min.js`: `\u003C 29 KB gz`\n    -   `three-live-cad.min.js`: `\u003C 17 KB gz`\n    -   `three-live-procedural.min.js`: `\u003C 28 KB gz`\n    -   `three-live-animation.min.js`: `\u003C 11 KB gz`\n    -   `three-live-ai.min.js`: `\u003C 20 KB gz`\n    -   `three-live-full.min.js`: `\u003C 160 KB gz`\n    -   `xr-live-viewer.min.js`: `\u003C 55 KB gz`\n    -   `xr-live.min.js`: `\u003C 84 KB gz`\n    -   `xr-live-sensors.min.js`: `\u003C 10 KB gz`\n    -   `xr-live-spatial.min.js`: `\u003C 63 KB gz`\n    -   `xr-live-sim.min.js`: `\u003C 30 KB gz`\n    -   `xr-live-webgpu.min.js`: `\u003C 12 KB gz`\n    -   `xr-live-full.min.js`: `\u003C 268 KB gz`\n2. **Run Web, Rust, and Mobile tests:**\n\n   ```bash\n   node scripts\u002Fbuild.js --test\n   cd compiler && cargo test\n   ```\n3. **Update `llms.txt` and `llms-full.txt`:**\n\n   ```bash\n   node scripts\u002Fbuild_llms_txt.js\n   ```\n","# Developing Cross-Platform `\u003Cthree-live>` & `\u003Cxr-live>` Plugins\n\nEvery `\u003Cxr-live>` feature is authored once and executes across **Web (`WebGL2` \u002F `WebXR`)**, **Android (`Filament` \u002F Jetpack XR `SceneCore`)**, and **iOS & visionOS (`RealityKit`)**. Follow this 5-step workflow whenever adding or modifying a plugin or `userData.xr` trait so the platforms never drift.\n\n---\n\n## Step 1: Canonical Trait Schema (`three-live\u002Fsrc\u002Fxr-trait-schema.ts`)\n\n`three-live\u002Fsrc\u002Fxr-trait-schema.ts` is the single source of truth for trait validation, clamping, and export serialization:\n\n1. **Define the normalized TypeScript interface** and a pure parser `parse\u003CFeature>(raw: unknown)` using `clampNum(v, lo, hi, fallback)`, `isFiniteVec3(v)`, `shortString(v, max)`, and `safeMediaUrl(v)`.\n2. **Add the field to `NormalizedXRTraits` and `normalizeXRTraits(raw)`** so both web plugins and exporters see identical defaults and bounds.\n3. **Export to glTF (`buildXRSceneCoreExtension`)**: Map the normalized field into `nodes[i].extensions.ANDROID_xr_scenecore`.\n4. **Export to USDZ (`flattenXRTraitsForUsd`)**: Flatten nested objects into camelCase scalar\u002Fvec3 keys (`\u003Ctrait>\u003CField>`) so `buildUsdXRLines()` emits valid USDA `customData = { dictionary xr = { ... } }` lines without injection risk.\n\n---\n\n## Step 2: Web Plugin (`xr-live\u002Fsrc\u002Fplugins\u002F\u003Cname>.ts`)\n\n1. Implement `ThreeLivePlugin` (`three-live\u002Fsrc\u002Fplugin.ts`):\n   - `name`: Unique `'xr-live-\u003Cname>'` identifier.\n   - `onElementConnected(element)` \u002F `onElementDisconnected(element)`: Attach and clean up DOM event listeners (`xr-select-start`, `xr-select-move`, `xr-select-end`) via `WeakMap` state.\n   - `onConfigureXRSessionInit(element, sessionInit)`: Add required\u002Foptional WebXR features (e.g. `'plane-detection'`, `'mesh-detection'`, `'hand-tracking'`).\n   - `onXRFrame(viewer, session, frame, refSpace)` & `onUpdate(viewer, dt)`: Step per-frame simulation and dynamic meshes (`createDynamicMesh`, `updateDynamicMesh`, `removeDynamicMesh`, `setWorldTRS` from `xr-live\u002Fsrc\u002Fplugins\u002Fcommon.ts`).\n2. **Register and export** the plugin in `xr-live\u002Fsrc\u002Fplugins\u002Findex.ts`.\n3. **Bound all resources:** Enforce explicit constants (`MAX_*`) on any dynamic geometry, array, or network\u002Fevent payload.\n\n---\n\n## Step 3: Native Android Parity (`mobile\u002Fandroid\u002F`)\n\nUpdate the Android runtime so compiled `.glb` scenes and scripts execute the trait identically:\n\n1. **`mobile\u002Fandroid\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002FXRLiveSceneCoreHelper.kt`:** Parse the new `extras.xr` \u002F `ANDROID_xr_scenecore` fields with the exact same clamping ranges as `xr-trait-schema.ts`.\n2.  **Modular Feature File\n    (`mobile\u002Fandroid\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002F\u003CFeatureName>.kt`) &\n    `XRSpatialMath.kt`:** Implement pure, allocation-free math and per-feature\n    state machines in a dedicated Kotlin file (e.g. `SpatialMeasure.kt`,\n    `MagneticSnap.kt`, `GazeDwell.kt`, `ExplodedView.kt`,\n    `PersistentAnchors.kt`, `SpatialLocomotion.kt`, `SharedRoom.kt`) rather than\n    bloating a single monolith.\n3.  **`mobile\u002Fandroid\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002FXRSpatialFeatures.kt` &\n    `XRLiveRuntimeSession.kt`:** Wire the modular controller into\n    `stepFrame(dtSeconds)` and emit dynamic `ThreeLiveMeshPrimitive` geometry\n    (and optional `sectionPlane` uniforms) for `ThreeLiveFilamentRenderer.kt`.\n\n---\n\n## Step 4: Native iOS & visionOS Parity (`mobile\u002Fios\u002F`)\n\nUpdate the Swift package under `mobile\u002Fios\u002FSources\u002FThreeLiveCompiler\u002F`:\n\n1. **`XRLiveRuntimeSession.swift` & `XRLiveRealityKit.swift`:** Parse the trait from GLB `extras.xr` and USDZ `customData.xr`.\n2.  **Modular Feature File (`\u003CFeatureName>.swift`),\n    `XRSpatialRealityKitFeatures.swift`, & `XRLiveRealityKitSession.swift`:**\n    Mirror the math and dynamic entity updates in a dedicated Swift file (e.g.\n    `SpatialMeasure.swift`, `MagneticSnap.swift`, `GazeDwell.swift`,\n    `ExplodedView.swift`, `PersistentAnchors.swift`, `SpatialLocomotion.swift`,\n    `SharedRoom.swift`) orchestrated by `XRSpatialRealityKitFeatures.swift`.\n3. **Parity Test Check:** Android's `mobile\u002Fandroid\u002Fsrc\u002Ftest\u002Fjava\u002Fcom\u002Fgoogle\u002Fthreelive\u002FXRLiveSwiftSourceParityTest.kt` verifies that the Swift sources implement all required symbols and trait keys even when building on Linux.\n\n---\n\n## Step 5: Build, Bundle Budget & Test Verification\n\n1. **Rebuild Web bundles & embedded Rust engine asset:**\n\n    ```bash\n    node scripts\u002Fbuild.js\n    ```\n\n    Verify that all 15 `.min.js.gz` bundles in `scripts\u002Fbuild.js` remain within\n    their enforced byte budgets:\n\n    -   `three-live-viewer.min.js`: `\u003C 30 KB gz`\n    -   `three-live.min.js`: `\u003C 73 KB gz`\n    -   `three-live-studio.min.js`: `\u003C 29 KB gz`\n    -   `three-live-cad.min.js`: `\u003C 17 KB gz`\n    -   `three-live-procedural.min.js`: `\u003C 28 KB gz`\n    -   `three-live-animation.min.js`: `\u003C 11 KB gz`\n    -   `three-live-ai.min.js`: `\u003C 20 KB gz`\n    -   `three-live-full.min.js`: `\u003C 160 KB gz`\n    -   `xr-live-viewer.min.js`: `\u003C 55 KB gz`\n    -   `xr-live.min.js`: `\u003C 84 KB gz`\n    -   `xr-live-sensors.min.js`: `\u003C 10 KB gz`\n    -   `xr-live-spatial.min.js`: `\u003C 63 KB gz`\n    -   `xr-live-sim.min.js`: `\u003C 30 KB gz`\n    -   `xr-live-webgpu.min.js`: `\u003C 12 KB gz`\n    -   `xr-live-full.min.js`: `\u003C 268 KB gz`\n2. **Run Web, Rust, and Mobile tests:**\n\n   ```bash\n   node scripts\u002Fbuild.js --test\n   cd compiler && cargo test\n   ```\n3. **Update `llms.txt` and `llms-full.txt`:**\n\n   ```bash\n   node scripts\u002Fbuild_llms_txt.js\n   ```\n",{"name":5,"description":7},"main","c6f7ee2d5c1aefabdde231e27784b0f4f8cfd2ef","skills\u002Fxr-live-plugin-dev",49,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fthree-live","https:\u002F\u002Fgoogle.github.io\u002Fthree-live\u002F","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 10:08:19",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add google\u002Fthree-live --skill xr-live-plugin-dev",{"tool":62,"command":63},"bunx","bunx skills add google\u002Fthree-live --skill xr-live-plugin-dev",{"tool":65,"command":66},"pnpm","pnpm dlx skills add google\u002Fthree-live --skill xr-live-plugin-dev","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fthree-live\u002Fblob\u002Fmain\u002Fskills\u002Fxr-live-plugin-dev\u002FSKILL.md",true,[],[71],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":41},"01M6FQM223D52SNVV361Z6G1XA","three-live-authoring","Builds interactive 3D viewers, procedural Three.js scenes, AR product configurators, and 6DoF WebXR, Android XR, and iOS\u002FvisionOS spatial computing apps using \u003Cthree-live> and \u003Cxr-live>. Use when creating or editing \u003Cthree-live> or \u003Cxr-live> HTML elements, writing \u003Cscript type=\"text\u002Fthree\"> procedural scenes, configuring userData.xr spatial traits or userData.interactivity behavior graphs, building \u003Cdiv slot=\"spatial\"> 3D HTML cards, or integrating native Android (Filament \u002F Jetpack XR SceneCore) and iOS\u002FvisionOS (RealityKit) spatial views.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fthree-live\u002Fblob\u002Fmain\u002Fskills\u002Fthree-live-authoring\u002FSKILL.md",[],[39,78,22,79,80,81,82,26,29,83,84,85,34,86,35,87,88,89,90,91],"authoring","three live authoring","html","procedural","product","ar","text","jetpack","apps","scenes","writing","editing","webxr","3D"]