From diodeinc-pcb-1
Adds ngspice-backed simulation testbench to Zener .zen design files. Guides wiring SPICE models, instantiating modules, and defining tran/DC/PULSE analyses for behaviors like startup, enable, protections.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin diodeinc-pcb-1This skill uses the workspace's default tool permissions.
Add a small ngspice-backed testbench to a `.zen` design.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Add a small ngspice-backed testbench to a .zen design.
Confirm the target is simulation-capable by runnnig a dummy sim. pcb sim <path/to/file.zen> --setup "* empty setup check"
If the SPICE model is missing, add it.
Find a vendor model, download it, or create a simple behavioral model if needed. Wire it through the leaf component with spice_model=SpiceModel(...) before writing the testbench.
Create a focused testbench file.
Use a generic package-local path such as <package>/testbench/test_<scenario>.zen.
Keep the structure simple:
Simulation(...) blockSimulation.setup.
Use raw ngspice for:DCPULSE(...)PWL(...).controltranhardcopytestbench/output/<scenario>.svg.Simulation is a Zener property loaded from @stdlib/properties.zen and attached as a normal top-level object:
load("@stdlib/properties.zen", "Simulation")
Simulation(
name="SIM",
setup="""
* raw ngspice goes here
.control
tran 10u 10m
.endc
""",
)
The setup string is passed through as ngspice input. Put voltage sources, waveform definitions, analysis commands, and plot/export commands there.
"""<Part> <scenario> simulation test."""
load("@stdlib/interfaces.zen", "Ground", "Power")
load("@stdlib/properties.zen", "Simulation")
Target = Module("../Target.zen")
Resistor = Module("@stdlib/generics/Resistor.zen")
VIN = Power(voltage="12V")
VOUT = Power()
GND = Ground()
Target(
name="UUT",
VIN=VIN,
VOUT=VOUT,
GND=GND,
)
Resistor(
name="R_LOAD",
value="10ohm",
package="0603",
P1=VOUT,
P2=GND,
)
Simulation(
name="SIM",
setup="""
* <Part> <scenario>
V_IN VIN GND DC 12
.control
tran 10u 10m
set hcopydevtype = svg
hardcopy output/<scenario>.svg v(VIN) v(VOUT) title "<Part> <scenario>" xlabel "Time" ylabel "Voltage"
.endc
""",
)
If the leaf component does not already expose a SPICE model, add one like this:
VIN = io(Power())
VOUT = io(Power())
GND = io(Ground())
Component(
name="MyPart",
symbol=Symbol(library="MyPart.kicad_sym"),
pins={"VIN": VIN, "VOUT": VOUT, "GND": GND},
spice_model=SpiceModel(
"MyPart.lib",
"MyPart_SUBCKT",
nets=[VIN, VOUT, GND],
args={},
),
)
Load switch enable test:
V_IN VIN GND DC 5.3
V_ON ON GND PULSE(0 0.9V 1ms 10us 10us 3ms 5ms)
Protection threshold sweep:
V_IN VIN GND PWL(0 12 5m 12 5.1m 22 10m 22 10.1m 12 15m 12 15.1m 2 20m 2)
setup.