agentleFS
kamaljavvadi16-altkamaljavvadi16-alt/pcb-design-skill/SKILL.md

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

  • Other versions6 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 6

    1. oaslananka/kicad-mcp-pro★ 247same name
    2. makoshan/vibehw-stack★ 35same name
    3. Maxpeng59/Claude-pcb-design-skill★ 2same name
    4. YUVARAJ-R-ai/my-claude-skills★ 2same name
    5. Nexus-Organization-Infosec/ClaudeSkills★ 1same name
    6. 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
  1. Distinctive:

    Close KiCad: before building — it locks the board file.

    line 57

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 package

pcb.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 KEEPOUTS entry. 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 a PARTS entry, 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 with gen_footprint.py rather 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

  1. 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.
  2. 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.
  3. When adding a check, verify it against a known-bad input. Restore the bad coordinates and watch it fire. tests/test_board.py does exactly this for every gate.

What is where

scripts/pcb.pythe 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.pyreal ERC from pin types: output conflicts, undriven power, floating inputs
scripts/gen_footprint.pyIPC-7351B land patterns computed from datasheet dimensions
scripts/place_assist.pyforce-directed placement — stop typing x,y for every part
scripts/add_pin1_silk.pyreplaces pin-1 marks the DFM silk cleanup necessarily deletes
scripts/config.pyKiCad + skill + board discovery, fab selection, build manifest
scripts/spec.pyvalidates board_spec.py against the fab profile
scripts/gen_pcb.pyboard generator (any even layer count 2–32, emits the stackup)
scripts/gen_dru.pyfab rules → .kicad_dru, enforced by KiCad's own DRC
scripts/check_fab_dfm.pythe checks KiCad structurally cannot do
scripts/impedance.pymicrostrip/stripline/coplanar solver, both directions
scripts/ipc.pyIPC-2221/2152 conductor sizing, IPC-2221 spacing, via ampacity
scripts/geometry.pypure 2D geometry, no KiCad dependency
scripts/kicad_api.pythe only module that imports pcbnew
scripts/layers.pycanonical 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.py for signals, hand-route anything geometry-critical.
  • place_assist.py gets 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 with PLACE_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>.py records verified for 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 IMPLEMENTED in board_spec.example.py, and doctor says 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 pcbnew bindings 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. Every pcbnew call is confined to scripts/kicad_api.py, so the migration is a one-file job — but it will be needed.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.