/jitx-skills:jitx-code-layoutfrom jitx-skills
Writes fixed PCB layouts in Python: places vias and parts relative to instances, routes through control points (RoutePoint, PairPoint, PairInsertion), configures Route.Sketch/Config/Target tapers, BGA escape/fanout, connector launches, serpentine/deskew, thermal vias, pours, keepouts, cutouts, Copper/OverlappableCopper, and reads realized layouts…
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 layout in code is fixed: every build puts its control points and vias where the code says, so first decide which a designer will move (Code or designer). Read the result back from the capture: status: ok does not mean the copper exists. Explanation: Layouts from code, Pours.
Invoke the base jitx skill first. Worked patterns are jitxexamples modules, which the base skill's Step 1 installs. If a named module is missing, the installed copy predates it: rerun that step's jitxexamples line, which upgrades it to the supported release, and if the module is still missing, say so and work from the rules here.
First sort every control point, via and turn:
| Kind | Examples | Where |
|---|---|---|
| Fixed by geometry or a stated number | a connector exit on the pad axis, the split at a ball-field edge, thermal vias in a pad | code |
| A designer's choice | fanout via positions, escape bends, sketch turns | the interactive layout (jitx-interactive-layout), or code in a function named and documented as designer-placed (designer_placed_fanout_points in qfn_thermal_and_power_fanout) |
See Interactive edits. Keep width, structure, net and layer in code even where positions go to the designer, and name the routes that end on each designer-owned point: they go with it.
.at placement is jitx-circuit-builder. Place parts and the copper that depends on them in one circuit, so they move together.self.place(child, (x, y), relative_to=other) records a placement request without changing the child's transform, and sets a child circuit floating: use it only to place relative to another instance..at(floating=True) with no stored placement sits off the board: its routes do not realize and its pours come back Empty(). A headless check gives every circuit a position.jitx-substrate-modeler); code places instances. Join a power or ground via with net += via; PortAttachment binds a signal port to a control point or signal via.self: geometry reachable only through a net drops out of exports.jitx-layout-constraints), never a hand-placed grid.Route(source, destination, layer, sketch=None, config=None) joins two ports, pads, vias or control points on one layer. Worked pattern: jitxexamples.patterns.code_route_basics.
jitx-layout-constraints), or from Route.Config..port cannot be a Topology end either: constrain between part ports.net += point.port, or a PortAttachment), or the design fails to load ("INVALID-STATE").RoutePoint.pad routes and .port nets; PairInsertion joins .uncoupled.p/.n legs to .coupled; PairPoint joins coupled sections at .front and .back. Attach a pair in [p, n] order and set handedness with invert= (which ends join: the PairInsertion docstring). A reversed attachment order builds and makes no copper. "Code route dropped: its ends can never be joined" means a wrong invert= or end.RoutePoint on the axis at the stated length: the route to it is straight. For a tangent bend after it, tag a GND Copper square inside the turn, running from the RoutePoint with its near side the clearance off the line's copper (nearer leaves the route unrealized); its tag's clearance rule to the line's tag is at least the structure's and outranks any rule between the line's tag and a tag reaching the square (priority): the line bends about the square's corner at half its width plus the clearance. One square, inside only; a route KeepOut's edge gets no clearance. Worked pattern: jitxexamples.patterns.rf_connector_launch.Route.Sketch(Route.Sketch.Terminal(start), turns, Route.Sketch.Terminal(end)) tells the router which side of an obstacle to pass. A turn is a side hint, not the waypoint its Route.Sketch.turns docstring describes: the route bends only as far as the obstacle needs, so moving a turn further out buys no margin (a tag clearance to the obstacle does). Turns are read in the declaring circuit's frame. Report where the copper passed from the captured trace, not the turns.
Route.Config overrides the rules for one route. trace_space is also the pour's pullback. Leave Route.Config.pour unset: fill around a route with a Pour.
A Route.Target that differs from the trace width tapers the whole route it is on: Route.Target.rectangle realizes as one polygon widening linearly to the target's extent across the trace, with no drawn trace width. To taper only at the pad, split at a RoutePoint and put the target on the short last route (code_route_basics). A taper suits widening into a wider pad but cannot hold a width over one: for copper narrower than the pad, split at a RoutePoint at least half the wide width past the pad edge and give the short route its own width.
Where the full structure does not fit (a BGA ball field, a fine-pitch pad row), split the route at a RoutePoint or PairPoint and tag the narrow route. The tag's routing_structure rule must outrank the net's (priority). Split just outside the field or row, so the full section clears the last pads. Worked patterns: jitxexamples.patterns.hex_bga_escape, jitxexamples.patterns.layout_routing_structure_by_tag.
An impedance lookup (substrate.differential_routing_structure(100 * ohm), or a protocol constraint given no structure) returns a structure whose impedance fits; two structures sharing an impedance make the result depend on declaration order. Give a narrow structure an impedance no lookup window admits (hex_bga_escape gives its neck 0 ohm).
Matched length is a timing constraint (jitx-interconnect-constraints), never a meander drawn in code. A section with Route.Config(envelope_overhead=w) may meander within w beyond its own copper, half each side, until the route meets its timing constraint; zero turns matching off, as does no Config without an interactive envelope. Worked patterns: jitxexamples.patterns.serpentine_sections, jitxexamples.patterns.wilkinson_tree.
RoutePoints or PairPoints, which resize to fit the envelope. A small pad leaves no room (UnsquiggledRoute); a matched coupled section between two PairInsertions does not route.UnmetTime, UnmetTimeDiff) with routing "Satisfied": widen the envelope, or put the delay in another section. The router stops at the low edge of the timing window.Route carries: serpentine_params(min_pitch=...), coupled_pair_params(deskew_bump_radius=..., min_bump_spacing=...). min_pitch and deskew_bump_radius are lower bounds on the router's choice (their docstrings). The router does not hold min_radius or max_bump_length: never claim either without reading the arcs.rd.issues().| Construct | Net | For |
|---|---|---|
Pour(shape, layer=, rank=) | net += pour | a plane or shaped fill, cut around other copper |
Copper(shape, layer=) | net += copper | a fixed shape on one net |
OverlappableCopper(shape, layer=) | none | copper over other nets' pads: a net tie, an antenna; the router and overlap checks ignore it |
KeepOut(shape, layers=, pour=, via=, route=) | never | keeps pours, generated vias or traces out; set a flag |
Cutout(shape) | none | a routed slot |
Empty() with status: ok, and stitch or fence vias do not hold it. Anchor each layer's pour, for example with one through via on the net. Worked pattern: jitxexamples.patterns.board_ground_pours.min_copper_edge_space or a larger IsBoardEdge rule (jitx-layout-constraints).KeepOut(pour=True) removes pour copper at every rank. KeepOut(via=True) blocks generated vias, fence vias included, not code-placed ones: hold other-net copper off a fenced line with a tag clearance rule instead (fencing). A pour does not avoid OverlappableCopper: add a coincident KeepOut(pour=True).Pour equal to it on its layer or the next (fencing); where the body's pour keepout empties it, its fence stands.OverlappableCopper connects only through the pads it overlaps; for the router to count two same-net pads joined by it, declare a VirtualConnection (jitx.virtual); on a constrained path give it a PinModel with the leg's electrical delay, not one from its drawn length.jitx.shapes.composites first; ShapelyGeometry(g) wraps shapely, .to_shapely() converts back. Use only a non-empty Polygon or MultiPolygon. .at(scale=(1, -1)) does not mirror: transform the geometry.Vias in one exposed pad at a stated pitch are placed in code, not by a stitch_via rule (jitx-layout-constraints). Worked pattern: jitxexamples.patterns.qfn_thermal_and_power_fanout; its thermal_via_grid spreads the vias over the span, so for a stated pitch place the centres at the pitch.
via_in_pad yourself and refuse a false one.jitx-component-modeler); worked pattern: qfn_thermal_and_power_fanout.thermal_pad_opening.JITX raises no issue for these; keep the design's copper at or above its fabricator's limits:
min_pitch at or above one segment's copper plus min_copper_copper_space.min_copper_* floors.min_copper_edge_space.Compare structures and realized copper with rd.root.substrate.constraints. A structure below the floors that the substrate or user states is an open item naming who must accept it; any other miss fails.
A check proves every requested property from the capture: with jitx.runtime as r: rd = r.submit(MyDesign), rd.capture(), read, assert, exit nonzero on failure. Take expected values from the request, documents and geometry, never from your own code's constants.
| Claim | Read and assert |
|---|---|
| A route exists | route.status.routed and non-empty route.traces (two for a coupled section) |
| Width, layer | each captured trace's shapes: width equal to the structure's, or the larger of the Config's and min_copper_width, on the named layer, not read from the authored Route |
| A pour fills | Pour.shape: Empty() means removed (test before .to_shapely(), which raises on it); otherwise the computed copper with holes, and the realized edge gap |
| Generated vias | rd.query(Via) less the code-placed ones visit(rd.root, Via) lists, by identity; assert counts per row or region |
| Net | rd.nets.find(obj).name on pours, vias and each trace of a pair |
| Issues | rd.issues(): routing ("Unable to find path for requested route"), timing (UnmetTime), UnsquiggledRoute |
| A distance | between captured shapes; arcs via ShapelyGeometry.from_shape(shape, tolerance=1e-4) |
When a route, pour or via did not realize, report it as not done with that evidence, and give the engineer the options (open the obstacle, change layer, move a part) instead of choosing one.
Route.Trace.shapes are in the frame of the circuit that declares the route: apply trace.transform from visit(rd.root, Route). A placed element from visit sits at trace.transform * elem.transform. Copper from rd.query and a pour's shape have no transform of their own: apply trace.transform to the shape (trace.transform * pour.shape; the jitx.query docstring). Never read pad.transform alone: a component with several land patterns nests its pads a level deeper.
rd.layout, jitx design session and jitx design exec edit the layout the runtime holds: jitx-interactive-layout (what an edit cannot change).
Dragging a control point, turn or width in the board view is untested: never report one as working unless you did it.
The completion gives:
evals/cases/board-ground-pours.json (opens in a new tab)evals/cases/fixtures/board-ground-pours/fixture_board_ground_pours.py (opens in a new tab)evals/cases/fixtures/common/cl_launch_board.py (opens in a new tab)evals/cases/fixtures/common/cl_parts.py (opens in a new tab)evals/cases/fixtures/common/cl_phy_board.py (opens in a new tab)evals/cases/fixtures/common/cl_substrate.py (opens in a new tab)evals/cases/fixtures/common/pellingham_cl_fab_sheet.md (opens in a new tab)evals/cases/fixtures/common/pyproject.toml (opens in a new tab)evals/cases/fixtures/hex-bga-escape/fixture_hex_bga_escape.py (opens in a new tab)evals/cases/fixtures/move-this-later/fixture_move_this_later.py (opens in a new tab)evals/cases/fixtures/qfn-power-fanout-geometry/fixture_qfn_power_fanout_geometry.py (opens in a new tab)evals/cases/fixtures/qfn-thermal-vias/fixture_qfn_thermal_vias.py (opens in a new tab)evals/cases/fixtures/rf-connector-launch/fixture_rf_connector_launch.py (opens in a new tab)evals/cases/fixtures/route-around-with-sketch/fixture_route_around_with_sketch.py (opens in a new tab)evals/cases/fixtures/route-config-length/fixture_route_config_length.py (opens in a new tab)evals/cases/fixtures/route-one-layer/fixture_route_one_layer.py (opens in a new tab)evals/cases/fixtures/serpentine-four-sections/fixture_serpentine_four_sections.py (opens in a new tab)evals/cases/fixtures/unreachable-destination/fixture_unreachable_destination.py (opens in a new tab)evals/cases/fixtures/wilkinson-tree/fixture_wilkinson_tree.py (opens in a new tab)evals/cases/hex-bga-escape.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
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-circuit-builderUse when the user asks to "wire up", "connect", "build a circuit", create an "application circuit", declare a circuit's typed ports or bundles (Power, I2C, RGMII), compose sub-circuits into a hierarchy and connect them port to port, "place components" or sub-circuits (fixed or floating), add passives (resistors, capacitors, inductors) or decoupling, or set up power connections. Covers the Circuit class, nets and the + operator, typed ports, hierarchy, placement, and jitxlib-parts passives. Drawing a pour or copper is jitx-code-layout; pour rules are jitx-layout-constraints; provide/require pin assignment is jitx-pin-assignment./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