From klayoutclaw
Validates committed flake polygons in KLayout via visual inspection against microscope images, checking layer boundaries, containment, and alignment for pass/fail/retry decisions.
npx claudepluginhub caidish/klayoutclaw --plugin klayoutclawThis skill uses the workspace's default tool permissions.
Pure agent workflow using existing skills and MCP tools. No custom scripts needed.
Detects van der Waals heterostructure flake boundaries from microscope images and maps to KLayout polygons via 5-step agent-orchestrated pipeline (align, detect, combine, commit, review). Use for multi-image flake detection, alignment, or stack segmentation.
Verifies visual output of slides, charts, documents, UI via render-vision-fix loop: renders PNG/PDF, scores with Gemini vision (0-10), iterates defect fixes until >=9.5.
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.
Share bugs, ideas, or general feedback.
Pure agent workflow using existing skills and MCP tools. No custom scripts needed.
After the commit step has inserted polygons into KLayout. Review validates the actual committed result, not just overlay images.
<out>/combine/overlay_raw.png, overlay_lut.png, combine_report.json<out>/align/alignment_report.jsonUse MCP screenshot to capture the current KLayout viewport with polygons on the background image:
mcp__klayoutclaw__screenshot
Read the resulting PNG to see all layers overlaid on the microscope photo.
Use the display skill to isolate each material layer for focused inspection:
# Show only top_hBN (layer 10/0) against the background
python skills/display/scripts/show_only.py 10/0
# Screenshot, then inspect
# Show only graphene (layer 11/0)
python skills/display/scripts/show_only.py 11/0
# Show only bottom_hBN (layer 12/0)
python skills/display/scripts/show_only.py 12/0
# Show only graphite (layer 13/0)
python skills/display/scripts/show_only.py 13/0
# Restore all layers
python skills/display/scripts/toggle_layer.py 10/0 11/0 12/0 13/0 --on
Take a screenshot after each show_only to compare each polygon against the flake features.
Read the overlay images from the combine step for cross-reference:
<out>/combine/overlay_raw.png — contours on desaturated raw image<out>/combine/overlay_lut.png — contours on LUT image (if available)<out>/combine/mask_composite.png — color-coded mask overlayThese show the contours before coordinate transform. The committed KLayout polygons should match.
Answer these specific questions about the KLayout screenshots:
Q1 — Top hBN boundary: "Do the top_hBN polygons (layer 10/0) follow the flake boundary visible in the background image?" Rate: tight fit / acceptable / poor fit
Q2 — Graphene containment: "Is the graphene polygon (layer 11/0) fully inside the top_hBN polygon (layer 10/0)? Any graphene outside top_hBN indicates a problem." Rate: fully contained / mostly contained / significant leakage
Q3 — Graphite alignment: "Does the graphite polygon (layer 13/0) align with the dark strip visible in the image?" Rate: aligned / offset / missing
Q4 — Bottom hBN coverage: "Does the bottom_hBN polygon (layer 12/0) cover the correct underlying hBN region?" Rate: good / partial / wrong region
Q5 — Overall: "Rate this result: excellent / good / needs work."
Read the reports for numeric cross-checks:
From <out>/align/alignment_report.json:
From <out>/combine/combine_report.json:
| Visual Assessment | Metrics | Decision |
|---|---|---|
| excellent/good | metrics OK | PASS — detection complete |
| good | metrics borderline | PASS with note |
| needs work (alignment) | high chamfer / low IoU | FAIL → re-run align with different rotation or parameters, then redo combine → commit → review |
| needs work (detection) | — | FAIL → re-run specific detect script with adjusted parameters, then redo combine → commit → review |
| needs work (commit) | — | FAIL → re-run commit (coordinate transform or layer error) |
Record the decision and reasoning. If FAIL, specify which step to retry and what to change.
--cluster-id overrides. Check source image quality.