[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6993MT5KMBBZEBYCNY4D0Y8":3,"skill-same:01M6993MT5KMBBZEBYCNY4D0Y8":68},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6993MT5KMBBZEBYCNY4D0Y8","xb-anchors",null,"Pin content to a real place with WebXR spatial anchors, and bring it back in a later session. Use when virtual content must stay put as the headset refines its map of the room, or when an app should remember where things were left. Covers `enableAnchors()`, `enableAnchorPersistence()`, creating and restoring anchors, the `capability` states, and the desktop fallback that lets anchor code be developed without a headset. Pair with xb-world for detecting what to anchor to.","google\u002Fxrblocks","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6993A0Y0E9SVC7MR1FQ03S3",517,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-anchors\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"xb anchors","when","webxr","capability","things","for","bring","detecting","states","app","as","map","world","back","later","fallback","pair","virtual","code","remember","2026-11-10 10:12:30",false,"---\nname: xb-anchors\ndescription: >-\n  Pin content to a real place with WebXR spatial anchors, and bring it back in a\n  later session. Use when virtual content must stay put as the headset refines its\n  map of the room, or when an app should remember where things were left. Covers\n  `enableAnchors()`, `enableAnchorPersistence()`, creating and restoring anchors,\n  the `capability` states, and the desktop fallback that lets anchor code be\n  developed without a headset. Pair with xb-world for detecting what to anchor to.\n---\n\n# xb-anchors: spatial anchors & persistence\n\nAn anchor tells the platform \"keep this exactly here\". As the headset improves its\nunderstanding of the room, anchored content is corrected along with it, which plain\nworld coordinates are not. With persistence enabled, anchors can also be restored in\na later session, so an app can remember where things were left. See `demos\u002Fanchors`.\n\n## Why not just store coordinates\n\nWorld coordinates are relative to the session's tracking origin. That origin is not\nguaranteed to be the same next time, so coordinates saved to storage can come back\nmeaning a different place. Anchors avoid this: the platform re-localises them.\n\n## Enable\n\n```js\nconst options = new xb.Options();\noptions.world.enableAnchors(); \u002F\u002F anchors for this session only\nxb.init(options);\n```\n\nTo also carry anchors into later sessions:\n\n```js\noptions.world.enableAnchorPersistence();\n```\n\nThe `anchors` WebXR feature is requested as optional, so a browser without it still\nenters the session and the subsystem reports itself unsupported.\n\n## Create and persist\n\n```js\nconst anchors = xb.core.world.anchors;\n\nconst pose = new XRRigidTransform({x, y, z}, {x: 0, y: 0, z: 0, w: 1});\nconst tracked = await anchors.create(pose, 'coffee table');\nif (tracked) {\n  await anchors.persist(tracked.id); \u002F\u002F survives the session\n}\n```\n\n`create()` returns `null` rather than throwing when the platform cannot anchor, so\ncallers can degrade instead of guarding every call.\n\n## Restore\n\n```js\nfor (const result of await anchors.restoreAll()) {\n  if (result.status === 'restored') {\n    attachContent(result.anchor); \u002F\u002F the tracked anchor, ready to use\n  }\n}\n```\n\n`restoreAll()` is safe to call more than once; already-restored records are reported\nas restored rather than duplicated.\n\nA `not-found` result is normal, not a failure: re-localisation is probabilistic, and\na handle saved in one room will not resolve in another. One failure never stops the\nrest of the batch.\n\n## Follow an anchor each frame\n\n```js\nupdate(time, frame) {\n  const referenceSpace = xb.core.renderer.xr.getReferenceSpace();\n  const pose = anchors.getPose(id, referenceSpace);\n  if (pose) mesh.position.copy(pose.transform.position);\n}\n```\n\nRead poses inside the frame loop. An `XRFrame` is only valid during its own callback,\nso `getPose` returns `null` rather than throwing if called later.\n\n## The platform runs out of anchors\n\n`persist()` returns `false` when the platform refuses a handle, and the reason is on\n`anchors.lastError`. Show it, because one of the reasons is not something an app can\ndesign around:\n\n```\nInvalidStateError: Failed to execute 'requestPersistentHandle' on 'XRAnchor':\nMaximum number of anchors reached!\n```\n\nThe number of persistent anchors a browser can hold is capped **across every origin**,\nnot per site, so a headset can refuse yours because of anchors saved by a completely\ndifferent page ([immersive-web\u002Fanchors#79](https:\u002F\u002Fgithub.com\u002Fimmersive-web\u002Fanchors\u002Fissues\u002F79)).\nThe spec allows a user agent to evict an entry to make room for a new one, but nothing\nappears to do that yet, so in practice a full budget stays full until something releases\nhandles.\n\nThe budget belongs to the browser and is shared by every site in it, so a page visited\nmonths ago can be holding the slot yours needs. It is also small: on a Quest 3 in August\n2026 the sixth anchor was refused. Plan for a handful rather than hundreds, and expect to\nmeet the limit during ordinary testing.\n\nWhat follows from that:\n\n- Treat a failed `persist()` as normal, not exceptional, and say so in your UI. Silently\n  dropping it leaves someone believing their content was saved.\n- Release handles as soon as they stop being useful. `delete()` and `forgetAll()` do this\n  for anchors they know about.\n- Never lose the record of a handle you created. A handle nobody names cannot be released\n  and holds its slot until the browser's storage is cleared at the device level.\n- Do not read `platformHandles()` back to confirm a release. The list does not\n  necessarily shrink during a session, and it contains a blank entry even on an origin\n  that has never saved anything.\n- Do not promise that a release button will fix a full budget. The platform can refuse a\n  new anchor while reporting no handles at all for your origin, which leaves the page\n  with nothing it can name and nothing it can free.\n\n### Which cleanup to offer\n\n|                               | reaches                                        | use for                          |\n| ----------------------------- | ---------------------------------------------- | -------------------------------- |\n| `delete(id)`                  | one anchor and its handle                      | the user removed one thing       |\n| `forgetAll()`                 | every handle this store recorded               | the user cleared this app        |\n| `releaseAllPlatformHandles()` | every handle the origin holds, recorded or not | recovery when the budget is full |\n\n`forgetAll()` is the everyday one. `releaseAllPlatformHandles()` exists because records\nand handles can drift apart: clear a site's storage, or lose a record any other way, and\nthe handle is stranded with nothing able to name it. It is origin wide, so a second app\non the same origin loses its anchors too. Offer it as an explicit user action, worded so\nthat is obvious, and never run it automatically.\n\n### When the budget is full anyway\n\nIn order, least destructive first:\n\n1. `releaseAllPlatformHandles()` from within the app. Frees everything the origin still\n   names, which is enough whenever the records survived.\n2. Clear the browser's data from the headset's own storage settings. Once the platform\n   reports no handles while still refusing new anchors there is nothing left for the page\n   to name, so recovery has to come from outside it.\n3. Re-running space setup does not help. Anchors outlive the boundary.\n\n## Capability\n\nCheck `anchors.capability` before promising anything in your UI:\n\n| value          | meaning                                                 |\n| -------------- | ------------------------------------------------------- |\n| `persistent`   | anchors work and survive sessions                       |\n| `session-only` | anchors work, but cannot be saved                       |\n| `simulated`    | no platform anchors; poses are held locally (see below) |\n| `unsupported`  | no anchor support at all; `create()` returns `null`     |\n\n## Developing without a headset\n\nThe desktop simulator has no tracking system to anchor against, so anchor code would\notherwise be untestable until you have a device:\n\n```js\noptions.world.anchors.simulatorFallback = true;\n```\n\nThis holds poses locally and reports `capability === 'simulated'`. It is off by\ndefault and deliberately named: it proves your wiring, never that a device can\nre-localise anything. Say so in your UI, or a desktop run will look like evidence\nthat anchoring works.\n\n## Storage\n\nPersistent handles are saved to `localStorage` under `options.world.anchors.storageKey`,\ncapped at `maxStoredAnchors` (oldest evicted first). Supply your own `AnchorStore` to\nput them somewhere else.\n\nA persistent handle is a durable identifier for a physical place. Keep handles local\nunless you have a reason to do otherwise, and treat them as you would any other\nlocation data.\n","# xb-anchors: spatial anchors & persistence\n\nAn anchor tells the platform \"keep this exactly here\". As the headset improves its\nunderstanding of the room, anchored content is corrected along with it, which plain\nworld coordinates are not. With persistence enabled, anchors can also be restored in\na later session, so an app can remember where things were left. See `demos\u002Fanchors`.\n\n## Why not just store coordinates\n\nWorld coordinates are relative to the session's tracking origin. That origin is not\nguaranteed to be the same next time, so coordinates saved to storage can come back\nmeaning a different place. Anchors avoid this: the platform re-localises them.\n\n## Enable\n\n```js\nconst options = new xb.Options();\noptions.world.enableAnchors(); \u002F\u002F anchors for this session only\nxb.init(options);\n```\n\nTo also carry anchors into later sessions:\n\n```js\noptions.world.enableAnchorPersistence();\n```\n\nThe `anchors` WebXR feature is requested as optional, so a browser without it still\nenters the session and the subsystem reports itself unsupported.\n\n## Create and persist\n\n```js\nconst anchors = xb.core.world.anchors;\n\nconst pose = new XRRigidTransform({x, y, z}, {x: 0, y: 0, z: 0, w: 1});\nconst tracked = await anchors.create(pose, 'coffee table');\nif (tracked) {\n  await anchors.persist(tracked.id); \u002F\u002F survives the session\n}\n```\n\n`create()` returns `null` rather than throwing when the platform cannot anchor, so\ncallers can degrade instead of guarding every call.\n\n## Restore\n\n```js\nfor (const result of await anchors.restoreAll()) {\n  if (result.status === 'restored') {\n    attachContent(result.anchor); \u002F\u002F the tracked anchor, ready to use\n  }\n}\n```\n\n`restoreAll()` is safe to call more than once; already-restored records are reported\nas restored rather than duplicated.\n\nA `not-found` result is normal, not a failure: re-localisation is probabilistic, and\na handle saved in one room will not resolve in another. One failure never stops the\nrest of the batch.\n\n## Follow an anchor each frame\n\n```js\nupdate(time, frame) {\n  const referenceSpace = xb.core.renderer.xr.getReferenceSpace();\n  const pose = anchors.getPose(id, referenceSpace);\n  if (pose) mesh.position.copy(pose.transform.position);\n}\n```\n\nRead poses inside the frame loop. An `XRFrame` is only valid during its own callback,\nso `getPose` returns `null` rather than throwing if called later.\n\n## The platform runs out of anchors\n\n`persist()` returns `false` when the platform refuses a handle, and the reason is on\n`anchors.lastError`. Show it, because one of the reasons is not something an app can\ndesign around:\n\n```\nInvalidStateError: Failed to execute 'requestPersistentHandle' on 'XRAnchor':\nMaximum number of anchors reached!\n```\n\nThe number of persistent anchors a browser can hold is capped **across every origin**,\nnot per site, so a headset can refuse yours because of anchors saved by a completely\ndifferent page ([immersive-web\u002Fanchors#79](https:\u002F\u002Fgithub.com\u002Fimmersive-web\u002Fanchors\u002Fissues\u002F79)).\nThe spec allows a user agent to evict an entry to make room for a new one, but nothing\nappears to do that yet, so in practice a full budget stays full until something releases\nhandles.\n\nThe budget belongs to the browser and is shared by every site in it, so a page visited\nmonths ago can be holding the slot yours needs. It is also small: on a Quest 3 in August\n2026 the sixth anchor was refused. Plan for a handful rather than hundreds, and expect to\nmeet the limit during ordinary testing.\n\nWhat follows from that:\n\n- Treat a failed `persist()` as normal, not exceptional, and say so in your UI. Silently\n  dropping it leaves someone believing their content was saved.\n- Release handles as soon as they stop being useful. `delete()` and `forgetAll()` do this\n  for anchors they know about.\n- Never lose the record of a handle you created. A handle nobody names cannot be released\n  and holds its slot until the browser's storage is cleared at the device level.\n- Do not read `platformHandles()` back to confirm a release. The list does not\n  necessarily shrink during a session, and it contains a blank entry even on an origin\n  that has never saved anything.\n- Do not promise that a release button will fix a full budget. The platform can refuse a\n  new anchor while reporting no handles at all for your origin, which leaves the page\n  with nothing it can name and nothing it can free.\n\n### Which cleanup to offer\n\n|                               | reaches                                        | use for                          |\n| ----------------------------- | ---------------------------------------------- | -------------------------------- |\n| `delete(id)`                  | one anchor and its handle                      | the user removed one thing       |\n| `forgetAll()`                 | every handle this store recorded               | the user cleared this app        |\n| `releaseAllPlatformHandles()` | every handle the origin holds, recorded or not | recovery when the budget is full |\n\n`forgetAll()` is the everyday one. `releaseAllPlatformHandles()` exists because records\nand handles can drift apart: clear a site's storage, or lose a record any other way, and\nthe handle is stranded with nothing able to name it. It is origin wide, so a second app\non the same origin loses its anchors too. Offer it as an explicit user action, worded so\nthat is obvious, and never run it automatically.\n\n### When the budget is full anyway\n\nIn order, least destructive first:\n\n1. `releaseAllPlatformHandles()` from within the app. Frees everything the origin still\n   names, which is enough whenever the records survived.\n2. Clear the browser's data from the headset's own storage settings. Once the platform\n   reports no handles while still refusing new anchors there is nothing left for the page\n   to name, so recovery has to come from outside it.\n3. Re-running space setup does not help. Anchors outlive the boundary.\n\n## Capability\n\nCheck `anchors.capability` before promising anything in your UI:\n\n| value          | meaning                                                 |\n| -------------- | ------------------------------------------------------- |\n| `persistent`   | anchors work and survive sessions                       |\n| `session-only` | anchors work, but cannot be saved                       |\n| `simulated`    | no platform anchors; poses are held locally (see below) |\n| `unsupported`  | no anchor support at all; `create()` returns `null`     |\n\n## Developing without a headset\n\nThe desktop simulator has no tracking system to anchor against, so anchor code would\notherwise be untestable until you have a device:\n\n```js\noptions.world.anchors.simulatorFallback = true;\n```\n\nThis holds poses locally and reports `capability === 'simulated'`. It is off by\ndefault and deliberately named: it proves your wiring, never that a device can\nre-localise anything. Say so in your UI, or a desktop run will look like evidence\nthat anchoring works.\n\n## Storage\n\nPersistent handles are saved to `localStorage` under `options.world.anchors.storageKey`,\ncapped at `maxStoredAnchors` (oldest evicted first). Supply your own `AnchorStore` to\nput them somewhere else.\n\nA persistent handle is a durable identifier for a physical place. Keep handles local\nunless you have a reason to do otherwise, and treat them as you would any other\nlocation data.\n",{"name":5,"description":7},"main","ab20b56560350895180bde15e2faa1ebbccb30c0","skills\u002Fxb-anchors",105,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks","https:\u002F\u002Fxrblocks.github.io","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 06:48:49",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add google\u002Fxrblocks --skill xb-anchors",{"tool":60,"command":61},"bunx","bunx skills add google\u002Fxrblocks --skill xb-anchors",{"tool":63,"command":64},"pnpm","pnpm dlx skills add google\u002Fxrblocks --skill xb-anchors","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-anchors\u002FSKILL.md",true,[],[69,99,121,136,157,181],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":80,"publishedAt":39},"01M6993TAHGHAWX3M5S320QZFA","xb-debug-app","Debug and repair XR Blocks applications. Use when an app fails to build or run, produces incorrect UI, interaction, sensing, or rendering behavior, differs between simulator and device, leaks resources, or contains obsolete SDK patterns.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-debug-app\u002FSKILL.md",[75],{"categoryNo":76,"categoryName":77,"taxonomyType":78,"taxonomyTypeDesc":79},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[81,82,83,28,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,20],"xb debug app","debug app","debug","sdk","run","ui","applications","behavior","use","build","device","patterns","repair","sensing","interaction","resources","rendering","blocks",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":39},"01M6993RD0VK0VPN8YYP3FNQX1","xb-contribute-sdk","Complete an XR Blocks SDK change across implementation, runtime wiring, public exports, proof, build output, examples, and canonical documentation. Use when editing the XR Blocks repository rather than an application that consumes it.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-contribute-sdk\u002FSKILL.md",[],[84,106,107,108,109,110,111,112,113,89,114,90,115,116,117,118,98,119,120,20],"xb contribute sdk","contribute","change","documentation","examples","repository","editing","public","implementation","across","runtime","proof","complete","output","wiring",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":39},"01M6993PEZ751YR930CS86CKRY","xb-build-app","Build or extend a complete XR Blocks application. Use when the request concerns an app scaffold, a whole experience, several SDK areas, or an end-to-end simulator or XR handoff rather than one focused subsystem.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-build-app\u002FSKILL.md",[],[128,90,28,129,130,84,131,89,132,133,118,98,134,135,20],"xb build app","build app","handoff","scaffold","application","end","request","extend",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":39},"01M6993JZJGTVKZT028WFG4E5H","xb-add-world-sensing","Connect physical-world sensing to XR Blocks application state. Use when adding planes, scene meshes, depth, occlusion, world collision evidence, object or human recognition, face tracking, segmentation, or agent-facing scene context.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-add-world-sensing\u002FSKILL.md",[],[143,31,94,144,145,146,147,148,149,89,150,132,151,152,98,153,154,155,156,20],"xb add world sensing","add","connect","state","segmentation","context","tracking","evidence","human","physical","object","occlusion","depth","face",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":166,"publishedAt":39},"01M6993H6WX2Q57A3MGNB1VMQF","xb-add-spatial-ui","Build spatial UI in XR Blocks. Use when adding cards, overlays, panels, text, controls, model-viewer interfaces, layout, styling, themes, or UI placement with the built-in UI system.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-add-spatial-ui\u002FSKILL.md",[163],{"categoryNo":164,"categoryName":165,"taxonomyType":78,"taxonomyTypeDesc":79},"01JBSEEDCAT000000000000032","设计师",[167,86,168,144,169,170,171,89,172,90,173,174,175,176,98,177,178,179,180,20],"xb add spatial ui","Spatial","system","text","model","styling","layout","panels","themes","controls","with","overlays","ui system","viewer",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":39},"01M6993F57C01XXES7M8654GWD","xb-add-interactions","Design and implement XR Blocks interactions. Use when adding selection, hover, direct touch, grab, gestures, event ownership, propagation, automatic manipulation, or physics-driven object behavior.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fxrblocks\u002Fblob\u002Fmain\u002Fskills\u002Fxb-add-interactions\u002FSKILL.md",[],[188,144,189,190,191,192,193,88,89,194,195,196,197,98,198,199,200,153,201,20],"xb add interactions","design","gestures","implement","hover","direct","selection","physics","propagation","touch","ownership","event","grab","automatic"]