pcb-design
Skill0 starsChanged 4 months agoMITView on GitHub
Design printed circuit boards end-to-end with a code-first KiCad workflow: define a board from a single Python spec, generate the .kicad_pcb, solve controlled impedance against a real fab stackup, autoroute, gate against per-fab manufacturability rules, and export fabrication outputs -- all from the command line, no GUI clicking. Use for ANY PCB task: new board design, schematic/netlist capture, component placement, layout, routing, stackup and impedance, differential pairs, DFM/DFA review, fixing fab DFM flags, power/RF/switching-regulator layout, flex and rigid-flex, HDI/microvias, thermal and creepage sizing, or generating fab packages. Any layer count from 2 to 32; pluggable fab profiles (JLCPCB, PCBWay, PCB Power, OSH Park, AISLER, Eurocircuits).
6 other projects use a version of this.
Adopted by
Most recently taken up by
- Nexus-Organization-Infosec/ClaudeSkillstheir own version, first seen Nov 29, 2026
- YUVARAJ-R-ai/my-claude-skillstheir own version, first seen Nov 29, 2026
- makoshan/vibehw-stacktheir own version, first seen Nov 22, 2026
- oaslananka/kicad-mcp-protheir own version, first seen Oct 13, 2026
- skycmoon/skillstheir own version, first seen Oct 6, 2026
- Maxpeng59/Claude-pcb-design-skilltheir own version, first seen Jun 23, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- oaslananka/kicad-mcp-pro★ 247same name
- makoshan/vibehw-stack★ 35same name
- Maxpeng59/Claude-pcb-design-skill★ 2same name
- YUVARAJ-R-ai/my-claude-skills★ 2same name
- Nexus-Organization-Infosec/ClaudeSkills★ 1same name
- skycmoon/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 57
Close KiCad: before building — it locks the board file.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PCB Design (code-first KiCad workflow)
Design manufacturable PCBs as code. One board_spec.py describes the board; shared scripts
generate the KiCad board, autoroute it, gate it against the chosen fab's real rules, and emit a
fab package. Distilled from a real multi-revision hardware project and hardened against the
defects that project actually hit.
Mental model
board_spec.py is the source of truth. The authoritative netlist is each footprint's
pad→net map. The schematic is optional documentation, not the driver. You think in
board-local millimetres (origin top-left, +x right, +y down) and let the scripts emit valid
KiCad.
The skill is not copied per board. It lives once at ~/.claude/skills/pcb-design/; each
board keeps only its board_spec.py in hardware/<board>/_tools/. Copying a toolchain between
board revisions is what produced eight separate stale-geometry failures on the source
project — each copy froze the dimensions of the revision it came from.
Workflow — one command
python <skill>/scripts/pcb.py new myboard # scaffold hardware/myboard/
cd hardware/myboard/_tools # edit board_spec.py
python <skill>/scripts/pcb.py doctor # WHAT HAVE I FORGOTTEN?
python <skill>/scripts/pcb.py check # every gate, no routing (seconds)
python <skill>/scripts/pcb.py place # assisted placement -> paste coordinates
python <skill>/scripts/pcb.py build # generate -> route -> DFM -> fab packagepcb.py dispatches each step to the right interpreter automatically. Generators need system
Python and anything touching board geometry needs KiCad's bundled Python; getting that wrong
used to be a confusing failure, and remembering which is which for twenty scripts is not
something anyone should have to do. The individual scripts still work standalone.
doctor is the one to run first and often. check reports ERRORS — things that are wrong.
doctor reports OMISSIONS — things you never knew to do, which fail silently: an antenna with
no keepout, a QFN wired by pad number, a THT connector left in the assembly list, a 4-layer
board with no stackup. Nothing errors on any of those. The board is just worse, and you find out
at the fab, at the bench, or never. Each finding says what is missing, why it matters, and the
exact line to paste.
Close KiCad before building — it locks the board file.
The five non-negotiables
- Antenna keepout. A PCB or chip antenna needs NO copper — no pour, tracks, or vias — under
or beside it, on every layer. A ground plane under an antenna does not degrade it, it
kills it. Encode it as a
KEEPOUTSentry. This is the #1 first-board killer. - Decoupling and bulk caps at the pin. Placement is the function, not decoration. A bulk cap far from the load arrives too late to do anything about a transient.
- Connect by pin NAME, never pad number. Give every multi-pin IC a
parts/definition and aPARTSentry, then wire{"G1": "GATE"}rather than{"6": "GATE"}. Pad numbers carry no meaning, so nothing can check them; a wrong pad map passes DRC, passes DFM, and only fails when the assembled board doesn't work. Generate non-trivial footprints withgen_footprint.pyrather than drawing pads by eye — and still do the 1:1 paper print test. - Switching-regulator loops: hand-route them. Freerouting optimises for completion, not loop
area. Pre-place the hot loop in
SEGMENTS/VIAS; let the router do signals. - Derive geometry, never hard-code it. Board size from Edge.Cuts, keepouts from the spec. No literal board dimension belongs in any check.
Three rules earned the hard way
- A guard that never fires looks identical to a guard that always passes. Every geometric filter must report why it rejected. A coordinate-frame error once disabled two guards completely; it recurred three times before anyone noticed, because "no findings" looked like success.
- Any pass that ADDS geometry must re-run every geometric check. Pipeline order tempts you to assume earlier passes tidied up. They cannot tidy what is added after them.
- When adding a check, verify it against a known-bad input. Restore the bad coordinates and
watch it fire.
tests/test_board.pydoes exactly this for every gate.
What is where
scripts/pcb.py | the front door — new/doctor/check/place/build, right interpreter automatically |
scripts/parts.py + parts/ | connect by PIN NAME, not pad number — kills the wrong-pinout bug class |
scripts/check_netlist.py | real ERC from pin types: output conflicts, undriven power, floating inputs |
scripts/gen_footprint.py | IPC-7351B land patterns computed from datasheet dimensions |
scripts/place_assist.py | force-directed placement — stop typing x,y for every part |
scripts/add_pin1_silk.py | replaces pin-1 marks the DFM silk cleanup necessarily deletes |
scripts/config.py | KiCad + skill + board discovery, fab selection, build manifest |
scripts/spec.py | validates board_spec.py against the fab profile |
scripts/gen_pcb.py | board generator (any even layer count 2–32, emits the stackup) |
scripts/gen_dru.py | fab rules → .kicad_dru, enforced by KiCad's own DRC |
scripts/check_fab_dfm.py | the checks KiCad structurally cannot do |
scripts/impedance.py | microstrip/stripline/coplanar solver, both directions |
scripts/ipc.py | IPC-2221/2152 conductor sizing, IPC-2221 spacing, via ampacity |
scripts/geometry.py | pure 2D geometry, no KiCad dependency |
scripts/kicad_api.py | the only module that imports pcbnew |
scripts/layers.py | canonical KiCad layer table |
fabs/ | one file per fab; all manufacturing numbers live here as data |
tests/ | 170 unit + 18 board tests, incl. regression fixtures per historical defect |
Reference (read on demand)
reference/failure-catalogue.md— every defect this toolkit was built to catch, each with the check that now catches it. Read this before designing anything non-trivial.reference/stackup-impedance.md— stackups, controlled impedance, diff pairs, length matching.reference/methodology.md— the phased, checkpoint-driven process.reference/design-rules.md— power tree, decoupling, planes, switching loops, RF keepout.reference/dfm-rules.md— fab DFM rules and the false-positive catalogue.reference/fab-gate-checklist.md— the pre-order checklist.reference/kicad-cli-cheatsheet.md— CLI surface, KiCad 10 facts, freerouting.reference/parts-sourcing.md— Basic vs Extended, LCSC, lean-BOM defaults.
Known limits (read before trusting it)
- Routing is freerouting, which is mediocre. On a dense board KiCad's interactive
push-and-shove router plus a human is faster and deterministic. Use
build.pyfor signals, hand-route anything geometry-critical. place_assist.pygets you ~80% of a placement, not a finished one. It knows nothing about thermal zones, mechanical fit, or which way a connector faces. Pin those withPLACE_FIXED.- Impedance is closed-form IPC-2141, not a field solver. Cross-check against the fab's calculator before ordering a controlled-impedance board.
- No simulation — no SPICE, no IR-drop, no thermal, no EM.
- Four of six fab profiles are unverified conservative placeholders (JLCPCB and PCB Power are
researched);
fabs/<name>.pyrecordsverifiedfor each. - Some spec keys are declared but not yet acted on — flex/bend zones, thermal currents,
diff-pair geometry, length matching, connector pitches, non-LCSC BOM. They are marked
NOT YET IMPLEMENTEDinboard_spec.example.py, anddoctorsays so if you fill one in.
Requirements
KiCad (provides kicad-cli and a bundled Python with pcbnew), Java for the bundled
freerouting.jar, and a system python3. Run python scripts/check_prereqs.py to verify.
Developed and tested against KiCad 10.0.3 on Windows; Linux/macOS detection is best-effort —
set KICAD_DIR if KiCad isn't found.
KiCad 11 warning. The SWIG
pcbnewbindings this toolkit uses are deprecated as of KiCad 9 and removed in KiCad 11. Their replacement (the IPC API) requires a running KiCad and so cannot drive a headless pipeline. Everypcbnewcall is confined toscripts/kicad_api.py, so the migration is a one-file job — but it will be needed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

