From klayoutclaw
Safely imports GDS files into KLayout layouts, flattening hierarchy, merging into single top cell, and avoiding orphaned cell indices from raw Layout.read().
npx claudepluginhub caidish/klayoutclaw --plugin klayoutclawThis skill uses the workspace's default tool permissions.
Import a GDS file into the running KLayout session in a way that avoids the
Adds rectangles, polygons, paths, cells, and instances to KLayout layouts via Python CLI scripts and MCP execute_script tool. Use for drawing shapes or chip geometry.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Share bugs, ideas, or general feedback.
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.