/jitx-skills:jitx-circuit-builderfrom jitx-skills
Builds JITX circuits: declares typed ports/bundles (Power, I2C, RGMII), composes sub-circuits hierarchically, connects nets, places components, and adds passives. Covers Circuit class, nets, placement, and jitxlib-parts passives.
Ships in jitx-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A Circuit composes components and sub-circuits behind typed boundary ports. Verify, test and build each circuit as the base jitx skill describes (Writing good code, Running designs).
from jitx import Circuit, Net
from jitx.common import Power
from jitx.net import ShortTrace
from jitx.units import V, nF
from jitxlib.parts import AtLeast, Capacitor
from jitxlib.protocols.serial import I2C
from .sensor import Sensor # a jitx.Component
class SensorCircuit(Circuit):
vin = Power()
i2c = I2C()
def __init__(self) -> None:
self.u1 = Sensor()
self.GND = Net([self.vin.Vn, self.u1.GND], name="GND")
self.VDD = Net([self.vin.Vp, self.u1.VDD], name="VDD")
self.c_vdd = Capacitor(
capacitance=100 * nF,
rated_voltage_dc=AtLeast(10 * V),
temperature_coefficient_code="X7R",
)
self.c_vdd_st = ShortTrace(self.c_vdd.p1, self.u1.VDD)
self.GND += self.c_vdd.p2
self.SDA = self.i2c.sda + self.u1.SDA
self.SCL = self.i2c.scl + self.u1.SCL
A shared open-drain bus's pull-ups (I2C, MDIO's MIIM.mdio) belong to the circuit that composes the bus (usually the top-level design), never inside one participant; the base skill's grep gates flag r_sda and r_scl outside TOP_LEVEL_PATH.
self once, singly or in a list. A component stored twice (two attributes, an attribute and a list, or a helper's jitx.current.circuit += plus an attribute) fails translation: Child object ... encountered multiple times. An unstored a + b is a lost connection. An unstored component fails the build once its ports join a net (Unable to map local reference), which a TestCase that only instantiates the design misses; unjoined, it only logs lost during instantiation.__init__, with no build() or circuit() methods.Circuit for a circuit and jitx.Component for a part.self.x = self.r1.p2): the build fails with Child object ... has multiple parents. To expose a pin, net it to a boundary port.no_connect() in the component or the circuit holding it. Leave an unused circuit port off every net: no_connect() on one passes translation and a TestCase, then fails the build: Cannot set a module pin as no-connect.Construct JITX objects directly. Never walk a list[dict[str, Any]] spec to emit JITX calls (batch parameters in a frozen dataclass), and don't add to a circuit from a free function (compose a Container member). Worked examples: the base skill's Don'ts and jitx/references/architectural-patterns.md.
A circuit's boundary is typed ports: Power from jitx.common (members Vp, Vn) and protocol bundles from jitxlib.protocols (I2C, SPI, RGMII, MIIM, MDI1000BaseT). Find one with grep -rn "class RGMII" under the venv's jitxlib/protocols and read its module path, members and constructor options (SPI(cs=True) adds cs); never write them from memory.
A port nets only to a port of the same concrete type and parameters: + between two Power ports joins them member for member, and Power + I2C raises ValueError: Incompatible ports on Net. + pairs members by name, so cross members named per device: UART tx to rx, LanePair TX to RX. RGMII connects by name: RGMII.Standard.Constraint pairs src.TX with dst.TX. SI constraints and topology are jitx-interconnect-constraints.
class EthernetPort(Circuit):
vin = Power()
rgmii = RGMII()
miim = MIIM()
def __init__(self) -> None:
self.reg = RegulatorCircuit()
self.phy = PhyCircuit()
self.jack = RJ45Circuit()
self.VIN = self.vin + self.reg.vin
self.VPHY = self.reg.vout + self.phy.vin
self.RGMII = self.rgmii + self.phy.rgmii
self.MIIM = self.miim + self.phy.miim
self.MDI = self.phy.mdi + self.jack.mdi
A parent wires its children's boundary ports to each other and to its own. It never nets into a child's components, and a child never reaches up: a pin the parent needs is a boundary port of the child. SI constraint ends, a verification design's placement and its proof routes may still name a child's pads (jitx-interconnect-constraints, "Choosing the ends"), and so may a ShortTrace whose end would be a child's boundary port spanning several pads: it names one of the child's pads (below).
self.reg = RegulatorCircuit().at(10, 5, rotate=90) # fixed, in this circuit's frame
self.jack = RJ45().at(0, 0, on=Side.Bottom) # Side from jitx.layerindex
self.phy = PhyCircuit().at(floating=True) # Circuit only: placed interactively
A sub-circuit without .at sits at its parent's origin on top. A circuit's .at places only its frame: a component inside it with no .at of its own is left to the placer. Until a placement is stored, a floating circuit sits off the board: routes stay unrealized and pours Empty() while the build reports status: ok. That trap, relative placement (Circuit.place) and code-placed vias are jitx-code-layout.
Net(...) takes one iterable of ports, so a whole rail goes on in one call; a bare port raises TypeError.
A net's exported name comes from the highest circuit that joins it. Without name=, it is the name of the field that stores the net: self.RESET_n = a + b is RESET_n, a list in self.CA gives CA[0], CA[1] and so on, and a list of lists in self.DQ gives DQ[0][1]. A bundle net exports one net per member: self.CK on a diff pair gives CK_p and CK_n, self.VSYS on a Power gives VSYS_Vp and VSYS_Vn. The highest circuit's name wins even over a child's name=, so a catch-all field in the joining circuit (self.nets = [...]) renames every net it touches nets[0], nets[1], whatever the children called them. A sub-circuit's net that no parent joins keeps its own name when no other instance exports that name; two sibling instances x and y of a circuit with net E give x_E and y_E. A net added with self += a + b is stored in no field and exports under an internal name (_Circuit__iliad[0]). A name= may match a public port's name. Store each signal, or each group of like signals, in its own field named for it, in the highest circuit that joins it; in a loop, keep one list per signal role (self.TX_P, self.TX_N).
Power and ground get net symbols in the top-level design (the circuit a Design builds, in a file under TOP_LEVEL_PATH, default designs/): GroundSymbol() on each ground domain and PowerSymbol() on each power rail, both from jitxlib.symbols.net_symbols. The base skill's grep gates fail a symbol anywhere else, so a sub-circuit's code puts no symbol on its rails, including one made and used inside it (an LDO's local 1V8), and names them by their field. A symbol on a bundle net raises ValueError: Cannot set symbol on bundle net, so keep the rail a bundle net and put the symbol on a net of one member, stored after the bundle in the field that names the rail:
self.VSYS = self.reg.vout + self.mcu.vin + self.sensor.vin
self.P3V3 = Net([self.reg.vout.Vp], symbol=PowerSymbol())
self.GND = Net([self.reg.vout.Vn], symbol=GroundSymbol())
The rail exports as P3V3 and GND, with a symbol at each part on it; the bundle's field name (VSYS) does not export. With the symbol net stored after the bundle, its field names the whole rail, so a bundle in self.P3V3 with its symbol net in self.P3V3_SYM exports P3V3_SYM.
+= takes a port or a Net, never a bare list:
self.GND = Net([*self.u1.GND, *self.u1.RSVDGND], name="GND")
self.GND += [*self.u1.AGND] # WRONG
self.GND += Net([*self.u1.AGND]) # RIGHT
Pyright reports Operator "+=" not supported and instantiation raises InstantiationException wrapping ValueError: Incompatible ports on Net: Port and list. Onto an empty Net(name="GND") pyright is silent, a TestCase passes, and the build fails with TypeError: unhashable type: 'list'.
Assert membership over list(net), never with in: Net.__contains__ stops at the first nested net, so a port after it reports False. Count against the pinout's balls plus other parts' pins: len(list(net)) catches a lost ball:
self.assertIn(self.u1.VCCINT[0], list(circuit.V1V0))
self.assertEqual(len(list(circuit.GND)), 30)
A bundle net lists its bundles. Assert that, then that each child's boundary member reaches the component pin.
Assert each net's exact members (assertCountEqual over list(net)), not only assertIn: an extra port, such as a regulator's input shorted onto its output rail, passes every assertIn. Where a short would be quiet, assert it away (assertNotIn(self.reg.vin, list(self.VSYS))).
Resistor, Capacitor and Inductor from jitxlib.parts take jitx.units quantities (a bare number is ohms, farads or henries). Bounds are AtLeast and AtMost from jitxlib.parts; a bare value is an exact match. The project's provider chain resolves them: base skill Install Step 2 and Parts and Providers.
Filter only on columns the approved CSV has, with bounds its rows meet: read it first. A query the CSV cannot meet (tolerance=AtMost(0.01) on an X7R whose rows are 10 to 20 percent) falls through to ideal, which returns an IDEAL- part honoring only value, case, tolerance and polarization: dielectric and ratings are silently dropped. Where the CSV lacks a column or row the design needs, ask for it rather than writing the key.
State what the circuit depends on:
tolerance=AtMost(0.01) on every resistor whose value matters; a capacitor tolerance only where the circuit needs one.temperature_coefficient_code="X7R" (or "X5R", "C0G") on every ceramic. Unconstrained, Y5V or Z5U can come back.rated_voltage_dc=AtLeast(...) derated for DC bias: 10 V or 16 V on a 3.3 V rail.max_power=AtLeast(...) on a resistor that dissipates.Leave case= off each passive, never a proxy for a power or voltage rating. Where the assembler sets a minimum package, state it once as a default query on the Design (ResistorQuery and CapacitorQuery from jitxlib.parts) listing every package it accepts, smallest up; one left off is excluded:
class Board(Design):
resistor_defaults = ResistorQuery(case=["0402", "0603", "0805", "1206", "1210"])
capacitor_defaults = CapacitorQuery(case=["0402", "0603", "0805", "1206", "1210"])
A part's query= object or a with block replaces the whole default; its keywords add to it.
A power-rail capacitor is its own attribute on self, its supply-side pad joins the pin it serves through ShortTrace(self.c_x.p1, <the IC power pin port>) and its other pad joins the return net. jitx.net.ShortTrace(p1, p2) takes two ports, each a component pin or a boundary port: never a net (pyright rejects one) or a net's .port (pyright passes; translation fails). A port joined to several pads, such as a FET's two drain pads, names no single pad, yet a ShortTrace to it builds with no warning: end the ShortTrace on a component port mapped to one pad, the larger one when the component model says which (fet.mosfet.D[1], the tab), and never add a port to name that pad. Where the model gives no pad a port of its own, end it on the shared port and list that as an open item.
This covers decoupling, bulk (to the supply pin it serves nearest) and output-filter capacitors (to the regulator output pin); a PolarizedCapacitor uses .a. A bootstrap capacitor takes a ShortTrace to its BOOT pin, other pad to SW per the datasheet; a crystal load capacitor takes one to its crystal pin, other pad to the return net. AC-coupling, RC timing, compensation and RF matching capacitors aren't power-rail; say so for each.
Scale with the pin count, never two caps for a 96-ball core net:
self.c_vccint = [
Capacitor(capacitance=100 * nF, rated_voltage_dc=AtLeast(10 * V), temperature_coefficient_code="X7R")
for _ in fpga.VCCINT
]
self.c_vccint_st = [
ShortTrace(c.p1, ball) for c, ball in zip(self.c_vccint, fpga.VCCINT, strict=True)
]
self.GND += Net([c.p2 for c in self.c_vccint])
Start at one HF cap per one or two core balls plus bulk per rail; fewer is a decision to state, with the count the design wants.
Blocks that differ only in their arguments are one subcircuit with a parameter: three regulator stages differing in output voltage are one Circuit subclass instantiated three times.
evals/cases/constrained-passive-query.json (opens in a new tab)evals/cases/decoupling-scaled-to-pins.json (opens in a new tab)evals/cases/rail-tie-and-connectivity.json (opens in a new tab)evals/cases/reference/rail-tie/check.py (opens in a new tab)evals/cases/reference/rail-tie/design.py (opens in a new tab)evals/cases/reference/typed-ports/check.py (opens in a new tab)evals/cases/reference/typed-ports/design.py (opens in a new tab)evals/cases/repeated-block-extraction.json (opens in a new tab)evals/cases/typed-port-composition.json (opens in a new tab)evals/checks/passive_calls.py (opens in a new tab)evals/eval-contract.yaml (opens in a new tab)evals/routing.jsonl (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jitx-inc/jitx-skills --plugin jitx-skills13 skills in this plugin
/jitxBase skill for JITX Python PCB design: install, the jitx CLI, auth and the runtime, building designs, the viewers, exports, code quality (ruff, pyright, type annotations, check.py and grep gates), and design introspection (jitx.inspect, jitx.query, runtime submit). Use to set up JITX, start the runtime, build or find a design, open the viewer, fix a build or environment error, or find things in a design from Python. Route a whole board from requirements to jitx-project-builder, code self-review to jitx-code-review, component modeling to jitx-component-modeler, wiring and passives to jitx-circuit-builder, stackups to jitx-substrate-modeler, layout in code and realized-geometry checks to jitx-code-layout, open-layout place and route to jitx-interactive-layout, design rules, stitching, fencing and routing structures by tag to jitx-layout-constraints, SI constraints to jitx-interconnect-constraints, pin flexibility to jitx-pin-assignment, mechanical CAD to jitx-mechanical, and JLCPCB fab and parts to jitx-jlcpcb./jitx-code-layoutUse when the user asks to write a fixed PCB layout in Python: place vias, and parts relative to another instance (Circuit.place), code routes through control points (RoutePoint, PairPoint, PairInsertion), Route.Sketch, Route.Config, a Route.Target taper, narrowing a route in a BGA field or a fine-pitch pad, escape or fanout geometry fixed by a stated number or pad geometry, a connector launch on its pad axis, serpentine or deskew settings on a matched section, thermal vias in an exposed pad, pours, keepouts, cutouts, Copper or OverlappableCopper (antennas, net ties), or reading the realized layout back (capture, Empty pours, 'Unable to find path'). Sorts control points between code and jitx-interactive-layout. Tag rules, escape width rules, stitching and fencing go to jitx-layout-constraints; stackups, vias and structure definitions to jitx-substrate-modeler; land-pattern mask, paste and thermal pads to jitx-component-modeler; nets and passives to jitx-circuit-builder; timing to jitx-interconnect-constraints./jitx-code-reviewSame-model self-critique pass for JITX Python code just written in this workspace. Use when the user asks to "review my JITX code", "self-critique", "check JITX conventions", "find string-hacking", "check framework-boundary issues", "audit before merge", or any equivalent. Mandatory for complete-board tier at task acceptance (folds into Think Twice); user-invoked for single-task work. Catches the architectural failure modes that grep gates and static linters miss — parallel string-keyed models, reflection-as-iteration (regardless of whether on self), owner-shaped data misplaced in design code, build-spec-then-iterate, module-import-time parallel models, and framework-boundary-bypass (the "framework does it, therefore so can I" trap). Applies an ownership test to every banned-pattern hit or proposed exception. Produces severity-tagged findings (CRITICAL / WARNING / NOTE) that fold into the task acceptance block./jitx-component-modelerCreate JITX Python component code from datasheets, KiCad footprints, vendor pin files, or user specifications. ALWAYS use this skill when user asks to "create a component", "model a part", "generate a component", "add a component", or "make a JITX component" - even without a datasheet. Also triggers on part numbers (NE555, LM1117, RP2040) and package types (SOIC, QFN, BGA, SON, SOT). Covers JITX generators for standard packages, a vendor's KiCad footprint read directly for non-standard ones, multi-unit symbols, thermal pads, pin mappings, and datasheet checks with jitx.test.TestCase. Also covers generating from a vendor's machine-readable pinout file rather than a drawing ("generate the FPGA from the pin file", "parse the package pinout file", "model this 1000-ball BGA"): parse-don't-transcribe, reconcile the ball inventory before emitting, and a committed generator with a regenerate-and-diff check. For choosing and placing an ordinary queried passive, use jitx-circuit-builder instead./jitx-interactive-layoutUse when the user asks to place components, route nets, drop vias, add pair insertions or route points, or draw pours in the open board layout from a script, so the result stays editable in the board editor: place and route a board or circuit, fan out a BGA, route DDR byte lanes, change a layout the user edited by hand, fix blocked routes, report layout issues or skew margin. Runs Python against a live design through jitx design session and jitx design exec, with the rd.layout requests (place, route, via, route_point, pair_insertion, region, modify, delete), and reads the result back through route status, rd.issues() and the bundled checks. Assumes the layout constraints are already in the design. Design rules, net classes, tags and escape-width rules in code belong to jitx-layout-constraints; decoupling modules to jitx-circuit-builder; copper, code-placed vias, code Route objects and control points in code to jitx-code-layout; topology, timing and skew constraints to jitx-interconnect-constraints./jitx-interconnect-constraintsUse when the user asks about timing constraints, skew matching, insertion loss limits, pin models (bridging, terminating, via models), proving that an SI constraint applied, or debugging a constraint that does not measure in the design issues report. Also covers differential pairs, DiffPair bundles, skew across a bundle or against a clock, protocol constraints for PCIe, USB, DisplayPort, RGMII, Ethernet, DDR, reference planes, length matching, impedance-controlled routing, SignalConstraint definitions, and daisy-chain or flyby topologies built with the double-greater-than operator. Covers Topology, Constrain, ConstrainDiffPair, ConstrainReferenceDifference, DiffPairConstraint, BridgingPinModel, TerminatingPinModel, ReferencePlanes, and protocol-specific constraint patterns. Trace width and clearance rules belong to jitx-layout-constraints. Pin muxing and lane or polarity swappability belong to jitx-pin-assignment. Stackups and routing-structure definitions belong to jitx-substrate-modeler.Other plugins' skills for the same job