skill
kicad-export-molecule
Public Made by Adomby adom
Ship a KiCad molecule to the Adom wiki: local KiCad STEP, board, schematic and fabrication export (<slug>-fab.zip, export.json) through the Adom Bridge, handoff to molecule-publish (the wiki's model registry builds the GLB, footprint and symbol from the sources), and import of the built molecule into Hydrogen with adom-wiki model import.
← Commit history
Publish 1.0.0
6 files changed
+223
SKILL.mdadded+139@@ -0,0 +1,139 @@+---+name: kicad-export-molecule+description: Ship a KiCad molecule to the Adom wiki — export STEP + board from the user's local KiCad via the adom-desktop KiCad bridge, convert through the OCCT molecule pipeline (anchored GLB + footprint + symbol), publish as a wiki component package, then hand off to adom-molecule-import for Hydrogen registration. Use when the user says "publish my kicad molecule", "kicad molecule to the wiki", "upload molecule from kicad", "kicad to hydrogen", "ship this board as a molecule", "export molecule from kicad", or "kicad export molecule". For Fusion 360 sources see fusion-export-molecule; for Altium see altium-export-molecule; to design the molecule board itself see kicad-to-molecule.+user-invocable: true+argument-hint: "<board name or .kicad_pcb path> [--owner <hydrogen owner>] [--slug <wiki slug>]"+---++# kicad-export-molecule — KiCad project → wiki molecule → Hydrogen++One job: take a molecule designed in the user's **local KiCad**, publish it to+the wiki with a pipeline-ready artifact set, and register it in their Hydrogen+account. Validated end-to-end on real boards (PiProbe et al).++**Out of scope** (route elsewhere): designing the molecule board (wings ++machine pins) → `kicad-to-molecule`; Fusion sources → `fusion-export-molecule`;+Altium sources → `altium-export-molecule`; the Hydrogen import mechanics →+`adom-molecule-import` (this skill hands off to it).++## Stage 0 — Preflight gates (run ALL before starting)++| Gate | Check | If it fails |+|---|---|---|+| Desktop bridge | `adom-desktop ping` | Start Adom Desktop on the laptop; see `adom-desktop` skill |+| KiCad bridge | `adom-desktop commands \| grep kicad_` | Install the KiCad bridge (see `adom-desktop-kicad-bridge`) |+| KiCad version | kicad-cli must be **KiCad 10** | KiCad 9 cannot load KiCad 10 boards — "Failed to load board" means version mismatch |+| Markers | Board has **MP1–MP4 marker models** placed | Without ≥3 markers, OCCT anchoring SKIPS (graceful, but the GLB imports unanchored) |+| 3D models resolve | Machine-pin/contact models load in the user's local KiCad 3D viewer | Models referenced by paths that don't resolve are silently OMITTED from the STEP — anchoring/gold/measured-Z lose their geometry. Fix the lib paths first |++The models gate is the classic trap: the STEP only contains what resolves **on+the exporting machine**. "Renders fine for me" does not survive a machine hop.++## Stage 1 — Export on the laptop (adom-desktop KiCad bridge)++Run KiCad 10's CLI on the laptop (NOT the container — the user's 3D libs only+resolve there):++```bash+# via the bridge's run-command verb; use the laptop's real kicad-cli path+kicad-cli pcb export step --subst-models -o ABC.step ABC.kicad_pcb+```++Optional but recommended — silkscreen overlays (top + bottom):+- Export the silk layers to PNG (transparent background).+- Artwork must be **white**; if the export bakes black silk, recolor opaque+ pixels to white before converting (PIL: opaque → white). Black silk is the+ #1 cosmetic defect.++Gotcha: never write or touch KiCad files with PowerShell `Set-Content` — the+UTF-8 BOM corrupts S-expression files. Use the bridge's file verbs.++Pull everything to the container: `adom-desktop pull_file` for `ABC.step`,+`ABC.kicad_pcb`, and any silk PNGs.++## Stage 2 — Convert (OCCT molecule mode)++```bash+curl -s -X POST "https://step2glb-gmdoncpxdwx0.adom.cloud/convert?molecule=true&pin=medium" \+ -H "X-Client: <agent-name>" -H "X-Job-Name: ABC" \+ -F "[email protected]" -F "[email protected]_pcb" \+ # optional: -F "silk_top=@silk_top.png" -F "silk_bottom=@silk_bottom.png"+```++`pin` = the machine-pin size on the board (`medium` | `large`). Poll+`GET /jobs/{id}` until `status: complete`, then **verify the stats — do not+proceed on a degraded conversion**:++| Field | Must be | If not |+|---|---|---|+| `anchored` | `true` | Markers missing/undetected — fix Stage 0, re-export |+| `footprint_applied` | `true` | Board parse failed — check `warnings[]` (Cloudflare/UA, format) |+| `contact_z` | sane mm value (≈2.8–8.4) | Wrong `pin` param or missing contact models |+| `warnings[]` | empty | Read each one; "anchor skipped"/"footprint gen failed" are stop-signs |++Download the artifact set:+```bash+GET /jobs/{id}/result → ABC.glb+GET /jobs/{id}/footprint → ABC_footprint.json+GET /jobs/{id}/symbol → ABC_symbol.json+```++> Upgrade path: once the `step2glb` CLI grows molecule flags+> (adom/adom-step2glb discussion #99), replace the curl with+> `step2glb convert ABC.step --molecule --board ABC.kicad_pcb --pin medium`.++## Stage 3 — Publish to the wiki++Component package dir:++```+abc/+ package.json # slug, version, type: "component", description, tags+ ABC.glb # the anchored, optimized model (reused at import — never regenerated)+ ABC.kicad_pcb # board source+ ABC_footprint.json # OCCT-authored (per-pad wire-attach z included)+ ABC_symbol.json+ README.md+```++```bash+adom-wiki pkg publish # registry layer+adom-wiki repo push <owner>/abc --files ABC.glb ABC.kicad_pcb ABC_footprint.json ABC_symbol.json README.md package.json -m "ABC molecule"+```++Verify: the page renders, the 3D model shows, and `metadata.model_3d_path` is+set (`adom-wiki api /api/v1/pages/abc`). The packaged `*_footprint.json` is+what Hydrogen's import prefers — publishing it here is what makes the import+zero-regeneration.++## Stage 4 — Import to Hydrogen (handoff)++Follow the **`adom-molecule-import`** skill (ships with `adom/adom-molecule`).+Short form:++```bash+adom-wiki repo clone <owner>/abc --dir /tmp/abc-import # authenticated, binary-safe+adom-molecule create --owner <hydrogen-owner> --name ABC \+ --glb ABC.glb --pcb ABC.kicad_pcb --no-optimize+```++`--no-optimize` is the point: reuse the published GLB, skip re-optimization,+no silkscreen needed at import. Caveat: keep the wiki page **public** if the+import goes through Hydrogen's `/api/molecules/import` endpoint — private-page+support there is pending; the container-side flow above is already+private-safe.++## Acceptance checklist (in the Hydrogen editor)++- Board is Z-up with the front-left machine pin at the origin+- Machine pins/contacts render gold (not gray)+- Silkscreen present and white (if exported)+- Wires attach at the contact tops (not floating above / sunk below)+- `adom-molecule list` shows the molecule under the right owner++## Related++- `adom-molecule-import` — the import half (this skill's Stage 4)+- `fusion-export-molecule` / `altium-export-molecule` — same job, other EDAs+- `kicad-to-molecule` — make a plain PCB molecule-ready first (wings + pins)+- `adom-desktop-kicad-bridge` — the laptop KiCad verbs Stage 1 drives
docs/hero-src.htmladded+45@@ -0,0 +1,45 @@+<!doctype html>+<html><head><meta charset="utf-8"><style>+ * { margin:0; padding:0; box-sizing:border-box; }+ body { width:1600px; height:1000px; background:+ radial-gradient(1200px 700px at 75% -10%, #14324a 0%, #0b1420 55%, #070d15 100%);+ font-family: 'Segoe UI', system-ui, sans-serif; overflow:hidden; position:relative; }+ .glow { position:absolute; width:900px; height:900px; border-radius:50%;+ background: radial-gradient(circle, rgba(45,212,191,.10) 0%, rgba(59,130,246,.06) 45%, transparent 70%);+ right:-180px; top:-260px; }+ .win { position:absolute; left:170px; top:210px; width:1260px; border-radius:14px;+ background:#0d1826; border:1px solid #1e3348;+ box-shadow: 0 40px 90px rgba(0,0,0,.65), 0 0 0 1px rgba(45,212,191,.05); }+ .bar { height:46px; display:flex; align-items:center; padding:0 18px; gap:8px;+ border-bottom:1px solid #16293c; }+ .dot { width:12px; height:12px; border-radius:50%; background:#22384e; }+ .title { margin-left:12px; color:#5b7astro; color:#5b7a99; font-size:14px; letter-spacing:.4px; }+ .body { padding:26px 34px 34px; font-family:'Cascadia Mono','Consolas',monospace; font-size:17px; line-height:1.85; }+ .p { color:#7dd3c8; }+ .cmd{ color:#e6edf5; }+ .ok { color:#4ade80; }+ .fl { color:#8aa4c0; }+ .accent { position:absolute; left:0; right:0; top:0; height:3px; border-radius:14px 14px 0 0;+ background:linear-gradient(90deg,#2dd4bf,#3b82f6,#8b5cf6); }+</style></head><body>+ <div class="glow"></div>+ <div class="win">+ <div class="accent"></div>+ <div class="bar"><div class="dot"></div><div class="dot"></div><div class="dot"></div>+ <div class="title">adom-desktop · Fusion 360 Electronics · piprobe.fbrd</div></div>+ <div class="body">+ <div><span class="p">$</span> <span class="cmd">kicad-cli pcb export step</span> <span class="fl">--subst-models -o ABC.step</span></div>+ <div class="ok"> ABC.step written 3.2 MB</div>+ <div><span class="p">$</span> <span class="cmd">curl POST /convert?molecule=true</span> <span class="fl">step + board</span></div>+ <div class="ok"> anchored gold pins footprint_applied contact_z 5.35mm</div>+ <div><span class="p">$</span> <span class="cmd">adom-wiki pkg publish</span></div>+ <div class="ok"> adom/[email protected] published — GLB + footprint + symbol</div>+ <div><span class="p">$</span> <span class="cmd">adom-wiki repo push adom/abc</span> <span class="fl">--files ...</span></div>+ <div class="ok"> source on the Files tab</div>+ <div><span class="p">$</span> <span class="cmd">adom-molecule create</span> <span class="fl">--glb ABC.glb --no-optimize</span></div>+ <div class="ok"> registered under caleb — no re-optimization</div>+ <div><span class="p">$</span> <span class="cmd">adom-molecule list</span></div>+ <div class="ok"> hydrogen.adom.inc/caleb/molecules/ABC — wires attach clean</div>+ </div>+ </div>+</body></html>
docs/shot.pngadded⋯ 1 unchanged line ⋯
install.shadded+9@@ -0,0 +1,9 @@+#!/bin/bash+set -e+PKG_DIR="$(cd "$(dirname "$0")" && pwd)"+SKILLS_DIR="$HOME/.claude/skills"+mkdir -p "$SKILLS_DIR/kicad-export-molecule"+rm -rf "$SKILLS_DIR/kicad-export-molecule"+mkdir -p "$SKILLS_DIR/kicad-export-molecule"+cp "$PKG_DIR/SKILL.md" "$SKILLS_DIR/kicad-export-molecule/SKILL.md"+echo "Installed skill → $SKILLS_DIR/kicad-export-molecule/SKILL.md"
package.jsonadded+27@@ -0,0 +1,27 @@+{+ "slug": "kicad-export-molecule",+ "version": "1.0.0",+ "type": "skill",+ "description": "Ship a KiCad molecule to the Adom wiki: local KiCad STEP export via the adom-desktop bridge, OCCT molecule conversion (anchored GLB + footprint + symbol), wiki component publish, and handoff to adom-molecule-import for Hydrogen registration.",+ "tags": ["molecule", "kicad", "export", "hydrogen", "skill"],+ "dependencies": {+ "adom/adom-desktop": "^1.9.0",+ "adom/adom-molecule": "^1.1.3"+ },+ "scripts": { "install": "./install.sh", "uninstall": "./uninstall.sh" },+ "hero": {+ "headline": "KiCad board to wiki molecule",+ "subhead": "export, OCCT-convert, publish, and import to Hydrogen in one flow",+ "screenshot": "docs/shot.png"+ },+ "discovery_triggers": [+ "publish my kicad molecule", "kicad molecule to the wiki", "upload molecule from kicad",+ "kicad to hydrogen", "ship this board as a molecule", "export molecule from kicad", "kicad export molecule"+ ],+ "discovery_pitch": "Take a molecule designed in local KiCad all the way to the wiki and a Hydrogen account: bridge-driven STEP export, OCCT molecule pipeline, component publish, import handoff.",+ "sample_prompts": [+ { "label": "Publish a molecule", "prompt": "Publish my KiCad molecule ABC to the wiki and import it into my Hydrogen account" },+ { "label": "Ship a board", "prompt": "Ship piprobe from my KiCad to Hydrogen" },+ { "label": "Export only", "prompt": "Export my kicad board as a molecule bundle and publish it" }+ ]+}
uninstall.shadded+3@@ -0,0 +1,3 @@+#!/bin/bash+rm -rf "$HOME/.claude/skills/kicad-export-molecule"+echo "Removed kicad-export-molecule skill"