/ls-clad:specs-preview-interactionfrom ls-clad
Drives Lens Studio previews with hand actions (Pinch, Hover, Poke, Drag, Gesture, Release, Rotate, Wait) to trigger buttons, manipulate objects, and verify Lens behavior. Requires InteractionKit.
Ships in ls-clad. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Drive the Lens Studio preview with PreviewInteractTool — a synthetic puppet hand that fires IK trigger events (onTriggerStart, onTriggerEnd, etc.) against Interactable components. Discover targets and verify state changes via the preview-inspection skill (QueryRuntimeSceneTool, CaptureRuntimeViewTool).
Scope: PreviewInteractTool targets Specs previews and requires the InteractionKit (IK) — the hand actions are IK-driven and do not apply to mobile/camera Lens Studio projects.
Lens-side setup: Hand-action tools install this automatically on first use; the manual setup is the fallback. The Lens needs the AiPreviewAgentInteract.lspkg package (which depends on AiPreviewAgentInspect.lspkg, InteractionKit and Leaf) with both AgentInspectScript and AgentInteractScript components on the same SceneObject (Inspect first, or Interact on a descendant). AiPreviewAgentInspect itself has no package dependencies and ships no demo prefab or example scripts — only the bridge scripts — so don't look for a place-in-scene prefab from it. Without AgentInteractScript, interaction commands fail with unknown_command.
| Tool | Purpose |
|---|---|
PreviewInteractTool | Drive the preview with hand actions (Pinch, Hover, Poke, Drag, Gesture, Release, Rotate) and Batch. Wait is a batch-only sub-action. Accepts optional previewName and timeoutMs (default 8000). |
Target interactions with uniqueId (for interactable objects) or worldPosition (for coordinate-based interactions in free space). Use QueryRuntimeSceneTool from the preview-inspection skill to discover interactables, read state, and explore the scene hierarchy.
After discovery and inspection (see the preview-inspection skill), the interact-verify-recover loop is: call PreviewInteractTool, then on success verify with QueryRuntimeSceneTool or CaptureRuntimeViewTool; on error handle by reason and retry.
| Action | Call | Key Argument |
|---|---|---|
| Trigger button | PreviewInteractTool(action: "Pinch") | uniqueId |
| Poke (extended-finger push) | PreviewInteractTool(action: "Poke") | uniqueId |
| Long-press | PreviewInteractTool(action: "Pinch", durationMs: 2000) | uniqueId, durationMs |
| Drag object | PreviewInteractTool(action: "Drag") | uniqueId, worldPosition |
| Pick up object | PreviewInteractTool(action: "Pinch", hold: true) | uniqueId |
| Rotate held | PreviewInteractTool(action: "Rotate") | handType, rotation: {x,y,z} |
| Release held | PreviewInteractTool(action: "Release") | handType |
| Throw object | PreviewInteractTool(action: "Drag", releaseMidDrag: true) | uniqueId, worldPosition |
| Batch sequence | PreviewInteractTool(action: "Batch", actions: [...]) | actions |
| Pinch + drag + release | Batch: [Pinch(hold:true), Drag, Release] | — |
| Pinch in space | PreviewInteractTool(action: "Pinch", hold: true) | worldPosition |
| Draw/move in space | PreviewInteractTool(action: "Drag", hold: true) | worldPosition |
name + parentName parameters instead of uniqueId. The tool will resolve the object at call time.resolvedUniqueId in responses: When a CommandSuccess response is returned from a name-based lookup, it includes a resolvedUniqueId field containing the UID that was actually used. Save this for subsequent calls within the same session to avoid repeated name resolution.onTriggerStart / onTriggerEnd on a target, but IK uses a different trigger pathway for each. Use Pinch for pickup/manipulation interactables and for buttons whose targetingMode includes Direct or Indirect (the default is Direct/Indirect). Use Poke for buttons/UI whose targetingMode includes Poke or All — extended-finger push, no pinch. If a Poke target times out on onTriggerStart while Pinch works on the same object, the interactable's targetingMode doesn't include Poke; that's expected IK gating, not a tool failure.Two ways to target interactions:
Interactable-targeted (uniqueId): For objects with an Interactable component. Validates clipping, obstruction, enabled state. Discover targets via the preview-inspection skill (QueryRuntimeSceneTool with hasComponents: ["Interactable"]).
Coordinate-targeted (worldPosition): For free-space interactions. No validation — the hand goes directly to world coordinates. Read positions via QueryRuntimeSceneTool { transform { worldPosition } } or specify coordinates directly.
When to use which:
uniqueIdworldPositionuniqueId for the object, worldPosition for the destination)Each hand (left/right) is either free or holding an object. Every response includes handState showing both hands — you never need to track state yourself.
Pass hold: true on Pinch or Drag to keep the pinch engaged. The hand stays holding until you call Release.
1. Pinch(uniqueId: "cube", hold: true) → right holding cube
2. Drag(uniqueId: "cube", worldPosition: ..., hold: true) → cube moved, still held
3. Rotate(handType: "right", rotation: {x:0, y:90, z:0}) → cube rotated 90° yaw
4. Release(handType: "right") → cube released
Use releaseMidDrag: true on Drag to release the pinch while the hand is still moving. The object inherits the hand's velocity.
1. Drag(uniqueId: "ball", worldPosition: {x:20,y:10,z:0}, durationMs: 300, releaseMidDrag: true)
Pinch and move in empty space using worldPosition. Lenses that track hand position (e.g., drawing Lenses) react automatically.
1. Pinch(worldPosition: {x:0, y:10, z:-50}, hold: true) → pinch in space
2. Drag(worldPosition: {x:20, y:10, z:-50}, hold: true, durationMs: 1000) → draw line
3. Drag(worldPosition: {x:20, y:20, z:-50}, hold: true, durationMs: 500) → continue drawing
4. Release(handType: "right") → stop
Each hand operates independently. Use handType: "left" or "right" to target a specific hand.
1. Drag(uniqueId: "panel", worldPosition: ..., handType: "left", hold: true) → left holds panel
2. Pinch(uniqueId: "button", handType: "right") → right taps button
3. Release(handType: "left") → panel released
| Action | Free hand | Holding same object | Holding different object |
|---|---|---|---|
| Pinch | Yes | Error | Error |
| Hover | Yes | Error | Error |
| Poke | Yes | Error | Error |
| Drag | Yes | Yes (continues drag) | Error |
| Rotate | Error | Yes | Error |
| Release | Error | Yes | Error |
| Gesture | Yes | Error | Error |
When an action conflicts with the current hand state, the error message tells you exactly what's held and suggests either Release or using the other hand.
Use Batch when a sequence is known in advance. Fail-fast: execution stops at the first sub-action that errors.
Shape: PreviewInteractTool(action: "Batch", actions: [...]). Each item is a full atomic-action object. Sub-actions cannot be "Batch" (no nesting).
Example — drag an interactable to a point with a throw release:
{
"action": "Batch",
"actions": [
{"action": "Pinch", "uniqueId": "<id>", "hold": true},
{"action": "Drag", "worldPosition": {"x": 10, "y": 0, "z": -5}, "releaseMidDrag": true}
]
}
Success response — {success: true, action: "Batch", stepCount: N, handState}.
Failure response — execution aborts at failedAtIndex; skippedSteps is the un-executed tail. Resolve the reason, release any held hand (check handState), then re-issue from failedStep + skippedSteps. See references/batch-recovery.md for the full field list and recovery checklist.
Wait — settle step between batch actions. Use sparingly: only when a UI element you are about to interact with has just been enabled/revealed by a prior step and may need a frame or two to settle (common with UIKit buttons and sliders that appear in response to state changes). Insert a Wait before each interaction whose target was revealed by the previous step — a single flow often needs more than one. Symptom of a missing Wait: Timed out waiting for onTriggerStart for "<target>" on the step that follows the reveal. Typical values: 200–500 ms. Not valid outside a Batch. Capped at 10000 ms — exceeding the cap returns an error rather than silently clamping.
Example — tap a path option to reveal a slider, drag the slider to reveal a launch button, then tap launch (Wait before both revealed targets):
{
"action": "Batch",
"actions": [
{"action": "Pinch", "uniqueId": "<pathOption>"},
{"action": "Wait", "durationMs": 300},
{"action": "Pinch", "uniqueId": "<sliderKnob>", "hold": true},
{"action": "Drag", "uniqueId": "<sliderKnob>", "worldPosition": {"x": 5, "y": 0, "z": 0}, "hold": true},
{"action": "Release", "handType": "right"},
{"action": "Wait", "durationMs": 300},
{"action": "Pinch", "uniqueId": "<launchButton>"}
]
}
When to use Batch vs. atomic calls:
QueryRuntimeSceneTool { sceneObject(uniqueId) { ... } } to decide what to do next).Multiplayer Lenses (Connected Lenses / SyncKit) only sync once every preview window has joined the session. The Multiplayer join button is an in-Lens UIKit element rendered inside the runtime — each preview window draws its own copy. So you join the session the same way you trigger any other button: with PreviewInteractTool (Pinch or Poke), once per preview window. Use visible Preview panels for every participant: hidden previews such as "Headless Preview" don't join the session.
Before interacting with or verifying a multiplayer Lens:
PreviewInteractTool, passing previewName so each call lands in the right window. Clicking it in only one window is the most common mistake: a single un-joined window means that participant never connects and its synced state never appears.If synced objects are missing, a participant's actions don't propagate, or not_found keeps coming back for objects that should be spawned by another player, the most likely cause is an un-joined preview window — not a tool failure. Don't keep retrying the Lens interactions; first confirm you've triggered Multiplayer in every preview window (one Pinch/Poke per window via previewName), then re-discover and retry.
preview-inspection skill to discover interactables before triggering them.parentName to disambiguate. Multiple interactables share the name "Background" — parentName tells you which is which (e.g., "Sleek Nose Cone" vs "Modern Nose Cone").QueryRuntimeSceneTool to read transform { worldPosition } — don't guess coordinates.QueryRuntimeSceneTool for data assertions or CaptureRuntimeViewTool for visual verification.handType: "left" for the second.preview-inspection → Preview routing. Mixing previews causes UID lookup failures.handState in responses. It reflects both hands — use it; don't track manually. (Full detail in the Hand State section.)Interaction errors return a reason field. Handle by reason:
| Reason | Meaning | Recovery |
|---|---|---|
clipped | Target is outside a scroll view's visible bounds | Drag the ScrollBar or ScrollWindow to reveal it, then retry |
obstructed | Another object is physically blocking the target | Report to user — may need scene reorganization |
not_found | No interactable with that uniqueId | Re-run the discovery query — UIDs may have changed after a preview reset |
disabled | Interactable exists but is disabled | Skip, or check if a prior action should have enabled it |
interactor_busy | Hand is currently holding an object or mid-interaction | Check handState in the error response. Release the held object first, or use the other hand. |
unknown_command | The Lens-side AgentInteractScript is not installed | Add AiPreviewAgentInteract.lspkg and AgentInteractScript to the Lens scene |
INTERNAL_ERROR | Lens-side exception, often surfaces as "Timed out waiting for onTriggerStart" on IK Interactables — known issue, side-effects can land before the timeout | Do not blindly retry uniqueId-targeted IK actions (they may double-apply); fall back to coordinate-targeted (worldPosition) actions or report the failure |
Items inside a scroll view may be clipped. The pre-flight validator catches this instantly. To interact with a clipped item:
QueryRuntimeSceneTooltransform { worldPosition }Drag the scroll bar to reveal the targetpreview-inspection skill.parentName — multiple interactables share the same name.clipped error is actionable — scroll first. A generic timeout tells you nothing.PreviewInteractTool reports success, but lsdbg breakpoints and probes never fire, because the hand ran in a different preview's Lens VM. Pass the previewName that lsdbg attach returns — see lens-js-debugger → Debugging alongside Lens Studio MCP preview tools.PreviewInteractTool requires IK; it has no equivalent on mobile/camera previews.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
lens-studio, preview-interaction, hand-actions, interactionkit, specs
npx claudepluginhub lens-studio-devs/ls-extensions --plugin ls-clad74 skills in this plugin
/build-imageGenerate a 2D image from a text prompt via SPECS text-to-image, to Assets/GeneratedImages/<Name>.png (build-mesh reference, texture, or screen-space). Transparent RGBA cutout, cropped tight, by default; opt out for an opaque image.
/build-meshGenerate a 3D mesh, model, or asset for a Lens — build, create, or make props, characters, scenery. Four peer backends chosen per asset: SPECS text-to-3D (static default — best texture fidelity, async minutes-long jobs), FAST3D (faster static AI props), code-authored MeshBuilder via the mesh-builder-scripting skill (articulated, animated, parametric TypeScript content), and Blender voxel (blocky aesthetic; the only source of rigged GLBs). GLB backends return the file plus AABB metadata so the caller can size colliders and place the mesh in the world.
/build-musicGenerate musical phrases, chord progressions, beats, jingles, and short pieces via local algorithmic synthesis. Sample-free, license-clean, fully offline. Scale-degree composition, pattern-based arrangement, frequency-separated mixing rules. Outputs 44.1 kHz stereo WAV to Assets/GeneratedSFX/./build-sfxGenerate non-pitched sound effects (UI, impacts, sweeps, foley, ambient textures, retro 8-bit) via local algorithmic synthesis. Outputs 44.1 kHz WAV to Assets/GeneratedSFX/. For musical phrases or chord progressions use /build-music instead./camera-and-renderingCamera configuration, 2D/screen-space rendering, RenderMeshVisual patterns, and visibility debugging for Lens Studio scene construction. Use when setting up cameras (orthographic/perspective), creating screen-space content (ScreenTransform, Image, Text), debugging invisible objects, or planning any scene involving rendering config./editor-apiExecuteEditorCode contract and Editor API paradigms — runtime, access patterns, gotchas, references. Use before writing Editor API TS (`pluginSystem.findInterface`, `LensStudio:*`), grepping `editor.d.ts`, or routing to scene/asset-graphql.Other plugins' skills for the same job