---
name: kicad-library-manager
description: >
  Organize the user's personal KiCad libraries fast. Probes their machine (via adom-desktop) for the
  sym-lib-table / fp-lib-table and personal symbol/footprint/3D libraries, then shows three views —
  Symbol priority (inline-editable Ref / Footprint / Datasheet / LCSC PN / Description, footprint
  autocomplete, live JLCPCB stock+price on hover), Footprint priority (3D model + symbols-using-it),
  and 3D-model priority. Add from the Adom wiki or blank, duplicate symbols, flag deletes / adds with
  an undo-redo tree, preview symbol+footprint+3D (kicad-cli render + Babylon viewer), and sync to disk
  with reversible backups. Trigger words — kicad library manager, organize my kicad libraries, manage
  symbol/footprint libraries, view my libraries, edit symbol fields, library cleanup, klm.
---

# kicad-library-manager

A webview workbench for a user's **personal KiCad libraries**. It does not scrape vendors or
generate CAD from scratch — it reads what's already on the user's machine, lets them organize and
edit it, and writes changes back to disk.

## Running

```
node ~/.claude/skills/kicad-library-manager/server.js      # or: kicad-library-manager serve
kicad-library-manager app                                  # open as a Hydrogen webview tab (alias: klm)
```

Runs a pure-Node HTTP server on `:7823` (`KLM_PORT` to override) serving a single-file SPA.

## What it does

- **Probe** (via `adom-desktop shell_execute`): finds `sym-lib-table` / `fp-lib-table` and the user's
  personal `.kicad_sym` / `.pretty` / 3D model files; parses symbols, footprints and 3D models and
  builds the symbol↔footprint↔model usage graph. Keeps an immutable backup of the initial state.
- **Three modes:** Symbol priority (all fields inline-editable, footprint autocomplete, LCSC
  stock/price on hover), Footprint priority (3D model + the symbols using each footprint), 3D-model
  priority (grouped by folder).
- **Add / duplicate:** add a part from the Adom wiki (chip-fetcher style) or a blank symbol/footprint;
  duplicate a symbol.
- **Flags + undo:** delete flags a row red, add shows green, applied on Sync; full undo/redo tree
  (Ctrl+Z / Ctrl+Shift+Z), revert-to-backup.
- **Preview:** symbol + linked footprint rendered authoritatively by `kicad-cli` (recolored for a dark
  canvas, pad numbers on top); footprints get a live 3D model (STEP→GLB via step2glb, shown in the
  Adom Babylon viewer); standalone 3D-model preview.
- **Sync:** writes edits/additions/deletions to disk with `.klm.bak` backups + a reversible
  `.klm-trash/`; per-library or all-at-once; unregisters deleted libraries from the lib-tables.

## Dependencies on the host

- **adom-desktop** bridge (filesystem + shell on the user's machine).
- **kicad-cli** (KiCad 9) on the desktop — symbol/footprint SVG previews.
- **step2glb** + the JLCPCB search service — 3D conversion and live stock/price (graceful if absent).

See **DEVELOPING.md** for architecture and every hard-won gotcha.
