Update to text-to-cad
Snapshot Nov 23, 2026 · 12:11 UTC · version 0.11.16
Collection source: downloaded plugin package.
Instructions updated for pcb
Full description — Now says: Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts...
Observed in instructions or declared skills. Runtime behavior has not been tested.
Up to 3 plugins free · no card required.
All fields and original values.
Full description
Nov 22, 2026 · 12:12 UTC
Create, edit, lay out and review native KiCad circuit boards (.kicad_pcb) and their schematics (.kicad_sch) - parts and nets, ERC, placement and routing, DRC, and a review before ordering (fab limits, decoupling, track width for current,...
Nov 23, 2026 · 12:11 UTC
Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB...
Skill instructions
Nov 22, 2026 · 12:12 UTC
Create, edit, lay out and review native KiCad circuit boards (.kicad_pcb) and their schematics (.kicad_sch) - parts and nets, ERC, placement and routing, DRC, and a review before ordering (fab limits, decoupling, track width for current,...
Nov 23, 2026 · 12:11 UTC
Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB...
Supporting files
Nov 22, 2026 · 12:12 UTC
[{"relative_path":"LICENSE","size_in_bytes":2230},{"relative_path":"agents/openai.yaml","size_in_bytes":268},{"relative_path":"references/board-api.md","size_in_bytes":4731},{"relative_path":"references/checks.md","size_in_bytes":5844},{...
Nov 23, 2026 · 12:11 UTC
[{"relative_path":"LICENSE","size_in_bytes":2230},{"relative_path":"agents/openai.yaml","size_in_bytes":268},{"relative_path":"references/board-api.md","size_in_bytes":4254},{"relative_path":"references/checks.md","size_in_bytes":5971},{...
Compare saved observations
Download comparison JSONSKILL.md text changes
− removed · + added
--- before +++ after @@ -1,6 +1,6 @@ --- name: pcb -description: Create, edit, lay out and review native KiCad circuit boards (.kicad_pcb) and their schematics (.kicad_sch) - parts and nets, ERC, placement and routing, DRC, and a review before ordering (fab limits, decoupling, track width for current, assembly and BOM sourcing for JLCPCB, PCBWay or another fab); exports fabrication files, the netlist and BOM, or STEP for enclosure design. Shows boards and schematics in the text-to-cad viewer. +description: Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB, PCBWay or another fab, and fabrication files, a BOM, a netlist or a STEP of the board. Not for the enclosure or other mechanical parts, which the cad skill makes. license: MIT metadata: repository: earthtojake/text-to-cad @@ -8,9 +8,27 @@ # PCB design +A board is its native KiCad files: the `.kicad_pcb`, its schematic and its project. text-to-cad reads, +draws and inspects them itself, and runs KiCad headless for everything KiCad owns: ERC, DRC, exports +and edits through its IPC API. There is no board model or build step; the files are the source. + +## Start with the task + +| Task | Start with | Reference | +| --- | --- | --- | +| Read a board or a schematic | `kicad_pcb.read`, `kicad_sch.read` in a script; `cad kicad_pcb inspect` | [Checks](references/checks.md), [schematic](references/schematic.md#read-it) | +| Draw or edit a schematic | `kicad_sch.edit`, then `cad kicad_sch erc` | [Schematic](references/schematic.md) | +| Choose parts and footprints | The datasheet, then the project's libraries | [Parts](references/parts.md) | +| Create or edit a board | `kicad_pcb.edit` ([below](#native-files-are-the-source)) | [Native files](references/board-api.md) | +| Place and route | The schematic's netlist, one functional group at a time | [Layout](references/layout.md), [placement](references/placement.md) | +| Check a change | `cad kicad_pcb drc`, snapshots | [Check each change](#check-each-change) | +| Review before ordering | DRC, then measurements, then the checklist | [Before ordering](#before-ordering) | +| Export fabrication files, a BOM, or a STEP for an enclosure | `cad kicad_pcb export`, `cad kicad_sch export` | [Manufacturing](references/manufacturing.md) | +| Show a board or a schematic; what the person can see or pick in it; a missing 3D model | `cad viewer --json FILE` | [Show the model](#show-the-model), [views](references/views.md) | + ## Setup -Written for `cad==0.11.15`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than +Written for `cad==0.11.16`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than 0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists. If cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin: @@ -18,60 +36,37 @@ A project written for an earlier version may need changes; the migration guides say what: https://github.com/earthtojake/text-to-cad/tree/main/docs/migrations -text-to-cad reads a board or schematic itself, so inspecting either, and viewing a schematic or taking -its snapshot, need no KiCad. DRC (`cad kicad_pcb drc`), ERC -(`cad kicad_sch erc`), every export (`cad kicad_pcb export`, `cad kicad_sch export`) and an edit -(`kicad_pcb.edit`, `kicad_sch.edit`) run KiCad's command line, `kicad-cli`, -and its IPC API from kicode, the `kicad` extra (`cad[kicad]`): the `cad` command installs it the first -time a board command needs it (about 100 MB to download and 340 MB on disk, once; nothing for you to install), and `cad run` gives a -script that edits a board its environment. Showing a board or taking its snapshot needs it too: KiCad -refills the board's copper pours on a copy before they are drawn, so the first board shown starts that -download. `CAD_KICAD_REFILL=0` in the server's environment turns the refill off (no download; set -it as `CAD_KICAD_3DMODELS` below), and the pours are drawn as the file saved them, as they are when the -download or the refill fails. A KiCad you installed yourself is never run. `CAD_KICAD_CLI` can name -another `kicad-cli` (the command line itself, named `kicad-cli`; KiCad 9 or newer, a nightly's for an -edit). It runs headless, with private settings, and never opens KiCad's app; never open a -board in KiCad's app to check it. Its library variables name KiCad's own libraries, never your -variables or KiCad settings: a project's `sym-lib-table` or `fp-lib-table` row that names a stock -library as KiCad's own tables do (`${KICAD10_SYMBOL_DIR}/Device.kicad_sym`, -`${KICAD10_FOOTPRINT_DIR}/Resistor_SMD.pretty`, any major's spelling) reads it in the libraries of the -KiCad you installed (the newest, if several; or the installation whose `3dmodels` folder -`CAD_KICAD_3DMODELS` names): nothing to set. With no KiCad installed, ERC warns `lib_symbol_issues` that -each such library was not found and DRC `lib_footprint_issues` that it is not enabled; a project that -carries its libraries (`${KIPRJMOD}`) needs no KiCad. - -kicode's KiCad is a nightly (10.99), so a board or schematic it saves is in the nightly's format, which a -stable KiCad app refuses; viewing and snapshots still work, and the viewer's Open in says which KiCad on -this computer can open the file. +Reading and inspecting a board or schematic needs no KiCad. DRC, ERC, exports, edits, and drawing a +board (its copper pours are refilled on a copy first) run KiCad's own `kicad-cli` and IPC API, which +`cad` fetches the first time one is needed (kicode: about 100 MB to download, 340 MB on disk, once); +`cad run` gives a script the same. Things to know about that KiCad: + +- **It is a nightly (10.99).** A file it saves is in the nightly's format, which a stable KiCad app + refuses to open; viewing and snapshots still work, and the viewer tells the person which KiCad on + this computer can open the file. Say so before the first save of a board the person opens in a + stable KiCad. +- **It runs headless with private settings**, never the person's KiCad app or its settings: never open + a board in KiCad's app to check it. A project library row that names a stock library as KiCad's own + tables do (`${KICAD10_SYMBOL_DIR}/Device.kicad_sym`) is read from the KiCad the person installed; + with none installed, ERC warns `lib_symbol_issues` and DRC `lib_footprint_issues`. A project that + carries its libraries (`${KIPRJMOD}`) needs no KiCad installed. +- **An edit needs a local socket.** A shell sandbox that refuses sockets (an agent app's default) stops + an edit at once, saying so: run the script outside the sandbox. Inspecting, DRC, exports and + snapshots run inside it. +- **A KiCad the person installed is never run.** Where the fetched one does not run on a computer, + `CAD_KICAD_CLI` names another `kicad-cli` (KiCad 9 or newer; a nightly's for an edit). +- **`CAD_KICAD_REFILL=0` in the server's environment turns the refill off**: showing a board then + downloads nothing, and its pours are drawn as the file saved them. ## Native files are the source -Edit the `.kicad_pcb` itself, preserving its companion `.kicad_pro`, `.kicad_dru`, libraries and -schematic when present. Reading or displaying a board never writes it. There is no text-to-cad PCB -model, build step, or generated-board ownership marker. A helper script may make a requested edit, -but reread the current file before editing and preserve unknown records and UUIDs. Do not regenerate -an existing project from an incomplete description. - -Change a board through KiCad's IPC API in an edit, a `with` block: `kicad_pcb.edit` hands the block the -open board (KiPy's `Board`, as kicode names it: `kicode.board.Board`) and saves it at the block's end -when the block changed it; a block that changes nothing leaves the file byte for byte, one that raises -saves nothing (its exception goes on), and a save KiCad cannot finish leaves every file as it was, -saying why. A board not there yet is made by KiCad, with its project, -and saved. `kicad_sch.edit` does the same for a schematic ([schematic](references/schematic.md#edit-it)); -the two of one project, one inside the other, share one KiCad. Run the script with `cad run board.py`, -which gives it the `kicad` extra (kicode: KiPy and a `kicad-cli` with its headless `api-server`); a -`kicad-cli` that `CAD_KICAD_CLI` names without one is refused up front, before any server starts. That -server listens on a local socket, which a shell sandbox that refuses sockets (an agent app's default, Codex's -among them) does not allow: the edit then stops at once, saying so, and the script must run outside the -sandbox (ask for the unsandboxed or escalated run); inspecting, DRC, exports and snapshots run inside it. -KiCad's first start from a new environment can take a minute, which the edit says while it waits. Import -KiPy's names from `kicode` (`from kicode.proto.common.types import KIID`, `from kicode.util.units import -from_mm`), never from `kipy`: the two cannot share a process. Saving writes the file in the nightly's -format: one from an older KiCad is upgraded, which the run says, and that older KiCad can no longer open -it. Checks and exports of the saved board are calls after the block (`kicad_pcb.drc`, `kicad_pcb.export`); -a STEP or GLB export holds each part's 3D model where the board's 3D view finds it ([board -views](#board-views)), and leaves out, naming them, the parts whose model is missing (or, in a STEP, only in -VRML); `--to dxf` writes the outline and drilled holes, for an enclosure: +Edit the `.kicad_pcb` itself and keep its `.kicad_pro`, `.kicad_dru`, libraries and schematic beside +it. Reading or showing a board never writes it. Reread the file before an edit, preserve records and +UUIDs you do not understand, and never regenerate an existing project from a partial description. + +A board changes inside a `with` block that hands over KiPy's open `Board` and saves at the end only if +the block changed it; a block that raises saves nothing. `kicad_sch.edit` does the same for a schematic +([schematic](references/schematic.md#edit-it)). Run the script with `cad run board.py`: ```python from cad import kicad_pcb @@ -92,121 +87,97 @@ kicad_pcb.export(BOARD, to=kind, out=f"fab/{kind}") ``` -An edit states the result it wants, so running it again is harmless: "U1 is at (10, 20)", "the power -tracks are 0.8 mm", never "move U1 5 mm" or "widen the tracks by 0.2 mm". Set absolute positions, -rotations, widths and nets; create an item only when the board does not hold it yet (find it first by its -reference, net or place). A script stopped halfway and run again then ends where one run would. - -A board's design starts at its schematic, which says what connects to what: read it, check it with -ERC and look at each sheet ([schematic](references/schematic.md)) before laying out, and hold the board -to it after. For creation or structured edits read [native files](references/board-api.md). For parts and -footprints read [parts](references/parts.md). To place and route a board, read -[layout](references/layout.md): start from the schematic's netlist, place one part or functional -group at a time ([placement](references/placement.md) says in what order and where), route the nets -whose path matters by hand and direct the router (`cad.kicad.route` in the edit, with the plan you -give it; never a third-party autorouter) through the rest, octolinear, with widths for each net's -current, and check each step with `cad kicad_pcb drc`, the copper stills and a script of the layout's own properties. KiCad's file coordinates are millimetres, **y down**; -footprint-local positions and rotations must be transformed into the board frame. Use a net's -actual pad positions when routing. Check the datasheet's pin numbers, footprint orientation and -connector mating side; a plausible-looking layout does not establish electrical correctness. - -## KiCad's own command line - -Use the typed commands first (`cad kicad_pcb drc|export`, `cad kicad_sch erc|export`): their results are -the ones the checks and the viewer read. For anything they do not cover, run KiCad's own command line -with `cad run kicad-cli …`: the pinned kicode `kicad-cli` with its own subcommands and flags (`cad run -kicad-cli pcb --help`), no `--with` needed, headless with private settings, its output and exit code -KiCad's. `CAD_KICAD_CLI` does not change which one runs. +- **State the result, not the change**: "U1 is at (10, 20)", "the power tracks are 0.8 mm", never + "move U1 5 mm". Set absolute positions, rotations, widths and nets, and create an item only when the + board does not hold it yet, so a script stopped halfway and run again ends where one run would. +- **Import KiPy's names from `kicode`** (`from kicode.proto.common.types import KIID`), never from + `kipy`: the two cannot share a process. +- **Coordinates are millimetres, y down.** Footprint-local positions and rotations are transformed into + the board frame; route to a net's actual pad positions. +- **Refill changed zones** (`b.refill_zones()`) before relying on their fill. +- KiCad's first start in a new environment can take a minute. + +A board's design starts at its schematic, which says what connects to what: read it, check it with ERC +and look at each sheet before laying out, and hold the board to it after. Place one functional group at +a time, route the nets whose path matters by hand, and direct cad's router (`cad.kicad.route`, inside +the edit, with the plan you give it; never a third-party autorouter) through the rest, with widths +for each net's current ([layout](references/layout.md)). A plausible-looking layout does not +establish electrical correctness: pin numbers, footprint orientation and connector mating side come +from the datasheet. + +For anything the typed commands do not cover, `cad run kicad-cli ...` runs the fetched KiCad's +command line with its own subcommands and flags (`cad run kicad-cli pcb --help`); `CAD_KICAD_CLI` +does not change which one that is: ```bash cad run kicad-cli pcb render --side top --rotate -45,0,45 -o tmp/board.png board.kicad_pcb cad run kicad-cli project downgrade --dry-run --target 10.0 board.kicad_pro # then -o DIR without --dry-run ``` -Most commands write only their `-o`, though kicad-cli may leave a `.kicad_prl` beside a board it reads. -These rewrite the source: `pcb upgrade` and `sch upgrade`, `fp upgrade` and `sym upgrade` without `-o`, -and `pcb drc --refill-zones --save-board`. `project downgrade` exits 2 without writing when the target -cannot represent the board. - -## Edit - -1. Inspect the saved board with `from cad import kicad_pcb` in a script run with - `cad run`; record the parts, nets, outline, relevant dimensions and constraints before - changing it. [Checks](references/checks.md) documents this read-only API and clickable references. -2. Edit the board in a `kicad_pcb.edit` block (or, as a fallback, the native file). Keep net assignments, - layer stack, track widths, clearances and custom rules consistent with the chosen fab and electrical - requirements. Refill changed copper zones with KiCad (`b.refill_zones()` in the block) before relying - on their saved fill. +Most of its commands write only their `-o` (it may leave a `.kicad_prl` beside a board it reads). +These rewrite the source: `pcb upgrade`, `sch upgrade`, `fp upgrade` and `sym upgrade` without `-o`, +and `pcb drc --refill-zones --save-board`. ## Check each change -Check the saved board after every step, from the same revision you will hand over: +Check the saved board after every step, from the revision you will hand over: | The change | Check it with | | --- | --- | -| The schematic | `cad kicad_sch erc board.kicad_sch` (KiCad's ERC: errors fail it) and `cad kicad_sch snapshot board.kicad_sch tmp/sheet.png --sheet /Power/` for each sheet changed ([schematic](references/schematic.md)) | -| Board against schematic | the pin-by-pin comparison in [schematic](references/schematic.md#into-the-board-and-back): every pad on its schematic pin's net | -| Anything: parts, copper, zones, rules | `cad kicad_pcb drc board.kicad_pcb` (or `--json`): KiCad's DRC against the board's own rules (its `.kicad_pro`'s; without one, KiCad's defaults, which it warns about as `no_project`). It exits 1 on error-severity violations or unconnected items. Unconnected items are the routing still to do | -| Placement | `cad kicad_pcb snapshot board.kicad_pcb tmp/placement.png --display placement`: short, uncrossed ratsnest lines mean a group is placed well; measure decoupling distance and connector access with `kicad_pcb.read` | -| Routing | The layout's property script ([layout](references/layout.md#a-property-check)): segments off 45 degrees, detours, width for current | -| How copper and silkscreen look | `cad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper` (and `--display '{"mode":"copper","side":"bottom"}'`) | +| The schematic | `cad kicad_sch erc board.kicad_sch`, and `cad kicad_sch snapshot board.kicad_sch tmp/sheet.png --sheet /Power/` for each sheet changed | +| Board against schematic | The pin-by-pin comparison in [schematic](references/schematic.md#into-the-board-and-back): every pad on its schematic pin's net | +| Anything on the board | `cad kicad_pcb drc board.kicad_pcb` (`--json`): KiCad's DRC against the board's own rules. It exits 1 on errors or unconnected items; unconnected items are the routing still to do | +| Placement | `cad kicad_pcb snapshot board.kicad_pcb tmp/placement.png --display placement`: short, uncrossed ratsnest lines mean a group is placed well | +| Routing | The layout's [property script](references/layout.md#a-property-check): segments off 45 degrees, detours, width for current | +| How copper and silkscreen look | `cad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper` ([more views](references/views.md#board-snapshots)) | | Ready to order | The review below | -- Review warnings too: KiCad's silkscreen, mask and courtyard rules are warnings, and they are what a - fab's CAM engineer flags. -- Resolve the cause instead of weakening rules to obtain a clean report. -- A clean DRC establishes the board's own rules, nothing more: not the circuit's correctness and not - the fab's limits. A number is never read off a snapshot. +- Warnings count: KiCad's silkscreen, mask and courtyard rules are warnings, and they are what a fab's + CAM engineer flags. +- Fix the cause; a rule weakened to get a clean report has shown nothing. +- A clean DRC establishes the board's own rules, not the circuit's correctness and not the fab's + limits. A number is measured from the board (`kicad_pcb.read`), never read off a snapshot. ## Before ordering -A review of one board, for the fab and assembler it will be ordered from, is a guided review, not a -fab's own engineering check: report what was not checked. Gather evidence in this order: KiCad's DRC -(every error blocks ordering); then measurements DRC cannot make, from the board read back with -`kicad_pcb.read` and the project BOM; then the checklist of what no command measures, with a snapshot. +A review of one board for the fab and assembler it will be ordered from is a guided review, not the +fab's own engineering check. Gather evidence in this order: KiCad's DRC (every error blocks ordering); +then what DRC cannot measure, from the board read back and the project's BOM; then the checklist of +what no command measures. | Area | Reference | Measured by | | --- | --- | --- | | Fabrication | [review-fabrication](references/review-fabrication.md) | KiCad's DRC against the board's rules; the rest by inspection | -| Electrical | [review-electrical](references/review-electrical.md) | the board read back: decoupling distances, narrowest track per net | -| Assembly and sourcing | [review-assembly](references/review-assembly.md) | the part list and placement file, by inspection | - -Each finding names its parts by board reference (`U2`, `C8`, `#net:VBUS`); `kicad_pcb.read(path).resolve(ref)` -says where one is. +| Electrical | [review-electrical](references/review-electrical.md) | The board read back: decoupling distances, narrowest track per net | +| Assembly and sourcing | [review-assembly](references/review-assembly.md) | The part list and placement file | ### Choosing the rules -1. Use the selected fab's own capability page for the board's layer count, copper weight and finish. - The project's Board Setup and custom rules may differ from the fab's limits: compare them. -2. Where the person names no fab, review against JLCPCB's standard service and say so. -3. Record the source, its date and the conditions (layers, copper, finish) with every limit you - adopt. If it cannot be checked, report the missing rule rather than invent one. - -A fab's standard tier is a price, not a physical limit: finer work is often possible at a surcharge. -Say which it is. - -### The review - -Scope first: board file and revision, fab and service, layers, copper, finish, assembled or bare. -Then the findings, errors first, each with where (board references), the evidence (the command or -measurement), the rule and its source, the result and the fix; then the coverage: checks run, and -checks not run with what they need. No findings is not a manufacturability approval. +Use the chosen fab's own capability page for the board's layer count, copper weight and finish, and +compare it with the project's Board Setup, which may differ. Where the person names no fab, review +against JLCPCB's standard service and say so. Record each limit's source, date and conditions; a rule +that cannot be checked is reported as missing, never invented. A fab's standard tier is a price, not a +physical limit. + +### The report + +Scope first (board file and revision, fab and service, layers, copper, finish, assembled or bare), +then the findings, errors first, each naming its parts by board reference (`U2`, `C8`, `#net:VBUS`; +`kicad_pcb.read(path).resolve(ref)` says where one is), with the evidence, the rule and its source, +the result and the fix. Then the coverage: checks run, and checks not run with what they need. | Item | Evidence | Rule | Result | Fix | | --- | --- | --- | --- | --- | | `U2` pad 3 to `C8` | measured 3.67 mm centre to centre from the board read back | decoupling within 3 mm (this review's guide) | review | move `C8` beside pin 3 | -**pass** for a measured item within a cited limit; **fail** for a measured violation or a KiCad -error; **review** for a risk a person decides; **unverified** where evidence or the fab's rule is -missing. Keep cost suggestions (basic vs extended parts, a cheaper finish) apart from manufacturing -constraints. A review alone does not ask for edits or an order: fix only when asked, then check the -neighbours of every fix (a moved capacitor can open a clearance elsewhere). Never order on the -person's behalf. - -Export only the requested deliverables from the saved revision you checked; see -[manufacturing and STEP](references/manufacturing.md). A DRC or ERC error blocks writing fabrication -files (Gerbers, drill, placement, BOM, ODB++, IPC-2581) unless the person explicitly says to go ahead; -the report then names every error they went ahead with. +The result is **pass** (measured, within a cited limit), **fail** (a measured violation or a KiCad +error), **review** (a risk a person decides) or **unverified** (evidence or the fab's rule is missing). +No findings is not a manufacturability approval. A review alone asks for no edits: fix only when +asked, and recheck the neighbours of every fix. + +Export only the deliverables asked for, from the revision you checked +([manufacturing](references/manufacturing.md)). A DRC or ERC error blocks writing fabrication files +unless the person says to go ahead, and the report then names every error they went ahead with. ## Show the model @@ -226,97 +197,5 @@ for the person: to check your own work, review with `cad <type> snapshot`, never a screenshot of the page. If it fails to launch, say so. -## Board views - -The board view supports layers, selection, Measure, annotations and Quick Edit, in 2D and in 3D. -Select works as KiCad's: a click picks a part, pad, track, via, zone, rule area, text, dimension or -graphic, as its Selection Filter ticks them (locked items only when the person ticks them), and a -drag draws a box that takes anything it touches. A box that takes nothing names an area, a box on the layer the person works on -(`#F.Cu@x10y5..x20y15`). The panel at the left (⌘\ or Ctrl+\ -hides and shows it, / searches it) has one search over three tabs. **Parts** lists the parts in the -schematic blocks their footprints record (by kind on a board that records none): a block picks every -part in it. **Nets** lists the nets: a net picks the whole net. Each arrives as a reference -([checks](references/checks.md#references) says what each names and how to resolve it). **Layers** -lists the layers: each layer's eye, and a press for the active layer (drawn on top); under them, how -the board is drawn: Other layers (KiCad's high-contrast modes: the layers but the active one -**Shown**, **Dimmed** or **Hidden**, Ctrl+H cycling them; the outline, and the drills and vias -through an active copper layer, always stay at full strength), the copper pours and the zones' and -tracks' opacity; last, **3D models**, how many parts stand on a model in 3D, with its eye. Under the -tabs, the picked part's or net's pads. The tool strip ends, after its rule, with **Flip** (the side -seen: the board as two stacked layers, the side facing you solid; ⇧F), **2D/3D** (reading **2D** while the -board is flat, **3D** in 3D) and **Display** (the preset: the mode); the zoom is the pill at the -bottom-right. Flip's and 2D/3D's icons are what is on screen and their tooltips what a press does. These are the display, so a Quick Edit's packet -draws the same. The board follows the app's theme: KiCad's colours on the dark canvas, and on the -light one the same colours darkened enough to read (copper stays KiCad's red and blue). - -In 3D (**2D/3D**, or the key 3) the board is a slab whose two faces are drawn as the 2D view draws -them, each part standing its 3D model. A press picks what the 2D view picks where the pointer's ray -meets the face, or the part whose body is in front of it; a drag turns the view; **Flip** (or ⇧F) -turns the camera over, and its icon shows the side the camera is on. A part's model is the STEP its footprint names, looked for only in the -board's folder (`${KIPRJMOD}`), KiCad's installed 3D library (every `${KICADn_3DMODEL_DIR}`) and the -folders `CAD_KICAD_3DMODELS` names (separated as `PATH` is); a `.wrl` name is read as the `.step` or -`.stp` beside it. `CAD_KICAD_3DMODELS` is read from the server's environment: a server already -running does not see a variable set in a shell afterwards, so set it before the server starts -(`cad server stop`, then `cad server start` with it set). A part without a model stands as a block, and -**Parts** lists it under **No 3D model**, with why: VRML only (no STEP beside the VRML), not found, -outside the folders above, too large, not a STEP, embedded in the board, or too many models. -`cad kicad_pcb inspect board.kicad_pcb --json` reports each model the same way (`models`: found, -missing with the reason, and the parts that name none), and a STEP or GLB export (`cad kicad_pcb export ---to step|glb`, `kicad_pcb.export`) holds exactly the models found, a `CAD_KICAD_3DMODELS` read from -the command's environment. `cad run kicad-cli` reads KiCad's library as KiCad does: every -`${KICADn_3DMODEL_DIR}` is the first of those library folders, and a `.wrl` name needs its `.wrl` file -there (KiCad 10's library ships STEP alone), so prefer the typed export. - -Snapshots use `cad kicad_pcb snapshot`, including `--job` packets saved by Quick Edit. Display modes -are `board`, `copper`, `assembly`, and `placement`. A still is always light (the light canvas and its -colours), whatever the viewer's theme, as every snapshot is: - -```bash -cad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper -cad kicad_pcb snapshot board.kicad_pcb tmp/bottom.png --display '{"mode":"copper","side":"bottom","poured":false}' -cad kicad_pcb snapshot board.kicad_pcb tmp/front.png --display '{"layers":["F.Cu","Edge.Cuts"]}' -cad kicad_pcb snapshot board.kicad_pcb tmp/inner.png --display '{"active":"In1.Cu","others":"dimmed","zones":0.3}' -cad kicad_pcb snapshot board.kicad_pcb tmp/front-only.png --display '{"active":"F.Cu","others":"hidden"}' -cad kicad_pcb snapshot board.kicad_pcb tmp/u1.png --window 108,42,132,66 --width 1600 -``` - -`--window X0,Y0,X1,Y1` draws only that box of the board, filling the picture: two opposite corners in -KiCad's millimetres (y down, the box `board.area(x0, y0, x1, y1)` names), as close as a fan-out or a -finding needs (`--window=-10,5,20,30` when the first is negative). With `--width` alone the height -follows the box's shape. It goes with any display (`--display copper`), and takes no `--camera`. - -Bottom views mirror the board and its annotations. Native 2D snapshots support the board's plan -camera, layer visibility and saved ink; they do not support 3D Preview, pose or transparency. -The viewer and snapshots draw the board as KiCad's PCB editor shows it (front copper active, pours -at 60%, pad numbers and net names on pads, vias and tracks, dimensions; no drawing sheet, the board alone); they approximate mask/paste openings -and use stroke lettering, KiCad's text markup (`~{RESET}`, `IO_{3}`, `x^{2}`) drawn as KiCad draws it on -silkscreen, fab and copper text, fields and net names; text boxes, tables and embedded images are not drawn. KiCad's DRC and manufacturing -exports remain authoritative for fabrication. For an enclosure use KiCad's STEP export, not a -solid inferred from the 2D plot. - -## Schematic views - -`cad viewer --json board.kicad_sch` opens a schematic a sheet at a time, with the board view's -selection, Measure, annotations and Quick Edit, and its panel: one search over **Parts**, **Nets** -and, for more than one sheet, the **Hierarchy**. The Hierarchy is KiCad's -Hierarchy Navigator: a press shows that sheet. A double-click on a sheet symbol enters it, and the -Hierarchy goes back up; a sheet shown again is where it was left. Select works as KiCad's: a click picks a symbol, pin, wire, label, sheet, -junction or no-connect, as its Selection Filter ticks them, and a drag draws a box that picks anything -it touches. -**Parts** lists the parts by the sheet they are placed on, each with its pins, and **Nets** the nets -with the pins on them. A net picked there lights across the sheet shown, and a part on another sheet shows -that sheet. Each arrives as a schematic reference (`#R1`, `#R1.2`, `#net:/MID`, `#sheet:/Power/`, -`#wire:<uuid>`; [schematic](references/schematic.md) says what each names). The schematic follows the -app's theme: KiCad's paper and ink in light, a dark sheet with light ink of the same hues in dark. Each -sheet is on KiCad's default drawing sheet, as its schematic editor shows it: the frame with its zone -numbers and letters, and the title block filled from that sheet's own title block (a project's own -`.kicad_wks` is not drawn; the default stands in). ERC findings are not drawn: run `cad kicad_sch erc`. The file -menu's Export offers KiCad's PDF, SVGs, netlist and BOM. Snapshots use `cad kicad_sch snapshot`, and -a Quick Edit packet carries the sheet the view showed, on the whole drawing sheet as the viewer showed it (`border`). A still is always on KiCad's light paper, -whatever the viewer's theme, with KiCad's default title block (`"title": false` leaves it out; `border` -adds the page's edge and frame) and text markup (`~{RESET}`, `IO_{3}`) drawn as KiCad draws it: - -```bash -cad kicad_sch snapshot board.kicad_sch tmp/power.png --display '{"sheet":"/Power/","border":true}' -cad kicad_sch snapshot board.kicad_sch tmp/power-plain.png --sheet /Power/ --display '{"title":false}' -``` +What the board and schematic pages offer the person (layers, selection, 3D, part models), and what +they approximate, is in [views](references/views.md).
Full technical diff · 3 changed fields
changed /description
"Create, edit, lay out and review native KiCad circuit boards (.kicad_pcb) and their schematics (.kicad_sch) - parts and nets, ERC, placement and routing, DRC, and a review before ordering (fab limits, decoupling, track width for current, assembly and BOM sourcing for JLCPCB, PCBWay or another fab); exports fabrication files, the netlist and BOM, or STEP for enclosure design. Shows boards and schematics in the text-to-cad viewer."
"Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB, PCBWay or another fab, and fabrication files, a BOM, a netlist or a STEP of the board. Not for the enclosure or other mechanical parts, which the cad skill makes."
changed /included_files
[
{
"relative_path": "LICENSE",
"size_in_bytes": 2230
},
{
"relative_path": "agents/openai.yaml",
"size_in_bytes": 268
},
{
"relative_path": "references/board-api.md",
"size_in_bytes": 4731
},
{
"relative_path": "references/checks.md",
"size_in_bytes": 5844
},
{
"relative_path": "references/layout.md",
"size_in_bytes": 18464
},
{
"relative_path": "references/manufacturing.md",
"size_in_bytes": 6679
},
{
"relative_path": "references/parts.md",
"size_in_bytes": 3868
},
{
"relative_path": "references/placement.md",
"size_in_bytes": 12712
},
{
"relative_path": "references/review-assembly.md",
"size_in_bytes": 3685
},
{
"relative_path": "references/review-electrical.md",
"size_in_bytes": 3462
},
{
"relative_path": "references/review-fabrication.md",
"size_in_bytes": 4087
},
{
"relative_path": "references/schematic.md",
"size_in_bytes": 16088
}
][
{
"relative_path": "LICENSE",
"size_in_bytes": 2230
},
{
"relative_path": "agents/openai.yaml",
"size_in_bytes": 268
},
{
"relative_path": "references/board-api.md",
"size_in_bytes": 4254
},
{
"relative_path": "references/checks.md",
"size_in_bytes": 5971
},
{
"relative_path": "references/layout.md",
"size_in_bytes": 13242
},
{
"relative_path": "references/manufacturing.md",
"size_in_bytes": 6004
},
{
"relative_path": "references/parts.md",
"size_in_bytes": 3634
},
{
"relative_path": "references/placement.md",
"size_in_bytes": 10203
},
{
"relative_path": "references/review-assembly.md",
"size_in_bytes": 3121
},
{
"relative_path": "references/review-electrical.md",
"size_in_bytes": 3197
},
{
"relative_path": "references/review-fabrication.md",
"size_in_bytes": 3046
},
{
"relative_path": "references/schematic.md",
"size_in_bytes": 13680
},
{
"relative_path": "references/views.md",
"size_in_bytes": 6765
}
]changed /skill_md_contents
"---\nname: pcb\ndescription: Create, edit, lay out and review native KiCad circuit boards (.kicad_pcb) and their schematics (.kicad_sch) - parts and nets, ERC, placement and routing, DRC, and a review before ordering (fab limits, decoupling, track width for current, assembly and BOM sourcing for JLCPCB, PCBWay or another fab); exports fabrication files, the netlist and BOM, or STEP for enclosure design. Shows boards and schematics in the text-to-cad viewer.\nlicense: MIT\nmetadata:\n repository: earthtojake/text-to-cad\n---\n\n# PCB design\n\n## Setup\n\nWritten for `cad==0.11.15`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than\n0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists.\n\nIf cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin:\nhttps://github.com/earthtojake/text-to-cad\nA project written for an earlier version may need changes; the migration guides say what:\nhttps://github.com/earthtojake/text-to-cad/tree/main/docs/migrations\n\ntext-to-cad reads a board or schematic itself, so inspecting either, and viewing a schematic or taking\nits snapshot, need no KiCad. DRC (`cad kicad_pcb drc`), ERC\n(`cad kicad_sch erc`), every export (`cad kicad_pcb export`, `cad kicad_sch export`) and an edit\n(`kicad_pcb.edit`, `kicad_sch.edit`) run KiCad's command line, `kicad-cli`,\nand its IPC API from kicode, the `kicad` extra (`cad[kicad]`): the `cad` command installs it the first\ntime a board command needs it (about 100 MB to download and 340 MB on disk, once; nothing for you to install), and `cad run` gives a\nscript that edits a board its environment. Showing a board or taking its snapshot needs it too: KiCad\nrefills the board's copper pours on a copy before they are drawn, so the first board shown starts that\ndownload. `CAD_KICAD_REFILL=0` in the server's environment turns the refill off (no download; set\nit as `CAD_KICAD_3DMODELS` below), and the pours are drawn as the file saved them, as they are when the\ndownload or the refill fails. A KiCad you installed yourself is never run. `CAD_KICAD_CLI` can name\nanother `kicad-cli` (the command line itself, named `kicad-cli`; KiCad 9 or newer, a nightly's for an\nedit). It runs headless, with private settings, and never opens KiCad's app; never open a\nboard in KiCad's app to check it. Its library variables name KiCad's own libraries, never your\nvariables or KiCad settings: a project's `sym-lib-table` or `fp-lib-table` row that names a stock\nlibrary as KiCad's own tables do (`${KICAD10_SYMBOL_DIR}/Device.kicad_sym`,\n`${KICAD10_FOOTPRINT_DIR}/Resistor_SMD.pretty`, any major's spelling) reads it in the libraries of the\nKiCad you installed (the newest, if several; or the installation whose `3dmodels` folder\n`CAD_KICAD_3DMODELS` names): nothing to set. With no KiCad installed, ERC warns `lib_symbol_issues` that\neach such library was not found and DRC `lib_footprint_issues` that it is not enabled; a project that\ncarries its libraries (`${KIPRJMOD}`) needs no KiCad.\n\nkicode's KiCad is a nightly (10.99), so a board or schematic it saves is in the nightly's format, which a\nstable KiCad app refuses; viewing and snapshots still work, and the viewer's Open in says which KiCad on\nthis computer can open the file.\n\n## Native files are the source\n\nEdit the `.kicad_pcb` itself, preserving its companion `.kicad_pro`, `.kicad_dru`, libraries and\nschematic when present. Reading or displaying a board never writes it. There is no text-to-cad PCB\nmodel, build step, or generated-board ownership marker. A helper script may make a requested edit,\nbut reread the current file before editing and preserve unknown records and UUIDs. Do not regenerate\nan existing project from an incomplete description.\n\nChange a board through KiCad's IPC API in an edit, a `with` block: `kicad_pcb.edit` hands the block the\nopen board (KiPy's `Board`, as kicode names it: `kicode.board.Board`) and saves it at the block's end\nwhen the block changed it; a block that changes nothing leaves the file byte for byte, one that raises\nsaves nothing (its exception goes on), and a save KiCad cannot finish leaves every file as it was,\nsaying why. A board not there yet is made by KiCad, with its project,\nand saved. `kicad_sch.edit` does the same for a schematic ([schematic](references/schematic.md#edit-it));\nthe two of one project, one inside the other, share one KiCad. Run the script with `cad run board.py`,\nwhich gives it the `kicad` extra (kicode: KiPy and a `kicad-cli` with its headless `api-server`); a\n`kicad-cli` that `CAD_KICAD_CLI` names without one is refused up front, before any server starts. That\nserver listens on a local socket, which a shell sandbox that refuses sockets (an agent app's default, Codex's\namong them) does not allow: the edit then stops at once, saying so, and the script must run outside the\nsandbox (ask for the unsandboxed or escalated run); inspecting, DRC, exports and snapshots run inside it.\nKiCad's first start from a new environment can take a minute, which the edit says while it waits. Import\nKiPy's names from `kicode` (`from kicode.proto.common.types import KIID`, `from kicode.util.units import\nfrom_mm`), never from `kipy`: the two cannot share a process. Saving writes the file in the nightly's\nformat: one from an older KiCad is upgraded, which the run says, and that older KiCad can no longer open\nit. Checks and exports of the saved board are calls after the block (`kicad_pcb.drc`, `kicad_pcb.export`);\na STEP or GLB export holds each part's 3D model where the board's 3D view finds it ([board\nviews](#board-views)), and leaves out, naming them, the parts whose model is missing (or, in a STEP, only in\nVRML); `--to dxf` writes the outline and drilled holes, for an enclosure:\n\n```python\nfrom cad import kicad_pcb\nfrom kicode.util.units import from_mm\n\nBOARD = \"board.kicad_pcb\"\n\nwith kicad_pcb.edit(BOARD) as b: # the board file is the source; the block edits it in place\n power = [t for t in b.get_tracks() if t.net.name in {\"+5V\", \"+3V3\"}]\n for track in power:\n track.width = from_mm(0.8)\n b.update_items(power)\n b.refill_zones()\ndrc = kicad_pcb.drc(BOARD)\nif not drc.ok:\n raise SystemExit(\"\\n\".join(drc.human_lines())) # each finding, then FAILED and the count\nfor kind in (\"gerbers\", \"drill\", \"pos\", \"bom\", \"step\"):\n kicad_pcb.export(BOARD, to=kind, out=f\"fab/{kind}\")\n```\n\nAn edit states the result it wants, so running it again is harmless: \"U1 is at (10, 20)\", \"the power\ntracks are 0.8 mm\", never \"move U1 5 mm\" or \"widen the tracks by 0.2 mm\". Set absolute positions,\nrotations, widths and nets; create an item only when the board does not hold it yet (find it first by its\nreference, net or place). A script stopped halfway and run again then ends where one run would.\n\nA board's design starts at its schematic, which says what connects to what: read it, check it with\nERC and look at each sheet ([schematic](references/schematic.md)) before laying out, and hold the board\nto it after. For creation or structured edits read [native files](references/board-api.md). For parts and\nfootprints read [parts](references/parts.md). To place and route a board, read\n[layout](references/layout.md): start from the schematic's netlist, place one part or functional\ngroup at a time ([placement](references/placement.md) says in what order and where), route the nets\nwhose path matters by hand and direct the router (`cad.kicad.route` in the edit, with the plan you\ngive it; never a third-party autorouter) through the rest, octolinear, with widths for each net's\ncurrent, and check each step with `cad kicad_pcb drc`, the copper stills and a script of the layout's own properties. KiCad's file coordinates are millimetres, **y down**;\nfootprint-local positions and rotations must be transformed into the board frame. Use a net's\nactual pad positions when routing. Check the datasheet's pin numbers, footprint orientation and\nconnector mating side; a plausible-looking layout does not establish electrical correctness.\n\n## KiCad's own command line\n\nUse the typed commands first (`cad kicad_pcb drc|export`, `cad kicad_sch erc|export`): their results are\nthe ones the checks and the viewer read. For anything they do not cover, run KiCad's own command line\nwith `cad run kicad-cli …`: the pinned kicode `kicad-cli` with its own subcommands and flags (`cad run\nkicad-cli pcb --help`), no `--with` needed, headless with private settings, its output and exit code\nKiCad's. `CAD_KICAD_CLI` does not change which one runs.\n\n```bash\ncad run kicad-cli pcb render --side top --rotate -45,0,45 -o tmp/board.png board.kicad_pcb\ncad run kicad-cli project downgrade --dry-run --target 10.0 board.kicad_pro # then -o DIR without --dry-run\n```\n\nMost commands write only their `-o`, though kicad-cli may leave a `.kicad_prl` beside a board it reads.\nThese rewrite the source: `pcb upgrade` and `sch upgrade`, `fp upgrade` and `sym upgrade` without `-o`,\nand `pcb drc --refill-zones --save-board`. `project downgrade` exits 2 without writing when the target\ncannot represent the board.\n\n## Edit\n\n1. Inspect the saved board with `from cad import kicad_pcb` in a script run with\n `cad run`; record the parts, nets, outline, relevant dimensions and constraints before\n changing it. [Checks](references/checks.md) documents this read-only API and clickable references.\n2. Edit the board in a `kicad_pcb.edit` block (or, as a fallback, the native file). Keep net assignments,\n layer stack, track widths, clearances and custom rules consistent with the chosen fab and electrical\n requirements. Refill changed copper zones with KiCad (`b.refill_zones()` in the block) before relying\n on their saved fill.\n\n## Check each change\n\nCheck the saved board after every step, from the same revision you will hand over:\n\n| The change | Check it with |\n| --- | --- |\n| The schematic | `cad kicad_sch erc board.kicad_sch` (KiCad's ERC: errors fail it) and `cad kicad_sch snapshot board.kicad_sch tmp/sheet.png --sheet /Power/` for each sheet changed ([schematic](references/schematic.md)) |\n| Board against schematic | the pin-by-pin comparison in [schematic](references/schematic.md#into-the-board-and-back): every pad on its schematic pin's net |\n| Anything: parts, copper, zones, rules | `cad kicad_pcb drc board.kicad_pcb` (or `--json`): KiCad's DRC against the board's own rules (its `.kicad_pro`'s; without one, KiCad's defaults, which it warns about as `no_project`). It exits 1 on error-severity violations or unconnected items. Unconnected items are the routing still to do |\n| Placement | `cad kicad_pcb snapshot board.kicad_pcb tmp/placement.png --display placement`: short, uncrossed ratsnest lines mean a group is placed well; measure decoupling distance and connector access with `kicad_pcb.read` |\n| Routing | The layout's property script ([layout](references/layout.md#a-property-check)): segments off 45 degrees, detours, width for current |\n| How copper and silkscreen look | `cad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper` (and `--display '{\"mode\":\"copper\",\"side\":\"bottom\"}'`) |\n| Ready to order | The review below |\n\n- Review warnings too: KiCad's silkscreen, mask and courtyard rules are warnings, and they are what a\n fab's CAM engineer flags.\n- Resolve the cause instead of weakening rules to obtain a clean report.\n- A clean DRC establishes the board's own rules, nothing more: not the circuit's correctness and not\n the fab's limits. A number is never read off a snapshot.\n\n## Before ordering\n\nA review of one board, for the fab and assembler it will be ordered from, is a guided review, not a\nfab's own engineering check: report what was not checked. Gather evidence in this order: KiCad's DRC\n(every error blocks ordering); then measurements DRC cannot make, from the board read back with\n`kicad_pcb.read` and the project BOM; then the checklist of what no command measures, with a snapshot.\n\n| Area | Reference | Measured by |\n| --- | --- | --- |\n| Fabrication | [review-fabrication](references/review-fabrication.md) | KiCad's DRC against the board's rules; the rest by inspection |\n| Electrical | [review-electrical](references/review-electrical.md) | the board read back: decoupling distances, narrowest track per net |\n| Assembly and sourcing | [review-assembly](references/review-assembly.md) | the part list and placement file, by inspection |\n\nEach finding names its parts by board reference (`U2`, `C8`, `#net:VBUS`); `kicad_pcb.read(path).resolve(ref)`\nsays where one is.\n\n### Choosing the rules\n\n1. Use the selected fab's own capability page for the board's layer count, copper weight and finish.\n The project's Board Setup and custom rules may differ from the fab's limits: compare them.\n2. Where the person names no fab, review against JLCPCB's standard service and say so.\n3. Record the source, its date and the conditions (layers, copper, finish) with every limit you\n adopt. If it cannot be checked, report the missing rule rather than invent one.\n\nA fab's standard tier is a price, not a physical limit: finer work is often possible at a surcharge.\nSay which it is.\n\n### The review\n\nScope first: board file and revision, fab and service, layers, copper, finish, assembled or bare.\nThen the findings, errors first, each with where (board references), the evidence (the command or\nmeasurement), the rule and its source, the result and the fix; then the coverage: checks run, and\nchecks not run with what they need. No findings is not a manufacturability approval.\n\n| Item | Evidence | Rule | Result | Fix |\n| --- | --- | --- | --- | --- |\n| `U2` pad 3 to `C8` | measured 3.67 mm centre to centre from the board read back | decoupling within 3 mm (this review's guide) | review | move `C8` beside pin 3 |\n\n**pass** for a measured item within a cited limit; **fail** for a measured violation or a KiCad\nerror; **review** for a risk a person decides; **unverified** where evidence or the fab's rule is\nmissing. Keep cost suggestions (basic vs extended parts, a cheaper finish) apart from manufacturing\nconstraints. A review alone does not ask for edits or an order: fix only when asked, then check the\nneighbours of every fix (a moved capacitor can open a clearance elsewhere). Never order on the\nperson's behalf.\n\nExport only the requested deliverables from the saved revision you checked; see\n[manufacturing and STEP](references/manufacturing.md). A DRC or ERC error blocks writing fabrication\nfiles (Gerbers, drill, placement, BOM, ODB++, IPC-2581) unless the person explicitly says to go ahead;\nthe report then names every error they went ahead with.\n\n## Show the model\n\nShow the person each model you create or change as soon as its first run succeeds, and any model\nor file they ask to see. A model's page is the `view:` line its run prints, and a file's is the `url`\nthat `cad viewer --json FILE [FILE ...]` prints for it (never guess the port). Show it with\nthe first of these you have:\n\n1. `cad_show` among your tools (your host may prefix it): call it with the model's id or the file's\n absolute path; its description says the rest.\n2. A tool that opens a page in the app's own browser pane, not in the person's own browser (in the\n Claude desktop app, the Browser pane's `preview_start` with the page's `url`, or its `navigate`):\n open the page there yourself, and give the person the link as well.\n3. Neither: give the person the link, to open in their browser.\n\nThe page follows every run of the model. A file you export is a download: give its path. Showing is\nfor the person: to check your own work, review with `cad <type> snapshot`, never a screenshot\nof the page. If it fails to launch, say so.\n\n## Board views\n\nThe board view supports layers, selection, Measure, annotations and Quick Edit, in 2D and in 3D.\nSelect works as KiCad's: a click picks a part, pad, track, via, zone, rule area, text, dimension or\ngraphic, as its Selection Filter ticks them (locked items only when the person ticks them), and a\ndrag draws a box that takes anything it touches. A box that takes nothing names an area, a box on the layer the person works on\n(`#F.Cu@x10y5..x20y15`). The panel at the left (⌘\\ or Ctrl+\\\nhides and shows it, / searches it) has one search over three tabs. **Parts** lists the parts in the\nschematic blocks their footprints record (by kind on a board that records none): a block picks every\npart in it. **Nets** lists the nets: a net picks the whole net. Each arrives as a reference\n([checks](references/checks.md#references) says what each names and how to resolve it). **Layers**\nlists the layers: each layer's eye, and a press for the active layer (drawn on top); under them, how\nthe board is drawn: Other layers (KiCad's high-contrast modes: the layers but the active one\n**Shown**, **Dimmed** or **Hidden**, Ctrl+H cycling them; the outline, and the drills and vias\nthrough an active copper layer, always stay at full strength), the copper pours and the zones' and\ntracks' opacity; last, **3D models**, how many parts stand on a model in 3D, with its eye. Under the\ntabs, the picked part's or net's pads. The tool strip ends, after its rule, with **Flip** (the side\nseen: the board as two stacked layers, the side facing you solid; ⇧F), **2D/3D** (reading **2D** while the\nboard is flat, **3D** in 3D) and **Display** (the preset: the mode); the zoom is the pill at the\nbottom-right. Flip's and 2D/3D's icons are what is on screen and their tooltips what a press does. These are the display, so a Quick Edit's packet\ndraws the same. The board follows the app's theme: KiCad's colours on the dark canvas, and on the\nlight one the same colours darkened enough to read (copper stays KiCad's red and blue).\n\nIn 3D (**2D/3D**, or the key 3) the board is a slab whose two faces are drawn as the 2D view draws\nthem, each part standing its 3D model. A press picks what the 2D view picks where the pointer's ray\nmeets the face, or the part whose body is in front of it; a drag turns the view; **Flip** (or ⇧F)\nturns the camera over, and its icon shows the side the camera is on. A part's model is the STEP its footprint names, looked for only in the\nboard's folder (`${KIPRJMOD}`), KiCad's installed 3D library (every `${KICADn_3DMODEL_DIR}`) and the\nfolders `CAD_KICAD_3DMODELS` names (separated as `PATH` is); a `.wrl` name is read as the `.step` or\n`.stp` beside it. `CAD_KICAD_3DMODELS` is read from the server's environment: a server already\nrunning does not see a variable set in a shell afterwards, so set it before the server starts\n(`cad server stop`, then `cad server start` with it set). A part without a model stands as a block, and\n**Parts** lists it under **No 3D model**, with why: VRML only (no STEP beside the VRML), not found,\noutside the folders above, too large, not a STEP, embedded in the board, or too many models.\n`cad kicad_pcb inspect board.kicad_pcb --json` reports each model the same way (`models`: found,\nmissing with the reason, and the parts that name none), and a STEP or GLB export (`cad kicad_pcb export\n--to step|glb`, `kicad_pcb.export`) holds exactly the models found, a `CAD_KICAD_3DMODELS` read from\nthe command's environment. `cad run kicad-cli` reads KiCad's library as KiCad does: every\n`${KICADn_3DMODEL_DIR}` is the first of those library folders, and a `.wrl` name needs its `.wrl` file\nthere (KiCad 10's library ships STEP alone), so prefer the typed export.\n\nSnapshots use `cad kicad_pcb snapshot`, including `--job` packets saved by Quick Edit. Display modes\nare `board`, `copper`, `assembly`, and `placement`. A still is always light (the light canvas and its\ncolours), whatever the viewer's theme, as every snapshot is:\n\n```bash\ncad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper\ncad kicad_pcb snapshot board.kicad_pcb tmp/bottom.png --display '{\"mode\":\"copper\",\"side\":\"bottom\",\"poured\":false}'\ncad kicad_pcb snapshot board.kicad_pcb tmp/front.png --display '{\"layers\":[\"F.Cu\",\"Edge.Cuts\"]}'\ncad kicad_pcb snapshot board.kicad_pcb tmp/inner.png --display '{\"active\":\"In1.Cu\",\"others\":\"dimmed\",\"zones\":0.3}'\ncad kicad_pcb snapshot board.kicad_pcb tmp/front-only.png --display '{\"active\":\"F.Cu\",\"others\":\"hidden\"}'\ncad kicad_pcb snapshot board.kicad_pcb tmp/u1.png --window 108,42,132,66 --width 1600\n```\n\n`--window X0,Y0,X1,Y1` draws only that box of the board, filling the picture: two opposite corners in\nKiCad's millimetres (y down, the box `board.area(x0, y0, x1, y1)` names), as close as a fan-out or a\nfinding needs (`--window=-10,5,20,30` when the first is negative). With `--width` alone the height\nfollows the box's shape. It goes with any display (`--display copper`), and takes no `--camera`.\n\nBottom views mirror the board and its annotations. Native 2D snapshots support the board's plan\ncamera, layer visibility and saved ink; they do not support 3D Preview, pose or transparency.\nThe viewer and snapshots draw the board as KiCad's PCB editor shows it (front copper active, pours\nat 60%, pad numbers and net names on pads, vias and tracks, dimensions; no drawing sheet, the board alone); they approximate mask/paste openings\nand use stroke lettering, KiCad's text markup (`~{RESET}`, `IO_{3}`, `x^{2}`) drawn as KiCad draws it on\nsilkscreen, fab and copper text, fields and net names; text boxes, tables and embedded images are not drawn. KiCad's DRC and manufacturing\nexports remain authoritative for fabrication. For an enclosure use KiCad's STEP export, not a\nsolid inferred from the 2D plot.\n\n## Schematic views\n\n`cad viewer --json board.kicad_sch` opens a schematic a sheet at a time, with the board view's\nselection, Measure, annotations and Quick Edit, and its panel: one search over **Parts**, **Nets**\nand, for more than one sheet, the **Hierarchy**. The Hierarchy is KiCad's\nHierarchy Navigator: a press shows that sheet. A double-click on a sheet symbol enters it, and the\nHierarchy goes back up; a sheet shown again is where it was left. Select works as KiCad's: a click picks a symbol, pin, wire, label, sheet,\njunction or no-connect, as its Selection Filter ticks them, and a drag draws a box that picks anything\nit touches.\n**Parts** lists the parts by the sheet they are placed on, each with its pins, and **Nets** the nets\nwith the pins on them. A net picked there lights across the sheet shown, and a part on another sheet shows\nthat sheet. Each arrives as a schematic reference (`#R1`, `#R1.2`, `#net:/MID`, `#sheet:/Power/`,\n`#wire:<uuid>`; [schematic](references/schematic.md) says what each names). The schematic follows the\napp's theme: KiCad's paper and ink in light, a dark sheet with light ink of the same hues in dark. Each\nsheet is on KiCad's default drawing sheet, as its schematic editor shows it: the frame with its zone\nnumbers and letters, and the title block filled from that sheet's own title block (a project's own\n`.kicad_wks` is not drawn; the default stands in). ERC findings are not drawn: run `cad kicad_sch erc`. The file\nmenu's Export offers KiCad's PDF, SVGs, netlist and BOM. Snapshots use `cad kicad_sch snapshot`, and\na Quick Edit packet carries the sheet the view showed, on the whole drawing sheet as the viewer showed it (`border`). A still is always on KiCad's light paper,\nwhatever the viewer's theme, with KiCad's default title block (`\"title\": false` leaves it out; `border`\nadds the page's edge and frame) and text markup (`~{RESET}`, `IO_{3}`) drawn as KiCad draws it:\n\n```bash\ncad kicad_sch snapshot board.kicad_sch tmp/power.png --display '{\"sheet\":\"/Power/\",\"border\":true}'\ncad kicad_sch snapshot board.kicad_sch tmp/power-plain.png --sheet /Power/ --display '{\"title\":false}'\n```\n""---\nname: pcb\ndescription: Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB, PCBWay or another fab, and fabrication files, a BOM, a netlist or a STEP of the board. Not for the enclosure or other mechanical parts, which the cad skill makes.\nlicense: MIT\nmetadata:\n repository: earthtojake/text-to-cad\n---\n\n# PCB design\n\nA board is its native KiCad files: the `.kicad_pcb`, its schematic and its project. text-to-cad reads,\ndraws and inspects them itself, and runs KiCad headless for everything KiCad owns: ERC, DRC, exports\nand edits through its IPC API. There is no board model or build step; the files are the source.\n\n## Start with the task\n\n| Task | Start with | Reference |\n| --- | --- | --- |\n| Read a board or a schematic | `kicad_pcb.read`, `kicad_sch.read` in a script; `cad kicad_pcb inspect` | [Checks](references/checks.md), [schematic](references/schematic.md#read-it) |\n| Draw or edit a schematic | `kicad_sch.edit`, then `cad kicad_sch erc` | [Schematic](references/schematic.md) |\n| Choose parts and footprints | The datasheet, then the project's libraries | [Parts](references/parts.md) |\n| Create or edit a board | `kicad_pcb.edit` ([below](#native-files-are-the-source)) | [Native files](references/board-api.md) |\n| Place and route | The schematic's netlist, one functional group at a time | [Layout](references/layout.md), [placement](references/placement.md) |\n| Check a change | `cad kicad_pcb drc`, snapshots | [Check each change](#check-each-change) |\n| Review before ordering | DRC, then measurements, then the checklist | [Before ordering](#before-ordering) |\n| Export fabrication files, a BOM, or a STEP for an enclosure | `cad kicad_pcb export`, `cad kicad_sch export` | [Manufacturing](references/manufacturing.md) |\n| Show a board or a schematic; what the person can see or pick in it; a missing 3D model | `cad viewer --json FILE` | [Show the model](#show-the-model), [views](references/views.md) |\n\n## Setup\n\nWritten for `cad==0.11.16`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than\n0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists.\n\nIf cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin:\nhttps://github.com/earthtojake/text-to-cad\nA project written for an earlier version may need changes; the migration guides say what:\nhttps://github.com/earthtojake/text-to-cad/tree/main/docs/migrations\n\nReading and inspecting a board or schematic needs no KiCad. DRC, ERC, exports, edits, and drawing a\nboard (its copper pours are refilled on a copy first) run KiCad's own `kicad-cli` and IPC API, which\n`cad` fetches the first time one is needed (kicode: about 100 MB to download, 340 MB on disk, once);\n`cad run` gives a script the same. Things to know about that KiCad:\n\n- **It is a nightly (10.99).** A file it saves is in the nightly's format, which a stable KiCad app\n refuses to open; viewing and snapshots still work, and the viewer tells the person which KiCad on\n this computer can open the file. Say so before the first save of a board the person opens in a\n stable KiCad.\n- **It runs headless with private settings**, never the person's KiCad app or its settings: never open\n a board in KiCad's app to check it. A project library row that names a stock library as KiCad's own\n tables do (`${KICAD10_SYMBOL_DIR}/Device.kicad_sym`) is read from the KiCad the person installed;\n with none installed, ERC warns `lib_symbol_issues` and DRC `lib_footprint_issues`. A project that\n carries its libraries (`${KIPRJMOD}`) needs no KiCad installed.\n- **An edit needs a local socket.** A shell sandbox that refuses sockets (an agent app's default) stops\n an edit at once, saying so: run the script outside the sandbox. Inspecting, DRC, exports and\n snapshots run inside it.\n- **A KiCad the person installed is never run.** Where the fetched one does not run on a computer,\n `CAD_KICAD_CLI` names another `kicad-cli` (KiCad 9 or newer; a nightly's for an edit).\n- **`CAD_KICAD_REFILL=0` in the server's environment turns the refill off**: showing a board then\n downloads nothing, and its pours are drawn as the file saved them.\n\n## Native files are the source\n\nEdit the `.kicad_pcb` itself and keep its `.kicad_pro`, `.kicad_dru`, libraries and schematic beside\nit. Reading or showing a board never writes it. Reread the file before an edit, preserve records and\nUUIDs you do not understand, and never regenerate an existing project from a partial description.\n\nA board changes inside a `with` block that hands over KiPy's open `Board` and saves at the end only if\nthe block changed it; a block that raises saves nothing. `kicad_sch.edit` does the same for a schematic\n([schematic](references/schematic.md#edit-it)). Run the script with `cad run board.py`:\n\n```python\nfrom cad import kicad_pcb\nfrom kicode.util.units import from_mm\n\nBOARD = \"board.kicad_pcb\"\n\nwith kicad_pcb.edit(BOARD) as b: # the board file is the source; the block edits it in place\n power = [t for t in b.get_tracks() if t.net.name in {\"+5V\", \"+3V3\"}]\n for track in power:\n track.width = from_mm(0.8)\n b.update_items(power)\n b.refill_zones()\ndrc = kicad_pcb.drc(BOARD)\nif not drc.ok:\n raise SystemExit(\"\\n\".join(drc.human_lines())) # each finding, then FAILED and the count\nfor kind in (\"gerbers\", \"drill\", \"pos\", \"bom\", \"step\"):\n kicad_pcb.export(BOARD, to=kind, out=f\"fab/{kind}\")\n```\n\n- **State the result, not the change**: \"U1 is at (10, 20)\", \"the power tracks are 0.8 mm\", never\n \"move U1 5 mm\". Set absolute positions, rotations, widths and nets, and create an item only when the\n board does not hold it yet, so a script stopped halfway and run again ends where one run would.\n- **Import KiPy's names from `kicode`** (`from kicode.proto.common.types import KIID`), never from\n `kipy`: the two cannot share a process.\n- **Coordinates are millimetres, y down.** Footprint-local positions and rotations are transformed into\n the board frame; route to a net's actual pad positions.\n- **Refill changed zones** (`b.refill_zones()`) before relying on their fill.\n- KiCad's first start in a new environment can take a minute.\n\nA board's design starts at its schematic, which says what connects to what: read it, check it with ERC\nand look at each sheet before laying out, and hold the board to it after. Place one functional group at\na time, route the nets whose path matters by hand, and direct cad's router (`cad.kicad.route`, inside\nthe edit, with the plan you give it; never a third-party autorouter) through the rest, with widths\nfor each net's current ([layout](references/layout.md)). A plausible-looking layout does not\nestablish electrical correctness: pin numbers, footprint orientation and connector mating side come\nfrom the datasheet.\n\nFor anything the typed commands do not cover, `cad run kicad-cli ...` runs the fetched KiCad's\ncommand line with its own subcommands and flags (`cad run kicad-cli pcb --help`); `CAD_KICAD_CLI`\ndoes not change which one that is:\n\n```bash\ncad run kicad-cli pcb render --side top --rotate -45,0,45 -o tmp/board.png board.kicad_pcb\ncad run kicad-cli project downgrade --dry-run --target 10.0 board.kicad_pro # then -o DIR without --dry-run\n```\n\nMost of its commands write only their `-o` (it may leave a `.kicad_prl` beside a board it reads).\nThese rewrite the source: `pcb upgrade`, `sch upgrade`, `fp upgrade` and `sym upgrade` without `-o`,\nand `pcb drc --refill-zones --save-board`.\n\n## Check each change\n\nCheck the saved board after every step, from the revision you will hand over:\n\n| The change | Check it with |\n| --- | --- |\n| The schematic | `cad kicad_sch erc board.kicad_sch`, and `cad kicad_sch snapshot board.kicad_sch tmp/sheet.png --sheet /Power/` for each sheet changed |\n| Board against schematic | The pin-by-pin comparison in [schematic](references/schematic.md#into-the-board-and-back): every pad on its schematic pin's net |\n| Anything on the board | `cad kicad_pcb drc board.kicad_pcb` (`--json`): KiCad's DRC against the board's own rules. It exits 1 on errors or unconnected items; unconnected items are the routing still to do |\n| Placement | `cad kicad_pcb snapshot board.kicad_pcb tmp/placement.png --display placement`: short, uncrossed ratsnest lines mean a group is placed well |\n| Routing | The layout's [property script](references/layout.md#a-property-check): segments off 45 degrees, detours, width for current |\n| How copper and silkscreen look | `cad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper` ([more views](references/views.md#board-snapshots)) |\n| Ready to order | The review below |\n\n- Warnings count: KiCad's silkscreen, mask and courtyard rules are warnings, and they are what a fab's\n CAM engineer flags.\n- Fix the cause; a rule weakened to get a clean report has shown nothing.\n- A clean DRC establishes the board's own rules, not the circuit's correctness and not the fab's\n limits. A number is measured from the board (`kicad_pcb.read`), never read off a snapshot.\n\n## Before ordering\n\nA review of one board for the fab and assembler it will be ordered from is a guided review, not the\nfab's own engineering check. Gather evidence in this order: KiCad's DRC (every error blocks ordering);\nthen what DRC cannot measure, from the board read back and the project's BOM; then the checklist of\nwhat no command measures.\n\n| Area | Reference | Measured by |\n| --- | --- | --- |\n| Fabrication | [review-fabrication](references/review-fabrication.md) | KiCad's DRC against the board's rules; the rest by inspection |\n| Electrical | [review-electrical](references/review-electrical.md) | The board read back: decoupling distances, narrowest track per net |\n| Assembly and sourcing | [review-assembly](references/review-assembly.md) | The part list and placement file |\n\n### Choosing the rules\n\nUse the chosen fab's own capability page for the board's layer count, copper weight and finish, and\ncompare it with the project's Board Setup, which may differ. Where the person names no fab, review\nagainst JLCPCB's standard service and say so. Record each limit's source, date and conditions; a rule\nthat cannot be checked is reported as missing, never invented. A fab's standard tier is a price, not a\nphysical limit.\n\n### The report\n\nScope first (board file and revision, fab and service, layers, copper, finish, assembled or bare),\nthen the findings, errors first, each naming its parts by board reference (`U2`, `C8`, `#net:VBUS`;\n`kicad_pcb.read(path).resolve(ref)` says where one is), with the evidence, the rule and its source,\nthe result and the fix. Then the coverage: checks run, and checks not run with what they need.\n\n| Item | Evidence | Rule | Result | Fix |\n| --- | --- | --- | --- | --- |\n| `U2` pad 3 to `C8` | measured 3.67 mm centre to centre from the board read back | decoupling within 3 mm (this review's guide) | review | move `C8` beside pin 3 |\n\nThe result is **pass** (measured, within a cited limit), **fail** (a measured violation or a KiCad\nerror), **review** (a risk a person decides) or **unverified** (evidence or the fab's rule is missing).\nNo findings is not a manufacturability approval. A review alone asks for no edits: fix only when\nasked, and recheck the neighbours of every fix.\n\nExport only the deliverables asked for, from the revision you checked\n([manufacturing](references/manufacturing.md)). A DRC or ERC error blocks writing fabrication files\nunless the person says to go ahead, and the report then names every error they went ahead with.\n\n## Show the model\n\nShow the person each model you create or change as soon as its first run succeeds, and any model\nor file they ask to see. A model's page is the `view:` line its run prints, and a file's is the `url`\nthat `cad viewer --json FILE [FILE ...]` prints for it (never guess the port). Show it with\nthe first of these you have:\n\n1. `cad_show` among your tools (your host may prefix it): call it with the model's id or the file's\n absolute path; its description says the rest.\n2. A tool that opens a page in the app's own browser pane, not in the person's own browser (in the\n Claude desktop app, the Browser pane's `preview_start` with the page's `url`, or its `navigate`):\n open the page there yourself, and give the person the link as well.\n3. Neither: give the person the link, to open in their browser.\n\nThe page follows every run of the model. A file you export is a download: give its path. Showing is\nfor the person: to check your own work, review with `cad <type> snapshot`, never a screenshot\nof the page. If it fails to launch, say so.\n\nWhat the board and schematic pages offer the person (layers, selection, 3D, part models), and what\nthey approximate, is in [views](references/views.md).\n"Full snapshot data
{
"description": "Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB, PCBWay or another fab, and fabrication files, a BOM, a netlist or a STEP of the board. Not for the enclosure or other mechanical parts, which the cad skill makes.",
"included_files": [
{
"relative_path": "LICENSE",
"size_in_bytes": 2230
},
{
"relative_path": "agents/openai.yaml",
"size_in_bytes": 268
},
{
"relative_path": "references/board-api.md",
"size_in_bytes": 4254
},
{
"relative_path": "references/checks.md",
"size_in_bytes": 5971
},
{
"relative_path": "references/layout.md",
"size_in_bytes": 13242
},
{
"relative_path": "references/manufacturing.md",
"size_in_bytes": 6004
},
{
"relative_path": "references/parts.md",
"size_in_bytes": 3634
},
{
"relative_path": "references/placement.md",
"size_in_bytes": 10203
},
{
"relative_path": "references/review-assembly.md",
"size_in_bytes": 3121
},
{
"relative_path": "references/review-electrical.md",
"size_in_bytes": 3197
},
{
"relative_path": "references/review-fabrication.md",
"size_in_bytes": 3046
},
{
"relative_path": "references/schematic.md",
"size_in_bytes": 13680
},
{
"relative_path": "references/views.md",
"size_in_bytes": 6765
}
],
"name": "pcb",
"skill_md_contents": "---\nname: pcb\ndescription: Designs, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB, PCBWay or another fab, and fabrication files, a BOM, a netlist or a STEP of the board. Not for the enclosure or other mechanical parts, which the cad skill makes.\nlicense: MIT\nmetadata:\n repository: earthtojake/text-to-cad\n---\n\n# PCB design\n\nA board is its native KiCad files: the `.kicad_pcb`, its schematic and its project. text-to-cad reads,\ndraws and inspects them itself, and runs KiCad headless for everything KiCad owns: ERC, DRC, exports\nand edits through its IPC API. There is no board model or build step; the files are the source.\n\n## Start with the task\n\n| Task | Start with | Reference |\n| --- | --- | --- |\n| Read a board or a schematic | `kicad_pcb.read`, `kicad_sch.read` in a script; `cad kicad_pcb inspect` | [Checks](references/checks.md), [schematic](references/schematic.md#read-it) |\n| Draw or edit a schematic | `kicad_sch.edit`, then `cad kicad_sch erc` | [Schematic](references/schematic.md) |\n| Choose parts and footprints | The datasheet, then the project's libraries | [Parts](references/parts.md) |\n| Create or edit a board | `kicad_pcb.edit` ([below](#native-files-are-the-source)) | [Native files](references/board-api.md) |\n| Place and route | The schematic's netlist, one functional group at a time | [Layout](references/layout.md), [placement](references/placement.md) |\n| Check a change | `cad kicad_pcb drc`, snapshots | [Check each change](#check-each-change) |\n| Review before ordering | DRC, then measurements, then the checklist | [Before ordering](#before-ordering) |\n| Export fabrication files, a BOM, or a STEP for an enclosure | `cad kicad_pcb export`, `cad kicad_sch export` | [Manufacturing](references/manufacturing.md) |\n| Show a board or a schematic; what the person can see or pick in it; a missing 3D model | `cad viewer --json FILE` | [Show the model](#show-the-model), [views](references/views.md) |\n\n## Setup\n\nWritten for `cad==0.11.16`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than\n0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists.\n\nIf cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin:\nhttps://github.com/earthtojake/text-to-cad\nA project written for an earlier version may need changes; the migration guides say what:\nhttps://github.com/earthtojake/text-to-cad/tree/main/docs/migrations\n\nReading and inspecting a board or schematic needs no KiCad. DRC, ERC, exports, edits, and drawing a\nboard (its copper pours are refilled on a copy first) run KiCad's own `kicad-cli` and IPC API, which\n`cad` fetches the first time one is needed (kicode: about 100 MB to download, 340 MB on disk, once);\n`cad run` gives a script the same. Things to know about that KiCad:\n\n- **It is a nightly (10.99).** A file it saves is in the nightly's format, which a stable KiCad app\n refuses to open; viewing and snapshots still work, and the viewer tells the person which KiCad on\n this computer can open the file. Say so before the first save of a board the person opens in a\n stable KiCad.\n- **It runs headless with private settings**, never the person's KiCad app or its settings: never open\n a board in KiCad's app to check it. A project library row that names a stock library as KiCad's own\n tables do (`${KICAD10_SYMBOL_DIR}/Device.kicad_sym`) is read from the KiCad the person installed;\n with none installed, ERC warns `lib_symbol_issues` and DRC `lib_footprint_issues`. A project that\n carries its libraries (`${KIPRJMOD}`) needs no KiCad installed.\n- **An edit needs a local socket.** A shell sandbox that refuses sockets (an agent app's default) stops\n an edit at once, saying so: run the script outside the sandbox. Inspecting, DRC, exports and\n snapshots run inside it.\n- **A KiCad the person installed is never run.** Where the fetched one does not run on a computer,\n `CAD_KICAD_CLI` names another `kicad-cli` (KiCad 9 or newer; a nightly's for an edit).\n- **`CAD_KICAD_REFILL=0` in the server's environment turns the refill off**: showing a board then\n downloads nothing, and its pours are drawn as the file saved them.\n\n## Native files are the source\n\nEdit the `.kicad_pcb` itself and keep its `.kicad_pro`, `.kicad_dru`, libraries and schematic beside\nit. Reading or showing a board never writes it. Reread the file before an edit, preserve records and\nUUIDs you do not understand, and never regenerate an existing project from a partial description.\n\nA board changes inside a `with` block that hands over KiPy's open `Board` and saves at the end only if\nthe block changed it; a block that raises saves nothing. `kicad_sch.edit` does the same for a schematic\n([schematic](references/schematic.md#edit-it)). Run the script with `cad run board.py`:\n\n```python\nfrom cad import kicad_pcb\nfrom kicode.util.units import from_mm\n\nBOARD = \"board.kicad_pcb\"\n\nwith kicad_pcb.edit(BOARD) as b: # the board file is the source; the block edits it in place\n power = [t for t in b.get_tracks() if t.net.name in {\"+5V\", \"+3V3\"}]\n for track in power:\n track.width = from_mm(0.8)\n b.update_items(power)\n b.refill_zones()\ndrc = kicad_pcb.drc(BOARD)\nif not drc.ok:\n raise SystemExit(\"\\n\".join(drc.human_lines())) # each finding, then FAILED and the count\nfor kind in (\"gerbers\", \"drill\", \"pos\", \"bom\", \"step\"):\n kicad_pcb.export(BOARD, to=kind, out=f\"fab/{kind}\")\n```\n\n- **State the result, not the change**: \"U1 is at (10, 20)\", \"the power tracks are 0.8 mm\", never\n \"move U1 5 mm\". Set absolute positions, rotations, widths and nets, and create an item only when the\n board does not hold it yet, so a script stopped halfway and run again ends where one run would.\n- **Import KiPy's names from `kicode`** (`from kicode.proto.common.types import KIID`), never from\n `kipy`: the two cannot share a process.\n- **Coordinates are millimetres, y down.** Footprint-local positions and rotations are transformed into\n the board frame; route to a net's actual pad positions.\n- **Refill changed zones** (`b.refill_zones()`) before relying on their fill.\n- KiCad's first start in a new environment can take a minute.\n\nA board's design starts at its schematic, which says what connects to what: read it, check it with ERC\nand look at each sheet before laying out, and hold the board to it after. Place one functional group at\na time, route the nets whose path matters by hand, and direct cad's router (`cad.kicad.route`, inside\nthe edit, with the plan you give it; never a third-party autorouter) through the rest, with widths\nfor each net's current ([layout](references/layout.md)). A plausible-looking layout does not\nestablish electrical correctness: pin numbers, footprint orientation and connector mating side come\nfrom the datasheet.\n\nFor anything the typed commands do not cover, `cad run kicad-cli ...` runs the fetched KiCad's\ncommand line with its own subcommands and flags (`cad run kicad-cli pcb --help`); `CAD_KICAD_CLI`\ndoes not change which one that is:\n\n```bash\ncad run kicad-cli pcb render --side top --rotate -45,0,45 -o tmp/board.png board.kicad_pcb\ncad run kicad-cli project downgrade --dry-run --target 10.0 board.kicad_pro # then -o DIR without --dry-run\n```\n\nMost of its commands write only their `-o` (it may leave a `.kicad_prl` beside a board it reads).\nThese rewrite the source: `pcb upgrade`, `sch upgrade`, `fp upgrade` and `sym upgrade` without `-o`,\nand `pcb drc --refill-zones --save-board`.\n\n## Check each change\n\nCheck the saved board after every step, from the revision you will hand over:\n\n| The change | Check it with |\n| --- | --- |\n| The schematic | `cad kicad_sch erc board.kicad_sch`, and `cad kicad_sch snapshot board.kicad_sch tmp/sheet.png --sheet /Power/` for each sheet changed |\n| Board against schematic | The pin-by-pin comparison in [schematic](references/schematic.md#into-the-board-and-back): every pad on its schematic pin's net |\n| Anything on the board | `cad kicad_pcb drc board.kicad_pcb` (`--json`): KiCad's DRC against the board's own rules. It exits 1 on errors or unconnected items; unconnected items are the routing still to do |\n| Placement | `cad kicad_pcb snapshot board.kicad_pcb tmp/placement.png --display placement`: short, uncrossed ratsnest lines mean a group is placed well |\n| Routing | The layout's [property script](references/layout.md#a-property-check): segments off 45 degrees, detours, width for current |\n| How copper and silkscreen look | `cad kicad_pcb snapshot board.kicad_pcb tmp/copper.png --display copper` ([more views](references/views.md#board-snapshots)) |\n| Ready to order | The review below |\n\n- Warnings count: KiCad's silkscreen, mask and courtyard rules are warnings, and they are what a fab's\n CAM engineer flags.\n- Fix the cause; a rule weakened to get a clean report has shown nothing.\n- A clean DRC establishes the board's own rules, not the circuit's correctness and not the fab's\n limits. A number is measured from the board (`kicad_pcb.read`), never read off a snapshot.\n\n## Before ordering\n\nA review of one board for the fab and assembler it will be ordered from is a guided review, not the\nfab's own engineering check. Gather evidence in this order: KiCad's DRC (every error blocks ordering);\nthen what DRC cannot measure, from the board read back and the project's BOM; then the checklist of\nwhat no command measures.\n\n| Area | Reference | Measured by |\n| --- | --- | --- |\n| Fabrication | [review-fabrication](references/review-fabrication.md) | KiCad's DRC against the board's rules; the rest by inspection |\n| Electrical | [review-electrical](references/review-electrical.md) | The board read back: decoupling distances, narrowest track per net |\n| Assembly and sourcing | [review-assembly](references/review-assembly.md) | The part list and placement file |\n\n### Choosing the rules\n\nUse the chosen fab's own capability page for the board's layer count, copper weight and finish, and\ncompare it with the project's Board Setup, which may differ. Where the person names no fab, review\nagainst JLCPCB's standard service and say so. Record each limit's source, date and conditions; a rule\nthat cannot be checked is reported as missing, never invented. A fab's standard tier is a price, not a\nphysical limit.\n\n### The report\n\nScope first (board file and revision, fab and service, layers, copper, finish, assembled or bare),\nthen the findings, errors first, each naming its parts by board reference (`U2`, `C8`, `#net:VBUS`;\n`kicad_pcb.read(path).resolve(ref)` says where one is), with the evidence, the rule and its source,\nthe result and the fix. Then the coverage: checks run, and checks not run with what they need.\n\n| Item | Evidence | Rule | Result | Fix |\n| --- | --- | --- | --- | --- |\n| `U2` pad 3 to `C8` | measured 3.67 mm centre to centre from the board read back | decoupling within 3 mm (this review's guide) | review | move `C8` beside pin 3 |\n\nThe result is **pass** (measured, within a cited limit), **fail** (a measured violation or a KiCad\nerror), **review** (a risk a person decides) or **unverified** (evidence or the fab's rule is missing).\nNo findings is not a manufacturability approval. A review alone asks for no edits: fix only when\nasked, and recheck the neighbours of every fix.\n\nExport only the deliverables asked for, from the revision you checked\n([manufacturing](references/manufacturing.md)). A DRC or ERC error blocks writing fabrication files\nunless the person says to go ahead, and the report then names every error they went ahead with.\n\n## Show the model\n\nShow the person each model you create or change as soon as its first run succeeds, and any model\nor file they ask to see. A model's page is the `view:` line its run prints, and a file's is the `url`\nthat `cad viewer --json FILE [FILE ...]` prints for it (never guess the port). Show it with\nthe first of these you have:\n\n1. `cad_show` among your tools (your host may prefix it): call it with the model's id or the file's\n absolute path; its description says the rest.\n2. A tool that opens a page in the app's own browser pane, not in the person's own browser (in the\n Claude desktop app, the Browser pane's `preview_start` with the page's `url`, or its `navigate`):\n open the page there yourself, and give the person the link as well.\n3. Neither: give the person the link, to open in their browser.\n\nThe page follows every run of the model. A file you export is a download: give its path. Showing is\nfor the person: to check your own work, review with `cad <type> snapshot`, never a screenshot\nof the page. If it fails to launch, say so.\n\nWhat the board and schematic pages offer the person (layers, selection, 3D, part models), and what\nthey approximate, is in [views](references/views.md).\n"
}SHA-256 of public snapshot: 5431b66a9be50db580ad34bbecd0193c0912da2a1335c96baf3fe875e14f0c6f