agentleFS
GoogleKnown publishergoogle/xrblocks/skills/xb-add-spatial-ui/SKILL.md

xb-add-spatial-ui

Skill481 starsChanged 2 months agoApache-2.0View on GitHub

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.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use UICard for a world-space surface measured and positioned in meters.

    line 25
  2. Very specific:

    Use UIOverlay for a bounded view-space surface.

    line 26
  3. Very specific:

    Use UIPanel only inside a card or overlay for layout or visual grouping.

    line 27
  4. Very specific:

    Import components from xrblocks.

    line 29
  5. Very specific:

    Treat UICard.size and world transforms as meters.

    line 43
  6. Very specific:

    Use size: {width, height: 'auto'} for content-driven cards.

    line 47
  7. Distinctive:

    Use a numeric height only when the surface must have a fixed physical size.

    line 49
  8. Distinctive:

    Update component properties directly.

    line 56
  9. Very specific:

    Use pointerEvents, interactionEnabled, visibility, material depth behavior, and opacity for their separate purposes.

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add spatial UI

Build a usable surface: information and controls that remain legible, targetable, and observable in their intended pose.

1. Write the surface contract

Record every displayed value and action, its state owner, spatial anchor, appearance states, update cadence, desktop input, XR input, and observable result.

Complete this step when every value and control has a user purpose, source, anchor, and testable result.

2. Select the correct UI root

Read ../../docs/docs/manual/UI.mdx before implementation.

  • Use UICard for a world-space surface measured and positioned in meters.
  • Use UIOverlay for a bounded view-space surface.
  • Use UIPanel only inside a card or overlay for layout or visual grouping.

Import components from xrblocks. Built-in UI starts automatically and joins the normal XR Blocks interaction pipeline. Application code does not enable a UI subsystem, register UIKit, or install a second raycaster.

Complete this step when one root owns the intended coordinate space and every nested element has one layout parent.

3. Compose semantic UI

Build reading order with UIPanel, UIText, UIImage, and UIIcon. Use UIButton and UISlider for actions instead of raw pointer handlers. Use ModelViewer for supported interactive model presentation. Use semantic UI for status, telemetry, instructions, and debug state instead of canvas sprites.

Treat UICard.size and world transforms as meters. Treat descendant numeric layout values as UIKit layout units. Treat numeric lineHeight as a font-size multiplier; use px or % strings for explicit units.

Use size: {width, height: 'auto'} for content-driven cards. Keep the width fixed so text and percentage-width children have a stable wrapping constraint. Use a numeric height only when the surface must have a fixed physical size.

Complete this step when all content fits at the intended physical size and each state-changing control has hover or active feedback plus an observable result.

4. Connect state, theme, and spatial behavior

Update component properties directly. Keep mounted text and controls stable; change structure only when the application structure changes. Use a theme preset or theme update for shared palette and structural roles, then use local styles for exceptions.

Use pointerEvents, interactionEnabled, visibility, material depth behavior, and opacity for their separate purposes. Transparency alone does not disable depth writes or input.

Read ../../docs/docs/manual/Placement.md when the root follows, faces, or orbits another object. Read ../../docs/docs/manual/Interaction.md for manipulation and target semantics.

Complete this step when state changes update the intended mounted element, theme changes produce the intended structure and palette, and placement does not compete with user manipulation.

5. Validate and hand off

Build or type-check the app. After a completed UI frame, run xb.ui.validate() for the root or all roots. Check overflow, clipping, disabled behavior, input, cleanup, and relevant console output. Start from ../../templates/01_spatial_ui/ or the closest focused sample for executable evidence.

Give the user the exact URL, viewing pose, input route, control instructions, and expected idle, hover, active, disabled, and result states. Name real-device checks for legibility, target size, occlusion, reach, and head motion.

Finish when validation and available smoke checks pass and the user can test every control and state without inferring expected behavior from source.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.