xb-add-interactions
Skill481 starsChanged 2 months agoApache-2.0View on GitHub
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.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- xb-add-aiSkill
- xb-add-spatial-uiSkill
- xb-add-world-sensingSkill
- xb-anchorsSkill
- xb-build-appSkill
- xb-contribute-sdkSkill
- xb-debug-appSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Read the selected branch reference:
- Very specific: line 45
Put the handler on the script that owns application state or contains the logical target.
- Very specific: line 60
Call event.stopPropagation() from a targeted callback only when its ancestor propagation must stop.
≈ “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.
Files
Add interactions
Produce a complete interaction contract in code: intent, target, phases, state owner, feedback, cleanup, and test instructions.
1. Inventory each user intent
For every requested action, record the actor, target, trigger, start/update/end or cancel phases, one application state transition, feedback, and desktop/XR test route. Keep separate rows when two actions have different ownership or phase models, even when they use the same object.
Complete this step when every action has a target, phase model, state owner, feedback, and user-test path.
2. Select one event family
Read
../../docs/docs/manual/Interaction.md.
Use:
- global
Scripthooks for scene-owned commands; - object select and hover hooks for resolved ray targets;
- touch and grab hooks for direct hand contact;
- gesture event targets for recognized hand poses or completed head motion;
object.xb.manipulationfor automatic translation, rotation, or scale;- Rapier only for collision, gravity, momentum, throwing, or forces.
Read the selected branch reference:
references/selection-and-direct-hands.mdreferences/gesture-events.mdreferences/manipulation-and-physics.md
Complete this step when every action maps to one public event family without a second raycast loop or a reconstructed higher-level event.
3. Implement ownership and feedback
Put the handler on the script that owns application state or contains the
logical target. Give targets intentional hit geometry. Use the event's
source, target, surface, currentTarget, and intersection instead of
raycasting again. Treat the reticle as presentation of the resolved hit.
Represent useful phases explicitly, such as idle, hovered, active,
held, and disabled. Keep handlers thin: validate the resolved event, change
one domain state, then update feedback. Share the domain method when several
input sources mean the same action.
Complete this step when every intent row has an owner, target geometry, handler, phase state, domain transition, feedback, and release or cancel path.
4. Preserve event and manipulation semantics
Call event.stopPropagation() from a targeted callback only when its ancestor
propagation must stop. Use event.preventDefault() only where the event
exposes it: touch start can suppress the default touch selection, and
manipulation start can suppress
the automatic transform. Propagation and default behavior are independent.
Automatic manipulation supports independent simultaneous object owners and two-source scale on one owner. Keep per-object state on the object or owning script, not in one global drag slot. Placement scripts suspend during manipulation and rebase on resume.
Guard optional hands, joints, recognizers, and tracked data. Store listener
functions and remove them in dispose(). Provide stable unavailable,
interrupted, disabled, and canceled states.
Complete this step when propagation, default behavior, paired lifecycle phases, concurrent owners, optional data, and cleanup are explicit for every branch.
5. Prove and hand off each action
Build or type-check the app, run focused tests, and start the exact simulator
route when available. Confirm targets, affordances, handlers, event fields,
state transitions, release behavior, and relevant console output. Use
../../templates/02_object_interaction/
as the current interaction foundation.
Give the user one compact test card per action: simulator steps, XR input, target, start/active/result/release feedback, state change, and device-only checks.
Finish when every action can be tested without inferring its controls, expected feedback, or cancellation behavior from source.
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
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.

