This skill should be used when the user wants a new board or a KiCad project made or changed from code, for example "start a new board", "make a KiCad project for ...", "make the schematic and PCB", "place the parts", "autoroute the board" or "make Gerbers / BOM / CPL for JLCPCB". It builds a checked KiCad 10 project with production files from 19 templates and 23 circuit blocks. For a hand-made KiCad project use kicad-projects.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Kicad Generator?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gkochievi-kicad-generator)
---
name: kicad-generator
description: This skill should be used when the user wants a new board or a KiCad project made or changed from code, for example "start a new board", "make a KiCad project for ...", "make the schematic and PCB", "place the parts", "autoroute the board" or "make Gerbers / BOM / CPL for JLCPCB". It builds a checked KiCad 10 project with production files from 19 templates and 23 circuit blocks. For a hand-made KiCad project use kicad-projects.
---
# KiCad generator
A Python generator that turns four project files into a complete, checked KiCad 10 project and its production files. Claude cannot drive the KiCad GUI, so this is how Claude produces real boards: describe the circuit and placement in Python, build, read the checks, iterate. The user then opens the KiCad 10 project, reviews it, finishes routing by hand where needed and orders.
Bundled here:
- `generator/`: the project-independent generator (no board knowledge inside). It runs on KiCad 10 only; `generator/doctor.py` checks a machine, `container/Dockerfile` is the environment for systems without KiCad 10.
- `templates/`: new-project templates, one per MCU family (table below); each builds and is checked by KiCad 10 as described in its README.
- `generator/blocks/`: 23 circuit blocks that a project adds to its four files with a few lines (bus ports, stepper axis, servo bank, nRF24 socket, USB-C input, charger, cell protection, LDO, buck, reverse protection, opto inputs, relay and MOSFET outputs, 4–20 mA, level shifter, GNSS, SPI flash, NFC reader, Ethernet, microSD, LoRa, mouse sensor, mouse buttons and wheel); their part catalogue is data in `generator/blocks/parts_catalog.json`. `references/circuit-blocks.md` explains them.
- `generator/tests/`: tests of the catalogue, the blocks, the copper geometry, the drawn footprints and 3D models, the KiCad 10 library reader, the DRC reader and every template, without KiCad's python module (`python3 -m pytest generator/tests`; the template tests need KiCad 10's footprint library). Run them after changing a block or a template.
## Templates
| Template | MCU | Board | Shows |
|---|---|---|---|
| `templates/esp32-s3` | ESP32-S3-WROOM-1-N8 | 64 × 48 mm, 2 or 4 layers | 7–15 V buck, 3.3 V LDO, USB-C native USB with ESD, EN / BOOT, I2C port, sensor, MOSFET output, USB pair drawn in `copper()` |
| `templates/esp32-c3` | ESP32-C3-WROOM-02-N4 | 48 × 42 mm | USB-C native USB-Serial/JTAG, 22 Ω series, strapping pull-ups, EN RC, BOOT / RESET keys, 1×8 I/O pads; USB pair drawn up beside the module and into its side pads |
| `templates/stm32f072` | STM32F072CBT6 (LQFP-48) | 50 × 36 mm | crystal-less USB (HSI48 + CRS), BOOT0 key for the ROM bootloader, NRST key, Tag-Connect SWD, 0.5 mm-pitch net class widths; USB pair drawn (`usbc_esd` + `pair_up`) |
| `templates/atmega328p-nano` | ATmega328P-AU | 56 × 31.5 mm | Arduino Nano pin order on two 1×15 rows (1.0 in apart, so not a drop-in Nano socket), CH340C USB-UART with DTR auto-reset and RESET clamp, 16 MHz crystal, ISP 2×3, 3.3 V LDO; MCU turned so D5–D12 face their header row |
| `templates/atmega328p-nano-dropin` | ATmega328P-AU | 18 × 43.2 mm, 4 layers | true drop-in Nano: rows 0.6 in apart, parts on both sides (CH340C, regulators and passives on the bottom, Standard PCBA), VIN 7–12 V through a 5 V buck, USB-C, L / PWR LEDs, SMD reset key, ISP through the header pins |
| `templates/rp2040` | RP2040 (QFN-56) | 50 × 41 mm | W25Q128 QSPI flash, 12 MHz crystal with 1 kΩ, 27 Ω USB, BOOTSEL / RUN keys, SWD, 0402 passives round the QFN, 0.4 mm-pitch class widths; USB pair drawn through the resistors, +1V1 ring inside the QFN pad ring |
| `templates/nrf52840` | Ebyte E73-2G4M08S1C (nRF52840) | 40 × 36 mm | module in normal-voltage mode on a footprint drawn from the Ebyte manual, native USB, Tag-Connect SWD, reset key, LED, antenna keep-out at the edge |
| `templates/ch32v003` | CH32V003F4U6 (QFN-20) | 32 × 26 mm | USB-C power only, 3.3 V LDO, SWIO pads, key and LED, two M2 holes |
| `templates/esp32-s3-motion` | ESP32-S3-WROOM-1-N8 | 120 × 90 mm, 4 layers | application template built from circuit blocks: 3 × TMC2209 axes on one UART, 8 servo outputs (PCA9685), CAN, RS-485, nRF24L01+ socket, endstops; 12–24 V with fuse, ideal-diode reverse block and TVS, 5 V / 5 A servo buck, 3.3 V logic buck that also runs from USB |
| `templates/esp32-s3-io` | ESP32-S3-WROOM-1-N8 | 130 × 95 mm, 4 layers | I/O controller from circuit blocks: 4 opto inputs, 2 × 4–20 mA, 2 relays, 2 MOSFET load outputs, RS-485, SPI flash, 8-bit 3.3 / 5 V expansion port; 12 V with PTC, P-FET reverse block, 3.3 V and 5 V bucks |
| `templates/esp32-c3-gnss` | ESP32-C3-WROOM-02-N4 | 72 × 46 mm, 4 layers | battery GNSS tracker from circuit blocks: MAX-M10S on a U.FL (50 Ω line), BQ24075 charger with power path, DW01A cell protection, AP2112K, battery divider, USB pair drawn |
| `templates/esp32-c3-rfid` | ESP32-C3-WROOM-02-N4 | 60 × 104 mm, 4 layers | NFC / RFID reader from circuit blocks: CLRC663 plus with EMC filter, matching and RX network, printed 45 × 40 mm loop with copper keep-outs, USB-C 5 V, AP2112K |
| `templates/esp32-s3-gateway` | ESP32-S3-WROOM-1-N8 | 100 × 62 mm, 4 layers | Ethernet / LoRa gateway from circuit blocks: W5500 with an RJ45 MagJack, Ra-01SH (868 / 915 MHz) or Ra-01S (433 MHz) on a U.FL, or the 1 W Ra-01SH-P, microSD, 12 V with PTC, P-FET reverse block and 3.3 V buck, USB-C data |
| `templates/nrf52840-mouse` | Ebyte E73-2G4M08S1C (nRF52840) | 60 × 85 mm, 2 layers | wireless mouse from circuit blocks: PMW3360 over a lens cutout with its 1.9 V LDO, left / right / middle micro switches, scroll-wheel encoder in a board slot, DPI key, side-button connector, one Li-ion cell with BQ24075 charger and DW01A protection, USB-C (BLE HID and USB HID) |
| `templates/esp32-c6` | ESP32-C6-MINI-1-N4 | 48 × 40 mm | Wi-Fi 6 / BLE 5 / 802.15.4 module with the antenna past the edge, USB-C native USB Serial/JTAG with ESD and 22 Ω, AP2112K, strapping pull-ups, BOOT / RESET keys, 1×8 I/O pads; USB pair drawn |
| `templates/rp2350` | RP2350A (QFN-60) | 52 × 42 mm, 4 layers (In2 3.3 V) | Raspberry Pi's minimal design: core switching regulator placed and drawn from U1's pads, W25Q128 QSPI flash turned so the QSPI lines do not cross, 12 MHz crystal, 27 Ω USB, BOOTSEL / RUN keys, Tag-Connect SWD, UART1 / I2C1 / ADC pads; USB pair drawn |
| `templates/li-ion-power` | none (power module) | 50 × 34 mm | one Li-ion cell from circuit blocks: USB-C, BQ24075 charger with power path, DW01A protection, MAX17048 fuel gauge, AP2112K 3.3 V, TPS61023 5 V / 1 A boost drawn in `copper()` (SOT-563) |
| `templates/usb-pd-sink` | none (STUSB4500) | 49 × 28 mm | USB-C PD trigger: STUSB4500 asks for 5-20 V, P-FET switch after the contract, TVS2200, 7 A fuse, 5.08 mm terminal, NVM pads; 24-pin 5 A receptacle fanned out through vias between its pad rows, current path drawn |
| `templates/din-io-24v` | STM32F072CBT6 | 100 × 80 mm, 4 layers | 24 V DIN-rail I/O from circuit blocks: 8 opto inputs, 4 × 0.5 A high-side (sourcing) outputs with PTCs, RS-485 with hardware DE, USB-C DFU; fuse, 60 V P-FET reverse block, SMCJ30A, LMR51610 65 V buck, 24 V monitor; terminals on both long edges |
Pick the template with the same MCU; otherwise the one closest in package and supply (QFN MCU with USB → `rp2040`, `rp2350` or `stm32f072`; module with antenna → `esp32-s3`, `esp32-c3`, `esp32-c6` or `nrf52840`), and replace the MCU block. Every template uses the same generator and the same four project files.
For a standard sub-circuit (bus port, stepper axis, servo outputs, radio socket, USB-C input, charger, cell protection, regulator, input protection, isolated inputs, relay or load outputs, 4–20 mA, level shifter, GNSS, flash, NFC reader, Ethernet, microSD, LoRa, mouse sensor, mouse buttons and wheel) use the circuit block instead of drawing it again: create it in `config.py`, place its sheet in `netlist.py` and its parts with `place()` in `placement.py` (`references/circuit-blocks.md`; worked examples `templates/esp32-s3-motion`, `templates/esp32-s3-io`, `templates/esp32-c3-gnss`, `templates/esp32-c3-rfid`, `templates/esp32-s3-gateway`, `templates/nrf52840-mouse`, `templates/li-ion-power`, `templates/din-io-24v`).
## What a build produces
`build.sh <project dir> <out dir>` runs, and stops at the first real error:
1. `gen_kicad.py`: schematic (root + one sheet per `SHEETS` entry), symbol library, footprint library (KiCad 10 library footprints copied in, custom ones generated, regex patches applied), 3D models, `.kicad_pro` with net classes and rules, `.kicad_dru` custom rules; then `kicad-cli` resaves the schematic and libraries in KiCad 10's format.
2. `kicad-cli sch export netlist` and `check_sch.py`: KiCad's own netlist must equal the intended one; every symbol pin must have a pad.
3. `gen_pcb.py`: outline, holes, layer count, pours / planes, footprints with nets, placement (`fixed()`, `PLACE`), generator-drawn copper (`copper()`), mains fence, silkscreen labels.
4. `check_pcb.py`: schematic ↔ PCB links, pad nets, outline, KiCad's DRC through `kicad-cli` (only unrouted connections, dangling vias and silkscreen warnings allowed).
5. `make_cpl.py`, `make_bom.py`: JLCPCB CPL (body centres; bottom-side parts with 180° − KiCad's angle, as JLCPCB reads it) and BOM (same designators, one line per LCSC part), parts-not-assembled list.
6. `kicad_check.py`: KiCad 10 ERC, netlist against the intended one, DRC with schematic parity, 3D model check (`KICAD10_3DMODELS`), renders (`kicad_report.json`, `render_*.png`; `KICAD_RENDER=off` or `basic` skips or speeds up the renders while iterating).
7. `make_guide.py`: assembly and connector guide (HTML; PDF with playwright, or `htmlpdf.py` elsewhere).
8. `route.py` (optional, `FREEROUTING_JAR` (a path, or `auto`: `generator/get_freerouting.py` downloads Freerouting 2.4.1 from its GitHub release once and checks its SHA-256) or `FREEROUTING_CMD`): autorouted copy in `routed/` (Freerouting; pieces narrower than their net class widened back where the DRC allows; autorouted pieces in a clearance violation ripped up; then `finish_routes.py` for whatever is open, 45° tracks, plane fan-out vias on 4+ layers), pours filled, ground stitching vias on a 5 mm grid, in pour islands and next to the vias of critical nets, DRC; then `kicad_check.py --routed` and the Gerber + drill zip.
9. Schematic + PCB PDF, `production/` folder.
`publish.sh <project> <out> <target>` copies the KiCad 10 project, `production/` and `autorouted/` into a delivery tree.
## Starting a new board
Follow the project phases (`ask-gela/references/project-phases.md`); this covers phases 1 and 3–5 for one board. For a vague request or a board with many open choices, run `hardware-grilling` first: its confirmed summary answers step 1.
1. Ask in one round (AskUserQuestion when available) what cannot be inferred, offering defaults: what the board does and what it connects to (signals, levels, currents); supply range, source and peak current; MCU and connectivity, chosen with the `microcontrollers` skill (Wi-Fi: ESP32-S3-WROOM-1-N8 or ESP32-C3 module, WROOM-1U inside metal; BLE: nRF52840 module; cheap control: STM32 / CH32V003; USB device: RP2040 / STM32F072; 5 V Arduino-compatible: ATmega328P); size, enclosure, connector edges and holes; layers (2 by default, 4 for high-speed USB, controlled impedance or tight emissions) and assembly route (JLCPCB economic, one side); quantity and budget; mains, outdoor, wet or hot use. Record the answers in the project README.
2. Check the tools with `python3 generator/doctor.py` (`references/tooling-setup.md`): KiCad 10's python module, `kicad-cli` and footprint library, Freerouting (`python3 generator/get_freerouting.py` fetches and checks it; Java 25 needed). Run every build in Claude's workspace; write the out dir outside the project folder (`build.sh` wipes it and refuses a folder with project files).
3. Copy the template with the same MCU, or the application template closest to the job (table above), from `${CLAUDE_PLUGIN_ROOT}/skills/kicad-generator/templates/<template>/` to `<board-name>/`; for another MCU take the closest package and supply and replace the MCU block from the `microcontrollers` minimum-circuit checklist. Read the template's README for what it has verified. Set `NAME` (letters, digits, `-`, `_`), `TITLE`, `REV`, `DATE`, `DESCRIPTION`, `BOARD`, `HOLES`, `LAYERS` in `config.py`.
4. Circuit: keep the template parts that fit, add standard sub-circuits as circuit blocks, write the rest in `netlist.py` sheet by sheet with `Note` lines for the design intent (`references/netlist-dsl.md`). Size parts with `engineering-calculators` and `electronics-fundamentals`, protection and mains with `pcb-design`, strapping pins in `microcontrollers`, sensors and radios in `peripherals`. Put the GPIO map in the `netlist.py` docstring: it becomes the firmware's `config.h`.
5. Parts: fill `parts.json` for every reference from each part's LCSC page (manufacturer part, package, stock; JLCPCB basic parts first, an alternate for extended parts). Never guess an LCSC number: leave the part open and say so. `parts-sourcing/scripts/bom_check.py` checks stock, price breaks and lifecycle of the generated BOM with distributor keys.
6. Footprints in `config.FOOTPRINTS` (KiCad 10 library names); a part KiCad lacks gets one from its datasheet land pattern with `kicad-library/scripts/fp_gen.py` (checked by `lib_check.py`) or in `extra.py`. Print unusual footprints 1:1 against the part. Build until `check_sch` shows `errors: 0`.
7. Layout: floor-plan first (connector and antenna edges, power entry, hot loops, quiet and noisy zones, mains area). `fixed()` for connectors, modules, keys; `PLACE` block by block from the most constrained part outwards (`references/placement-and-copper.md`). `copper()` for what an autorouter must not decide: switch nodes, high-current areas, differential pairs, pin ties, mains fences. Net-class widths from current and from the narrowest pad gap each net enters.
8. Build, read the `nudged` list and the silk report, look at a render, adjust, rebuild. Route (`references/routing-and-checks.md`; `HW_LAYERS=4` to compare) and read `route_report.json`.
9. Review with the `board-review` skill and fix blockers and majors. Confirm `check_sch` and `check_pcb` 0 errors, KiCad 10 ERC 0 / DRC 0 / parity 0 / all models found, routed copy 0 unconnected.
10. Deliver the KiCad 10 project, `production/` and the project files to the user's folder (`references/production-files.md`). List the human checks: 1:1 footprint print, JLCPCB placement preview, stock at order time, first power-up on a current-limited supply. Offer the firmware next (`embedded-firmware`), from the GPIO map.
## Rules that keep builds correct
- Treat the project files as the source: never hand-edit generated KiCad files, then rebuild over them. Once the user edits the PCB in KiCad, stop publishing over it (say so in the README).
- Before overwriting files in the user's folder, compare checksums with the last delivery and look for KiCad lock files (`*.lck`, `~*.lck`); if the user changed a file, stop and ask.
- Read every check line. `check_sch` and `check_pcb` must show 0 errors; KiCad 10 DRC must show 0 errors and 0 unconnected on the routed copy. A warning count that grows between builds needs a reason.
- Keep net class track widths no wider than the pads and gaps a net must pass (Freerouting narrows a track only where it enters a pin): half the track width plus the clearance must fit the gap between pads. 0.5 mm for USB-C VBUS; 0.3 mm or less for power nets into 0.5 mm-pitch LQFP pins; 0.25 mm with 0.15 mm clearance into 0.4 mm-pitch QFN pins.
- Put `copper()` geometry in terms of pad positions (`api.pads`, `api.pbox`, `api.xy`) and assert the geometry it relies on, so a placement change fails the build instead of producing bad copper.
- Start new boards with `COURTYARD_POLYGONS = True` (default): an ESP32 module's courtyard includes its antenna band, and boxes would block half the board.
- Give an autorouter tracks that start and end on track ends or pad centres; Freerouting does not see a T-junction in the middle of a segment as connected.
- Keep 1:1 footprint checks, real part stock and the JLCPCB preview as human steps; say so in the delivery note.
## References
- `references/project-config.md`: every `config.py` field, `parts.json` schema, `extra.py`.
- `references/netlist-dsl.md`: the schematic DSL (`sch.py`), sheets, pins, rules for nets and pin numbers.
- `references/circuit-blocks.md`: how a project uses the circuit blocks, the quick rules and the block index; each block's parts, pinouts, options and placement are in `references/circuit-blocks-buses-motion.md`, `references/circuit-blocks-power.md`, `references/circuit-blocks-io.md`, `references/circuit-blocks-data-radio.md` and `references/circuit-blocks-mouse.md`.
- `references/placement-and-copper.md`: `fixed()`, `PLACE`, the api, copper areas, pairs, keep-outs, mains fence, silkscreen.
- `references/routing-and-checks.md`: Freerouting + finisher, layers 1/2/4/6, critical nets, reading reports, KiCad 10 checks.
- `references/production-files.md`: BOM / CPL / rotations / loose parts, Gerbers, guide PDF, publish, delivery checklist.
- `references/tooling-setup.md`: installing KiCad 10 and the Python packages, `doctor.py`, KiCad 10 python quirks, 3D models, guide PDF, Freerouting, the container, Claude's sandbox.
- `references/lessons-learned.md`: mistakes made and fixed on real boards, and the rule each one produced.
Design rules themselves (stackups, trace widths, decoupling, mains spacing, flex, ESP32, JLCPCB limits) live in the `pcb-design` skill; MCU minimum circuits in `microcontrollers`; circuit sizing in `electronics-fundamentals` and `engineering-calculators`; footprints and symbols missing from KiCad in `kicad-library` (`kicad-library/scripts/fp_gen.py`, `kicad-library/scripts/lib_check.py`); stock and prices of `parts.json` in `parts-sourcing` (`parts-sourcing/scripts/bom_check.py` reads the generated BOM); a KiCad project that was not generated here in `kicad-projects`; firmware in `embedded-firmware`.
## Next step
When this is done, say what comes next: `board-review`, then `parts-sourcing` for stock and cost; the order is placed by a person; `firmware-build` starts from the pin files of the build.