/klayoutclaw:klayout_gds_importfrom klayoutclaw
Imports GDS files into KLayout with safe handling of cell-name collisions, flattening hierarchy, and merging into a single top cell. Avoids Layout.read() pitfalls.
Ships in klayoutclaw. 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; scripts run unread.
Import a GDS file into the running KLayout session in a way that avoids the
well-known Layout.read() pitfalls documented in CLAUDE.md:
cells() reports N but cell(N-1) is
invalid).CellView.cell may point at a destroyed cell,
causing downstream crashes.This skill provides a single-shot importer that:
CellView.cell to the resolved top, zooms to fit, and refreshes
the layer panel.| Parameter | Type | Default | Description |
|---|---|---|---|
filepath | string | — | Required. Absolute path to a .gds file on disk. |
flatten | bool | true | If true, flatten all subcells into the top cell after reading (cell.flatten(-1, True)). |
merge_into_current | bool | true | If true, merge the GDS shapes into the currently focused layout. If false, open a new tab via mw.create_layout(1) first. |
From a shell with access to the KlayoutClaw MCP server:
python skills/klayout_gds_import/scripts/import_gds.py \
--filepath /path/to/template.gds \
--flatten \
--merge-into-current
To import into a fresh tab (non-destructive to existing work):
python skills/klayout_gds_import/scripts/import_gds.py \
--filepath /path/to/template.gds \
--no-merge-into-current
On success the script prints a JSON blob like:
{"status": "ok", "top_cell": "TOP", "shapes_added": 1342}
On failure:
{"status": "error", "error": "<message + traceback>"}
each_top_cell() (never cell(i) by index) to avoid the
orphaned-slot crash documented in CLAUDE.md.flatten=true leaves more than one
top cell, the importer picks the top cell with the largest bbox as the
canonical top, moves shapes from the other top cells into it shape-by-shape
via shapes().each() + shapes().insert(), and deletes the emptied cells.CellView.cell — after the read, the importer explicitly
rebinds cv.cell = <resolved_top> before returning, matching the pattern in
CLAUDE.md under "Dangling cv.cell after Layout.read()".Layout.clear() when
merge_into_current=true, so existing user geometry is preserved.LayoutView, not the
Layout, so a plain read() does not touch them.scripts/import_gds.pyskills/scripts/mcp_client.py (shared MCP client)CLAUDE.md sections on Layout.read() cell-name
collisions and dangling cv.cell.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub caidish/klayoutclaw --plugin klayoutclaw18 skills in this plugin
/autocadEdit and export layout geometry in the optional AutoCAD for Mac backend when the user selects AutoCAD or requests native DWG editing through its MCP server./displayklayoutclaw:displayToggle KLayout layer visibility on and off for better visualization. Use this skill when the user wants to show/hide layers, toggle layer display, change layer visibility, or focus on specific layers in KLayout. Also trigger when the user says things like "hide the metal layer", "show only mesa", "turn off layer 3", or wants to isolate layers for inspection./e2e-judgeklayoutclaw:e2e-judgeOther plugins' skills for the same job