An agent skill for designing and validating printed circuit boards. It uses the open
Agent Skills SKILL.md format, so it works in Claude Code, OpenAI Codex,
Gemini CLI and any other harness that supports skills (and, with one extra line, in those that
don't).
What it covers:
- Stackup (stackup-eda/stackup) KDL as the electrical
source of truth, checked with
stackup check, instead of KiCad schematics - KiCad for layout, routing, DRC and fab output, synced from Stackup
- DC bias checks across the full supply range against worst-case datasheet limits
- SPICE (ngspice through KiCad's bundled libngspice) for power, latch, sense and enable circuits
- Common parts first: judged by stock at Mouser, DigiKey, LCSC and JLCPCB, weighed equally, with the assembler's preferences (such as JLCPCB's Basic library) as a tie-breaker
- MCU pin restrictions (flash, strapping, input-only, dedicated pins) checked before assignment
- Unambiguous BOMs so a fab can buy exactly the right part
skills/pcb-design/
SKILL.md workflow and core rules (loaded when the skill triggers)
references/ read on demand: stackup, dc-bias, spice, parts-sourcing,
mcu-pins, bom-and-fab, kicad, failure-patterns
scripts/
stackup_index.py list the Stackup library's parts and blocks
datasheet.py fetch a datasheet once; read tables as text, render only drawings
jlc_parts.py JLCPCB part lookup: LCSC number, tier, JLCPCB stock
distributor_stock.py Mouser, DigiKey, LCSC and JLCPCB stock and price per MPN (API keys optional)
spice_template.py copy-and-edit SPICE checks for a power latch (insertion/press/shutdown)
spice_lib.py generic models, stimulus, measurements and a corner-matrix runner
ngspice_harness.py run ngspice from Python via ctypes
bom_check.py check a `stackup bom` export for blank or ambiguous lines
footprint_geometry.py measure a footprint (library or on the board) to compare with
the part's package drawing
check_pcb_sync.py CI check that the KiCad PCB matches the Stackup design
tests/ unit tests for the scripts
evals/evals.json test prompts for evaluating the skill
install.sh links the skill into each harness's skills directory
AGENTS.md notes for agents working on this repo (CLAUDE.md, GEMINI.md import it)
.claude-plugin/plugin.json optional: install the repo as a Claude Code plugin
Run the install script from a checkout; it symlinks the skill so updates to the checkout apply everywhere:
./install.sh # Claude Code + ~/.agents/skills (read by Codex and Gemini CLI)
./install.sh codex gemini # or pick harnesses: claude, codex, gemini, agents| Harness | Personal skills directory | Notes |
|---|---|---|
| Claude Code | ~/.claude/skills/ |
Or install the repo as a plugin via .claude-plugin/plugin.json |
| OpenAI Codex CLI | ~/.codex/skills/ or ~/.agents/skills/ |
Invoke explicitly with $pcb-design if needed |
| Gemini CLI | ~/.gemini/skills/ or ~/.agents/skills/ |
|
| Other Agent Skills harnesses | their skills directory | Copy or link skills/pcb-design/ |
Codex and Gemini CLI both read ~/.agents/skills/, so linking into their own directory as well may
make the skill appear twice. For a single project, link it into that repo's .claude/skills/,
.codex/skills/, .gemini/skills/ or .agents/skills/ instead.
Harnesses without skill support: add a line like this to the global or project instruction file
the harness reads (AGENTS.md, GEMINI.md, .cursorrules, and so on):
For any PCB or electronics hardware work, first read ~/repos/pcbskill/skills/pcb-design/SKILL.md and
follow it, reading its references/ and using its scripts/ as it directs.distributor_stock.py checks stock and price at Mouser, DigiKey, LCSC and JLCPCB. LCSC and JLCPCB
need no key. Mouser and DigiKey need free API credentials; without them the script reports those
two as "no key" and checks LCSC and JLCPCB only, so set them up to get the full picture.
-
Get the credentials:
- Mouser: sign in at the Mouser API Hub and request a Search API key.
- DigiKey: at developer.digikey.com, create an organization and a Production app with the Product Information v4 API, then copy its Client ID and Client Secret.
-
Put them in
~/.config/pcb-design/api-keys.env, oneKEY=valueper line, and make the file readable only by you:mkdir -p ~/.config/pcb-design cat > ~/.config/pcb-design/api-keys.env <<'EOF' MOUSER_API_KEY=your-mouser-search-api-key DIGIKEY_CLIENT_ID=your-digikey-client-id DIGIKEY_CLIENT_SECRET=your-digikey-client-secret EOF chmod 600 ~/.config/pcb-design/api-keys.env
Keep this file outside every repository so the keys never get committed. Blank lines,
#comments,exportprefixes and quoted values are all accepted. -
Check it:
python3 skills/pcb-design/scripts/distributor_stock.py AO3401Ashould show stock from all three distributors.
Environment variables with the same names (MOUSER_API_KEY, DIGIKEY_CLIENT_ID,
DIGIKEY_CLIENT_SECRET) take precedence over the file, so you can set them in your shell profile or
a secrets manager instead. To keep the file somewhere else, point PCB_DESIGN_KEYS at it, or pass
--keys <path> to the script.
python3 -m unittest discover -s tests -v
python3 skills/pcb-design/scripts/ngspice_harness.py --selftestThe simulation tests run against KiCad's libngspice, the PDF tests against poppler, and the
documentation test (the Stackup example in references/stackup.md) against the stackup CLI; each
is skipped when its tool isn't installed. Network lookups (jlc_parts.py, distributor_stock.py,
datasheet.py fetch) are tested with fixtures.