kicad-schematiclisted
Install: claude install-skill AvatarSD/KiSkill
# KiCad schematic generation
**Engine:** `$(kx root)/kicad_lib/` — lossless sexp
parser (`sexp.py`, token-equal round-trip proven on 2.3 MB boards; byte-identity only for .kicad_mod — sch re-serializes with ~0.5% whitespace drift) and the
`kx` CLI (`python3 -m kicad_lib.cli probe|check FILE` from the repo root).
Prefer `kx probe` over ad-hoc grep for inventory; prefer `sexp.py` over
regex surgery for edits (`kx` is on PATH via ~/.local/bin). Persist with
`sexp.save_file(path, root)` — PATH FIRST. Python imports need
PYTHONPATH=<repo> or cwd=<repo>; the package is not pip-installed. Sibling skills: kicad-project (state machine),
kicad-component (find/fetch parts), kicad-review (diff/ERC), kicad-improve
(self-improvement loop). Design: `doc/DESIGN.md` in that repo.
Battle-tested workflow for writing `.kicad_sch`/`.kicad_pcb` files from
Python without KiCad GUI. The engine and worked examples ship in this repo
(`kx root`):
- `kicad_lib/ops.py` — standalone sheet, scaffold symbols, full-wire
layout, driven by the built-in geometric verifier (`kicad_lib/verify.py`).
- `kicad_lib/live_ops.py` — inject a block into an EXISTING schematic using
real library symbols (extends-flattening, multi-unit parts, mirrors),
label-stitched islands.
- `kicad_lib/pcb.py` — stage footprints in the PCB, path-linked to
schematic symbols so Update-PCB adopts them. See `tests/test_*.py` for
runnable end-to-end usage against `tests/fixtures/`.
## 0. The loop (never skip a stage)
1. **Probe