From diodeinc-pcb-1
Enforces idiomatic style rules for Zener HDL (.zen files): no conditional instantiation, DNP record patterns, component minimization, typed unit configs, naming, gotchas. Use for writing, reviewing, refactoring modules, reference designs, boards.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin diodeinc-pcb-1This skill uses the workspace's default tool permissions.
Prescriptive style rules for `.zen` code. These apply to all modules, reference designs, and board files.
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.
Prescriptive style rules for .zen code. These apply to all modules, reference designs, and board files.
Never use if to create or remove components. Always instantiate every component. Use dnp= to control whether it is populated. This applies to modules, boards, and reference designs, including optional feature blocks.
# BAD
if add_decoupling:
Capacitor(name="C_VDD", value="100nF", package="0402", P1=VCC, P2=GND)
# GOOD
Capacitor(name="C_VDD", value="100nF", package="0402", P1=VCC, P2=GND)
For optional subcircuits controlled by a config, use a record to pair values with DNP state. A zero/disabled config value means dnp=True with placeholder values.
Passive = record(value=typing.Any, dnp=bool)
input_filter = config(Frequency, default="0Hz", optional=True,
help="Input lowpass cutoff. 0Hz disables the filter.")
def input_rc(f):
dnp = f <= Frequency("0Hz")
r = e96(Resistance("100ohm") if not dnp else Resistance("0ohm"))
c = e24(1 / (2 * PI * r * f) if not dnp else Capacitance("100pF"))
return Passive(value=r, dnp=False), Passive(value=c, dnp=dnp)
input_r, input_c = input_rc(input_filter)
Resistor(name="R_IN", value=input_r.value, dnp=input_r.dnp, package="0402", P1=A, P2=B)
Capacitor(name="C_IN", value=input_c.value, dnp=input_c.dnp, package="0402", P1=B, P2=GND)
Fewer parts = simpler BOM, easier assembly, lower cost.
Prefer value-switching over duplicate components. When a config selects between discrete options, use a single component with a computed value — don't instantiate multiple components with opposing DNP conditions.
# BAD: two resistors, one always DNP
Resistor(name="R_STRAP_HI", value="10kohm", P1=STRAP, P2=VCC, dnp=mode != "HIGH")
Resistor(name="R_STRAP_LO", value="100kohm", P1=STRAP, P2=VCC, dnp=mode != "LOW")
# GOOD: one resistor, value changes with config
_strap_value = { Mode("HIGH"): "10kohm", Mode("LOW"): "100kohm", Mode("FLOAT"): "10kohm" }[mode]
Resistor(name="R_STRAP", value=_strap_value, P1=STRAP, P2=VCC, dnp=mode == Mode("FLOAT"))
Leverage internal pull-ups/pull-downs. Many ICs have internal bias on strap pins. If the default state uses the internal pull, don't add an external resistor — just DNP the single resistor for that case.
Use physical types from @stdlib/units.zen for configs. Expose one meaningful parameter (e.g. cutoff frequency), not raw R/C values. Use enum() only for discrete design choices.
# BAD
config("filter_r", str, default="10ohms")
# GOOD
input_filter = config(Frequency, default="0Hz", optional=True,
help="Input lowpass cutoff. 0Hz disables the filter.")
Put calculations in named functions with datasheet references. Snap to E-series with e96() / e24().
def load_r(v_out, v_sense):
"""Datasheet §8.1.1 / Eq 4: V_OUT = V_SENSE × gm × R_L"""
GM = Current("200uA") / Voltage("1V")
return e96(v_out / (v_sense * GM))
Every Power io declares its voltage range via the template.
VCC = io(Power(voltage="2.7V to 36V"))
Use help= when it adds integrator-visible meaning that is not already obvious from the name, type, or default. Omit it when it would just restate those fields.
VDD = io(Power(voltage="3.0V to 5.5V"))
GND = io(Ground)
EN = io(Net, help="High to enable the regulator")
input_filter = config(Frequency, default="0Hz", optional=True,
help="Input lowpass cutoff. 0Hz disables the filter.")
.NET AccessorUse Power/Ground ios directly as pin connections. Never use .NET.
# BAD
Capacitor(name="C_VDD", value="100nF", P1=VCC.NET, P2=GND.NET)
# GOOD
Capacitor(name="C_VDD", value="100nF", P1=VCC, P2=GND)
Beyond the standard conventions (UPPERCASE io, lowercase config):
| Element | Convention | Example |
|---|---|---|
| Internal nets | _ prefix | _VREF, _XI, _RBIAS |
| Component names | Uppercase functional prefix | R_LOAD, C_VDD, U_LDO |
| Differential pairs | _P / _N suffixes | IN_P, IN_N (not _PLUS / _MINUS) |
Don't expose configs for implementation details integrators shouldn't tune: decoupling cap values, passive package sizes, test point style.
Do expose configs for things integrators legitimately need to change: filter cutoffs, output voltage, gain settings, enable/disable optional subcircuits.
if guards on instantiation — use dnp=.NET accessor — use ios directlystr configs for physical values — use typed unitse96() / e24()Power ios via templatehelp= only when it adds non-obvious integrator-facing meaning_P / _N_# pcb:sch comments in syncno_connect pins from Component() pins