Create and design PCB circuits using Python and KiCad with AI assistance. Generate circuits from natural language descriptions, existing documentation, or templates. Search components, manage BOMs, and produce manufacturing-ready outputs.
/plugin marketplace add lumberbarons/lumber-mart/plugin install circuit-synth-plugin@lumber-martThis skill is limited to using the following tools:
reference.mdProfessional circuit design using Python + KiCad + AI. Define circuits in code, leverage pre-made patterns, and generate manufacturing-ready outputs.
Tool Reference: This skill uses circuit-synth, a Python library for programmatic PCB design with KiCad integration.
Additional Resources:
reference.md - Quick reference for commands, patterns, and workflowsCircuit-synth brings software engineering practices to hardware design:
# 1. Install
uv add circuit-synth reportlab
# 2. Create circuit (circuits/my_board.py)
from circuit_synth import circuit, Component, Net
@circuit(name="MyBoard")
def my_circuit():
vcc = Net('VCC')
gnd = Net('GND')
led = Component(
symbol="Device:LED",
ref="D",
value="Red",
footprint="LED_SMD:LED_0805_2012Metric"
)
res = Component(
symbol="Device:R",
ref="R",
value="330R",
footprint="Resistor_SMD:R_0805_2012Metric"
)
# Connect: VCC -> Resistor -> LED -> GND
res["1"] += vcc
res["2"] += led["A"]
led["K"] += gnd
if __name__ == "__main__":
import os
os.makedirs("circuits", exist_ok=True)
my_circuit()
# 3. Generate
# uv run python circuits/my_board.py
# 4. Open in KiCad
# kicad circuits/MyBoard/MyBoard.kicad_pro
That's it! For advanced usage, see sections below or check reference.md.
Use circuit-synth when:
Skip circuit-synth when:
Check if already installed:
pip list | grep circuit-synth
If not installed:
In existing Python project (has pyproject.toml):
uv add circuit-synth
In non-Python project or new setup:
uv init --bare # Creates pyproject.toml
uv add circuit-synth
Fallback with pip:
pip install circuit-synth
Recommended: Install reportlab for PDF schematic generation:
uv add reportlab
# or
pip install reportlab
Without reportlab, you'll see warnings and won't be able to generate PDF schematics.
That's it! No need to ask permission - just provide these commands when needed.
Circuit-synth requires Python 3.12 or higher.
Check Python version:
python --version
# or
python3 --version
If Python < 3.12, inform user and ask if they want to proceed with installation anyway or upgrade Python first.
After installation, you can optionally set up API integrations for enhanced component search:
cs-setup-snapeda-api # Component symbol/footprint search
cs-setup-digikey-api # Component availability and pricing
| Error | Fix |
|---|---|
No module named 'circuit_synth' | Run uv add circuit-synth or pip install circuit-synth |
No pyproject.toml found | Run uv init --bare first, then uv add circuit-synth |
Python version too old | Requires Python 3.12+, upgrade with pyenv or conda |
Most common source of errors! When you get Pin 'XXX' not found errors, the error message shows available pins. Use those names.
| IC Family | Common Wrong Names | Correct Names | Example |
|---|---|---|---|
| 74xx Latches (373, 573) | 1D, 1Q, 2D, 2Q | D0-D7, O0-O7 | D0 for data in, O0 for output |
| 74xx Buffers (245) | DIR, OE | A->B, CE | Direction control renamed |
| 74xx Decoders (138, 139) | 1G, 1A0, 1Y0 | E, A0, O0 | Single decoder uses generic names |
| Polarized Caps | +, - | 1, 2 | Pin 1 is positive, pin 2 negative |
| Generic symbols | Named pins | 1, 2, 3... | Use pin numbers for placeholders |
How to fix: When you see the error, it lists available pins - use those exact names in your code.
# Error says: Available: 'D0', 'D1', ..., 'O0', 'O1', ...
# Wrong:
latch["1D"] += data_in # ❌
# Correct:
latch["D0"] += data_in # ✓
Don't write the whole circuit at once! Build and test incrementally to catch pin name errors early.
Start with just power and one IC:
from circuit_synth import circuit, Component, Net
@circuit(name="Test")
def test_circuit():
vcc = Net('VCC_5V')
gnd = Net('GND')
# Test one IC first
ic = Component(
symbol="74xx:74HC373", # Or whatever you need
ref="U1",
value="Test",
footprint="Package_DIP:DIP-20_W7.62mm"
)
ic["VCC"] += vcc
ic["GND"] += gnd
ic["D0"] += Net('DATA0') # Try connecting one pin
ic["O0"] += Net('OUT0')
if __name__ == "__main__":
c = test_circuit()
c.generate_kicad_project(project_name="Test")
Run: uv run python circuits/test.py
If it fails, read the error:
ComponentError: Pin 'D0' not found in U1 (74xx:74HC373).
Available: 'D0', 'D1', 'D2', ...
Use the available names shown in the error.
Once one IC works, add 2-3 more at a time, testing after each addition.
After running circuit_obj.generate_kicad_project(project_name="MyBoard"):
your-project/
└── circuits/ ← **CIRCUIT FOLDER**
├── your_circuit.py ← Your Python circuit definition
└── MyBoard/ ← **GENERATED HERE**
├── MyBoard.kicad_pro ← Open this in KiCad
├── MyBoard.kicad_sch
├── MyBoard.json
└── MyBoard.net
Open it: kicad circuits/MyBoard/MyBoard.kicad_pro
The circuits/ folder keeps all circuit definitions and generated KiCad projects organized together.
| Error | Cause | Fix |
|---|---|---|
Pin 'X' not found | Wrong pin name | Use exact names from error message |
Symbol 'XXX' not found | Symbol doesn't exist in KiCad libraries | Try similar symbol (74HC139→74LS139) or use generic placeholder |
missing 1 required positional argument: 'project_name' | Forgot parameter | Add project_name="YourBoard" |
No module named 'circuit_synth' | Not installed | Run uv add circuit-synth |
No pyproject.toml found | Not in uv project | Run uv init --bare first |
Fast track for reverse-engineering or using ICs without KiCad symbols:
Don't waste time searching for exact symbols. Start with placeholders:
# Unknown or custom IC? Use Device:C (capacitor) as 2-pin placeholder
custom_ic = Component(
symbol="Device:C", # Quick 2-pin placeholder
ref="U1",
value="ActualPartNumber", # Document the real part
footprint="Package_DIP:DIP-20_W7.62mm" # Use actual footprint
)
# Connect using pin numbers
custom_ic["1"] += vcc
custom_ic["2"] += gnd
# Document actual connections in comments for later
# Pin 1: VCC, Pin 2: GND, Pin 3: DATA0, ... etc
Once schematic is generated:
When to use this: Reverse-engineering projects, obsolete ICs, custom hardware, any time symbol search takes >5 minutes.
Use when: Starting a completely new circuit design
Command:
uv run cs-new-project my_project
What it creates:
my_project/
├── circuits/ # Circuit definitions and outputs
│ ├── main.py # Primary circuit (ESP32-C6 example)
│ ├── [other_circuits].py # Additional circuit definitions
│ └── [ProjectName]/ # Generated KiCad projects
├── .claude/ # AI integration (optional)
│ ├── agents/ # Specialized agents
│ └── commands/ # Slash commands
├── README.md # Project documentation
├── CLAUDE.md # AI-specific guidance
└── [generated KiCad files] # .kicad_pro, .kicad_sch, .kicad_pcb
Generated example: ESP32-C6 minimal board with:
Steps:
cs-new-project project_namecd project_namecat circuits/main.pyuv run python circuits/main.pykicad project_name.kicad_proUse when: You know exactly what type of circuit you need
Command with templates:
# Quick start (no prompts)
uv run cs-new-project my_board --quick
# Select specific templates
uv run cs-new-project my_board --circuits STM32,USB
# Skip AI integration
uv run cs-new-project my_board --no-agents
# Developer mode (extra tools)
uv run cs-new-project my_board --developer
Available templates:
ESP32 - ESP32-C6 minimal setupSTM32 - STM32 minimal configurationUSB - USB-C connectivityPOWER - Power supply circuitsUse when: Adding circuit design to existing firmware/hardware project
Steps:
uv add circuit-synth or pip install circuit-synthuv add reportlab or pip install reportlabmkdir -p circuitscircuits/main.pycircuits/*/*.kicad_pro
circuits/*/*.kicad_sch
circuits/*/*.kicad_pcb
circuits/*/*.json
circuits/*/*.net
*.kicad_prl
*.kicad_sch-bak
circuits/ - Python definitions and generated KiCad projects"Use when: Testing a circuit idea without full project structure
Single file approach:
# circuits/quick_test.py
import os
from circuit_synth import circuit, Component, Net
@circuit(name="QuickTest")
def my_circuit():
# Define circuit here
pass
if __name__ == "__main__":
os.makedirs("circuits", exist_ok=True)
my_circuit()
Run: python circuits/quick_test.py
| User Intent | Workflow | Command |
|---|---|---|
| New standalone circuit project | Workflow 1 | cs-new-project name |
| Known template needed | Workflow 2 | cs-new-project name --circuits TYPE |
| Add to existing firmware project | Workflow 3 | Manual setup + mkdir circuit-synth |
| Quick test / proof of concept | Workflow 4 | Single Python file |
Quick workflow:
Component syntax:
led = Component(symbol="Device:LED", ref="D", value="Red",
footprint="LED_SMD:LED_0805_2012Metric")
led["K"] += gnd # Connect pins to nets
Buses:
data_bus = [Net(f'D{i}') for i in range(8)] # D0-D7
for i in range(8):
buffer[f'A{i}'] += data_bus[i]
See reference.md for detailed examples (LDO regulator, LED circuits, hierarchical subcircuits).
Use when you have firmware code, hardware docs, pinout tables, or datasheets.
Quick workflow:
See reference.md for complete step-by-step workflow with examples.
from circuit_synth import circuit, Component, Net
@circuit(name="MyBoard")
def my_board():
"""Based on PINOUTS.md and code analysis."""
# Define nets from documentation
vcc, gnd = Net('VCC'), Net('GND')
data_bus = [Net(f'D{i}') for i in range(8)] # D0-D7
# Components from doc (use placeholders for unknown symbols)
ic1 = Component(
symbol="Device:C", # Placeholder if symbol unknown
ref="U1",
value="ActualPartNumber",
footprint="Package_DIP:DIP-20_W7.62mm"
)
# Power connections
ic1["1"] += vcc # Using pin numbers for placeholder
ic1["2"] += gnd
# Add more components incrementally...
# connector = Component(...)
# other_ic = Component(...)
if __name__ == "__main__":
c = my_board()
c.generate_kicad_project(project_name="MyBoard")
Key points:
Device:C) for unknown/custom ICsvalue fieldStep 5: Generate and Test
uv run python circuits/my_board.py
Check generated files in MyBoard/ directory, open in KiCad.
Step 6: Cross-Reference
Verify schematic against original documentation:
If working from PlatformIO/Arduino code:
# Find pin definitions
grep -r "define.*PIN" src/ include/
grep -r "const.*pin" src/ include/
grep -r "GPIO" src/ include/
Use these to map hardware connections in your circuit.
1. jlc-fast (Fastest, Zero AI Tokens)
Best for: JLCPCB-specific parts, real-time stock, lowest cost
# Search by description
uv run jlc-fast search "STM32F103C8T6"
uv run jlc-fast search "USB Type-C connector"
uv run jlc-fast search "10uF 0805 capacitor"
# Find cheapest with stock
uv run jlc-fast cheapest "10k resistor" --min-stock 10000
# Search with filters
uv run jlc-fast search "LDO 3.3V" --min-stock 1000
Advantages:
2. /find-symbol (KiCad Symbol Search)
Best for: Finding exact KiCad symbol library references
/find-symbol STM32F4
/find-symbol "USB connector"
/find-symbol "voltage regulator"
Returns: KiCad symbol library paths for use in Component definitions
3. /find-parts (Multi-Source Availability)
Best for: Cross-vendor availability, DigiKey/Mouser comparison
/find-parts STM32F103C8T6
/find-parts "10uF capacitor"
Returns: Availability, pricing, datasheets across multiple suppliers
1. Identify requirement
└─ Component type (MCU, regulator, passive)
2. Search options
├─ Exact part known → jlc-fast search "PART_NUMBER"
├─ Need JLCPCB part → jlc-fast search "description"
├─ Need KiCad symbol → /find-symbol
└─ Multi-vendor → /find-parts
3. Evaluate results
├─ Stock availability (>1000 preferred)
├─ Price
├─ Package/footprint
└─ Datasheet review
4. Find symbol and footprint
├─ /find-symbol if not known
└─ Check KiCad libraries
5. Add to circuit
└─ Component() with full properties
Minimum required:
Component(
symbol="Device:R", # REQUIRED
ref="R", # REQUIRED
footprint="Resistor_SMD:R_0805_2012Metric" # REQUIRED
)
Recommended for BOM:
Component(
symbol="Device:R",
ref="R",
value="10k", # Add value
footprint="Resistor_SMD:R_0805_2012Metric",
datasheet="https://..." # Add datasheet URL
)
Full BOM with sourcing:
Component(
symbol="Device:R",
ref="R",
value="10k",
footprint="Resistor_SMD:R_0805_2012Metric",
datasheet="https://example.com/datasheet.pdf",
manufacturer="Yageo",
mpn="RC0805FR-0710KL", # Manufacturer part number
supplier="JLCPCB",
supplier_pn="C17414", # JLCPCB part number
cost="0.001"
)
| Stock Level | Assessment | Action |
|---|---|---|
| > 10,000 | Very safe | Preferred choice |
| 1,000 - 10,000 | Safe | Good for production |
| 100 - 1,000 | Acceptable | Consider for prototypes |
| < 100 | Risky | Find alternative |
| 0 | Out of stock | Must find substitute |
Power supplies:
jlc-fast search "LDO regulator 3.3V"
jlc-fast search "buck converter 5V"
jlc-fast search "boost converter"
Microcontrollers:
jlc-fast search "STM32F103C8T6"
jlc-fast search "ESP32-S3"
jlc-fast search "ATmega328P"
Connectors:
jlc-fast search "USB Type-C connector"
jlc-fast search "JST connector 2 pin"
jlc-fast search "pin header 2.54mm"
Passives:
jlc-fast search "10uF 0805 capacitor"
jlc-fast search "100nF 0603 ceramic"
jlc-fast cheapest "10k resistor 0805" --min-stock 10000
Seven pre-built, manufacturing-ready circuit patterns:
Quick example:
from buck_converter import buck_converter
buck_converter(vin_12v, vout_5v, gnd,
output_voltage="5V", max_current="3A")
See reference.md for detailed parameters, examples, and customization strategies for each pattern.
1. Bill of Materials (BOM)
Generate CSV with all components:
import os
os.makedirs("circuits", exist_ok=True)
circuit.generate_bom(project_name="circuits/my_board")
Output: circuits/my_board.csv
CSV format:
Reference,Value,Footprint,Quantity,Manufacturer,MPN,Supplier,Supplier PN,Cost
R1,10k,Resistor_SMD:R_0805_2012Metric,1,Yageo,RC0805FR-0710KL,JLCPCB,C17414,0.001
C1,10uF,Capacitor_SMD:C_0805_2012Metric,1,Samsung,CL21A106KAYNNNE,JLCPCB,C15850,0.005
U1,STM32F103C8T6,Package_QFP:LQFP-48_7x7mm_P0.5mm,1,STMicro,STM32F103C8T6,JLCPCB,C8734,2.50
2. Gerber Files
Generate manufacturing files for PCB fabrication:
import os
os.makedirs("circuits", exist_ok=True)
circuit.generate_gerbers(project_name="circuits/my_board")
Output directory: circuits/my_board/gerbers/
Files generated:
my_board-F.Cu.gbr - Front copper layermy_board-B.Cu.gbr - Back copper layermy_board-F.Mask.gbr - Front solder maskmy_board-B.Mask.gbr - Back solder maskmy_board-F.Silkscreen.gbr - Front silkscreenmy_board-Edge.Cuts.gbr - Board outlinemy_board-PTH.xln - Plated through-hole drill filemy_board-NPTH.xln - Non-plated drill file3. PDF Schematic
Generate human-readable schematic (requires reportlab):
import os
os.makedirs("circuits", exist_ok=True)
circuit.generate_pdf_schematic(project_name="circuits/my_board")
Output: circuits/my_board.pdf
Use for: Documentation, reviews, manufacturing reference
Note: Install reportlab first: uv add reportlab or pip install reportlab
4. JSON Netlist
Generate machine-readable netlist:
import os
os.makedirs("circuits", exist_ok=True)
circuit.generate_json_netlist(project_name="circuits/my_board")
Output: circuits/my_board.net.json
Use for: Circuit analysis, custom tooling, verification
To optimize for JLCPCB assembly, include JLCPCB part numbers:
resistor = Component(
symbol="Device:R",
ref="R",
value="10k",
footprint="Resistor_SMD:R_0805_2012Metric",
supplier="JLCPCB",
supplier_pn="C17414" # JLCPCB part number
)
Find part numbers:
uv run jlc-fast search "10k resistor 0805"
# Returns: C17414 (JLCPCB part number)
Before sending to fabrication:
Generate all manufacturing outputs with:
circuit.generate_bom(project_name="circuits/my_board")
circuit.generate_gerbers(project_name="circuits/my_board")
circuit.generate_pdf_schematic(project_name="circuits/my_board")
See reference.md for complete workflow example with error checking and status output.
When circuit-synth skill is invoked:
Check installation
pip list | grep circuit-synthUnderstand user intent
Start incrementally
From natural language:
See reference.md for detailed workflow steps.
From hardware docs:
See reference.md for detailed step-by-step workflow.
Most common: Pin naming errors
For all other errors, see "Common Errors & Quick Fixes" table in the main skill doc.
Create circuit: Check if request matches a pattern (buck, boost, etc.), use pattern if yes, otherwise custom circuit From documentation: Read docs/code, parse connections, generate circuit incrementally Find components: Use jlc-fast for searches, /find-symbol for KiCad symbols
Device:C for unknown ICs, replace later in KiCadvcc_3v3 not net1When using this skill, provide:
Example output:
Created circuit-synth KiCad project:
Files generated:
- circuits/my_board.py (circuit definition)
- MyBoard/MyBoard.kicad_pro
- MyBoard/MyBoard.kicad_sch
- MyBoard/MyBoard.json (netlist)
Circuit includes:
- 3 ICs from documentation
- Power connector
- Bypass capacitors
Next steps:
1. Open: kicad MyBoard/MyBoard.kicad_pro
2. Review schematic connections
3. Replace placeholder symbols with proper KiCad symbols (if needed)
4. Design PCB layout
Warnings:
- Some ICs using generic placeholders (Device:C) - create custom symbols in KiCad
- Verify all connections match original documentation
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.