lens-js-debugger

Debug running JavaScript Lenses in Lens Studio via breakpoints, expression evaluation, and CPU profiling.

16|2|Updated Apr 13, 2026
One-click install
npx skills add https://github.com/lens-studio-devs/ls-extensions --skill lens-js-debugger-lens-studio-devs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lens-js-debugger
Source: https://github.com/lens-studio-devs/ls-extensions/tree/main/plugins/ls-clad/skills/lens-js-debugger
Command: npx skills add https://github.com/lens-studio-devs/ls-extensions --skill lens-js-debugger-lens-studio-devs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires websockets, and includes scripts (resource) and references (resource) components.

What problem does it solve? Debugging a JavaScript Lens that only misbehaves while running — init crashes, missing awaits, callback wiring bugs, runtime data shape issues — is hard without a live debugger. This Skill provides a CLI (lsdbg) that attaches to a running Lens Studio preview or Specs device over the Chrome DevTools Protocol, letting an agent evaluate expressions, set breakpoints, pause/resume execution, inspect runtime state, and profile CPU hot spots. ## Core Features & Use Cases - Live debugging session: lsdbg attach blocks until the VM is live, then supports eval, set-breakpoint, backtrace, locals, eval-on-frame, stepping, and resume against the Hermes VM. - Console and exception visibility: console-log streams buffered output as NDJSON with --wait-pattern matching, and pause-on-exceptions surfaces synchronous throws. - CPU profiling: profile-start / profile-stop return a self-time-ranked hot-function summary for diagnosing jank. - Health diagnosis and recovery: health collapses states like init_throw, preview_idle, and wrong_target into one field, and cleanup --force recovers wedged daemons. - Use Case: A Lens crashes in onAwake before you can interact with it. Set a breakpoint with --reload, wait for the pause, inspect locals and the backtrace, then fix the init code. ## Quick Start Ask the agent to debug your running Lens by attaching with lsdbg, setting a breakpoint on the suspect line with --reload, and evaluating the relevant expressions once paused.

Frequently Asked Questions about lens-js-debugger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a running JavaScript Lens in Lens Studio?

Run `lsdbg attach` to start a session that blocks until the VM is live, then use `console-log`, `set-breakpoint`, `eval`, and `resume` to inspect the running Lens. Finish with `lsdbg cleanup --all` to tear down the session.

Why does my breakpoint never fire in Lens Studio?

Init-time code like `onAwake` runs before the debugger attaches, so set the breakpoint with `--reload` to restart the Lens. Also check `result.resolved` on the set-breakpoint envelope — `false` means a line-offset or source-map mismatch.

Why is lsdbg console-log empty even though the Lens prints?

Output produced before attach is invisible to the debugger. Call `lsdbg health` and branch on `result.state` — `preview_idle` means the user hasn't pressed Play, while `healthy_running` means the watched code path simply isn't executing.

Can lsdbg evaluate variables inside a component or callback?

While running, `eval` executes in global scope only, so script-local variables are invisible. Once paused at a breakpoint, frame-less `eval` auto-targets the top frame, or pass a `callFrameId` from `backtrace` to reach another frame.

Does the Lens JS debugger work with C++ or non-JS scripting?

No. The debugger only reaches the JavaScript Hermes VM inside a Lens; C++ runtime code and non-JS scripting are out of scope. For those, use static source analysis or platform-native tooling instead.

How do I recover when an lsdbg command hangs?

A 'Timed out waiting for response from lsdbg session' error means the daemon is wedged in a debug roundtrip. Run `lsdbg cleanup --force` to SIGTERM the daemon (escalating to SIGKILL), which unlinks the socket so the next verb spawns a fresh session.