/photonforge:photonforge-live-viewerfrom photonforge
Interactive 2D layout viewer for PhotonForge components. Supports Python lifecycle (open, push updates, stop) and browser-based headless control (zoom, pan, inspect, measure) via lvApi.
Ships in photonforge. 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.
Act as a PhotonForge LiveViewer assistant.
The LiveViewer is a small, local, interactive 2D layout viewer for
PhotonForge. You import it (from photonforge.live_viewer import LiveViewer),
point it at a pf.Component (a single device, a routed circuit, or a whole
chip), and it starts a tiny web server on your machine. You open ONE browser tab
(http://localhost:<port>) and see the layout drawn to scale. Each time you
change the design and push it again, that same tab redraws. Think of it as a
KLayout window that lives next to your Python script and auto-updates - it is the
main visual feedback loop while building a layout.
There are two ways to interact with it:
window.lvApi,
exposed on the page: fit/zoom/pan the camera, show/hide layers, inspect the
shape at a point, add measurements, and read the layer list, the cell hierarchy
(lvApi.componentTree()), and camera state - with no human at the mouse (all
verified on 1.5.0; the cell hierarchy is also available from Python via
component.tree_view()). This is how an agent "looks at" and drives the layout
headlessly.It is visualization, not simulation: displaying a layout runs no FDTD, no mode solve, and costs nothing. Never launch a solver just to draw something.
photonforge before relying on a signature. When the runtime exposes the
Tidy3D MCP server, use search_photonforge_docs / fetch_photonforge_doc
(unprefixed names) before guessing.from photonforge.live_viewer import LiveViewer; viewer = LiveViewer(port=8765). It starts on construction and prints its URL. Display a
component with viewer(component) (or the alias viewer.display(component));
calling again pushes an update to the same browser tab.port=0 (the default) lets the OS pick a free port - read it
back from viewer.port.viewer.stop() when done. Before re-running a
viewer script, free the port so the new run can bind it.window.lvApi - see the reference. It needs any way to run
JavaScript on the page (a browser console or a headless "evaluate" capability).
The full surface is verified on 1.5.0; on older releases confirm a method with
Object.keys(window.lvApi) first. The cell hierarchy is also available from
Python (component.tree_view()) without the viewer.s_matrix, or other cost-incurring work just to display a layout.component.bounds() is a method call, not a property. Read existing user code
before modifying it.Read references/live-viewer.md before writing a viewer script, composing a
multi-component showcase, driving or inspecting the viewer with window.lvApi,
or debugging a stuck viewer. It covers the Python lifecycle, port hygiene, the
grid_layout/pack_layout showcase pattern, fit-to-view for large devices, the
verified window.lvApi agent surface (camera, layers, selection, cell
hierarchy, measurement, state), the server inspection endpoints (layer stack,
cross-section, raw SVG), reading geometry/hierarchy from Python, and the common
gotchas - all checked against PF 1.5.0.
viewer = LiveViewer(port=8765) (it
starts automatically). Tell the user to open http://localhost:8765.viewer(component). After each meaningful layout
change, call viewer(component) again to push the update.pf.grid_layout(...) or
pf.pack_layout(...) and push the result - do not shift references by hand.window.lvApi.fit().window.lvApi methods on the
page (getState, fit, setCamera, setLayerVisible, selectWorld,
layers, componentTree, measure). Every mutator renders synchronously.
The cell hierarchy is also available from Python (component.tree_view()).viewer.stop() to release the port. If re-running a script,
free the port first and let the new run rebind.viewer.stop() in the old process, or free the port at the OS level
before restarting.component.bounds() is a method; calling it without parentheses returns the
method object, not the extents.python -u ...) so "LiveViewer
started" and update logs appear immediately.viewer(component)), or the design changed without a follow-up viewer(...)
call.window.lvApi coordinates match the layout in X but NEGATE Y (the viewer works
in screen space, Y-down). Use the aabb/bounds values lvApi itself
reports, or negate Y when passing coordinates from Python component.bounds().window.lvApi is ready only after a layout has been pushed and parsed; check
lvApi.getState().ready === true before driving it._repr_svg_) render; pushing anything
else is a no-op.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
8 skills in this plugin
/photonforge-circuit-simulationRun and understand PhotonForge circuit-level and time-domain simulations. Compose component S-matrices into a whole-circuit frequency response with pf.CircuitModel, or drive the circuit with real waveforms (modulator bit patterns, laser turn-on, ramps) and watch the output evolve with pf.CircuitTimeStepper - which uses each component's own active-model time stepper and falls back to an automatic pole-residue fit only for plain S-matrix components. For a standalone S-matrix (e.g. measured Touchstone) use pf.pole_residue_fit + pf.TimeDomainModel directly. Covers pf.abstract building blocks (cw_laser, ring_resonator, photodiode, modulators), TimeSeries inputs/outputs, the carrier/rotating-frame convention, WDM ring-cascade pitfalls, and unit gotchas. Use when the user simulates modulators, ring/MRM links, WDM ring cascades, eye diagrams, transients, or photodiode detection, or asks what circuit vs time-domain simulation is./photonforge-gui-automationDrive and verify the PhotonForge cloud GUI (photonforge.simulation.cloud) from an AI coding session. Make the edits programmatically with the PhotonForge PDA SDK - create and update projects, components, and versions - then drive a real web browser with the Playwright MCP server to open, screenshot, and confirm what the user actually sees in the GUI (the project list, a schematic, port placement, wire routing). The established pattern is 'PDA SDK controls, Playwright verifies': treat the GUI as a verification surface, not a control surface. Use when the user wants to build, edit, or visually verify schematics and applications on the cloud GUI, position a circuit correctly in a schematic, confirm port placement or wiring by screenshot, or reconnect the local photonforge-server so the GUI comes back online.npx claudepluginhub flexcompute/plugin-marketplace --plugin photonforgeOther plugins' skills for the same job