---
name: design-to-fab
description: Take a board in PCBFlux, the Cogniviz.ai EDA portal, from requirements to fab-ready through ordered gates (requirements, schematic, specs and power, SPICE, service and firmware port, placement, stackup, route, DRC, antenna EM, functional check, fab files), never moving on while a gate is open, and say what to re-run when the user asks for a change. Use for "design this board", "is it ready for printing", "what does this change affect" and any redesign. Works through the portal's MCP tools; use the eda-portal skill for tool details.
---

# Design to fab: ordered gates

DRC proves a board can be made. It does not prove the board does its job, can be tested, or can be updated. Work through the gates **in order**. A gate is closed only when its tool output says so. Do not start the next gate while one is open, and say which gate you are on in every report. Tool arguments are in the `eda-portal` skill.

## Gates

| # | Gate | Do | Closed when |
|---|---|---|---|
| 0 | Requirements | `set_design_spec {requirements, context}`: what the board must do (parts present, link to the main board, mount, firmware and debug port, test points, antenna pitch, config files) as items `{id, text, check}`, and the facts they depend on (main board, camera part, firmware tool) as `context`. Ask the user for numbers you cannot read from the spec | saved in the database; every item has a `check` or is `manual` |
| 1 | Schematic | `kicad_build` `sch_*`, `kicad_erc`; draw it by the Schematic grammar of `pcb-fab-workflow` (wired functional blocks with `kicad_sch_blocks`, power symbols not rail labels, `check_schematic`, look with `kicad_sch_view`) | `check_schematic` pass; ERC 0 errors on a schematic that has the board's parts (a blank schematic does not close this gate: BOM, power and SPICE read the schematic); every part has a footprint |
| 2 | Specs and sourcing | `lookup_parts`, `set_sourcing`, `list_part_specs`; `import-datasheet` skill, then `set_part_spec` with `sources` (library-backed) | every chip has a datasheet-backed spec, none left as an UNVERIFIED ESTIMATE |
| 3 | Power and SPICE | `prepare_analysis`, then write `<circuit>.analysis.json` and `.sim.json` (see `design-simulatable-circuit`); `analyze_circuit`, `run_simulation`, `run_sweep`, `run_thermal` for power LEDs | verdict ok, `expect` ranges pass, no part without a model that matters for the rails |
| 4 | Service and firmware access | `add-diagnostic-port` skill; `.intent.json` and `harness.json`; `check_intent`, `check_harness` | a debug or programming port (SWD, JTAG or UART with boot and reset), test points on each rail, and the link to the main board all exist |
| 5 | Placement | `kicad_sync_pcb`, then `kicad_edit` `set_outline` + `place_footprints`; `check_placement`, `check_layout` (placement group) | no overlaps; parts grouped by function, decoupling capacitors at their chip, heat sources away from sensitive parts, switchers away from clocks and RF (`check_layout` placement has no high or medium finding); antenna group and RF feeds laid out first and kept rigid (see changes below) |
| 6 | Rules and stackup | `set_rules`, `get_board_stackup` | rules fit the fab; an antenna board has its RF substrate and ground defined |
| 7 | Route | `kicad_autoroute` (`require_complete:true`), planes with `add_zone` + `refill_zones`; `check_layout` (routing and width groups) | 0 unconnected; no high or medium `check_layout` routing/width finding left unexplained (45 degree corners, adjacent layers orthogonal, pairs matched, thermal relief, edge clearance, ground and power planes, test point per rail, power tracks wide enough, IPC-2221B spacing above 30 V) |
| 8 | DRC | `kicad_drc`, `kicad_footprint_audit` | 0 errors, 0 unconnected, every warning read and justified |
| 9 | Antenna EM | `prepare_em` (pick the antenna by footprint: `ref`), `<circuit>.em.json`, `run_em`, `get_em` (only if the board has an antenna); `check_layout` W2 for the feed line impedance | `expect` passes on the board's own copper (`real_copper: true`; a typed-in ideal patch does not move the gate), at the real stackup and pitch; for a radar, transmit-to-receive coupling with `ports` and `expect.isolation_min_db` |
| 10 | Functional | `check_requirements`, `verify_design` | no `fail` item; every `needs_human` item shown to the user, and recorded with `confirm_requirement` only after the user says it is confirmed (never on your own judgement) |
| 11 | Fab output | `get_3d_image`, `make_bom`, `kicad_fab`, then `kicad_fab_preview` top and bottom | files made; the order itself is the user's (the portal never orders) |

## The checklist (use it on every revision)

Gates 1, 3, 5, 7 and 8 have steps (`get_checklist` lists them; mark with `set_checklist` `step`). Gate 7 is routing, then heatsink vias (`kicad_edit via_array`, checked with `run_board_thermal`; defer with a reason when no part needs them), then pours and stitching (`add_zone`, `stitch_vias`, `check_zones`, `check_voltage_drop` on the power rails). Set the outline with its corner radius at gate 5, before any copper.

The portal keeps the 12 gates, the requirements, the context and the history per circuit in its database (nothing is stored as project files). `get_design_spec` returns the requirements, context and who changed which gate when. `get_checklist {project, circuit}` shows each as open, done, deferred or **stale**, and `next`. Saving a file reopens the done gates it touches as stale, with the reason and revision, so you never guess what to redo and never redo what the change did not reach. Start every session and every change with `get_checklist`; work the stale and open gates in order; after a gate's tool result is clean, `set_checklist {gate, status:"done", note: <the evidence>}`. Deferring needs a reason. These close or reopen their gate by themselves from the tool result: `kicad_erc` (1), `check_intent` (4), `check_placement` and `check_layout` (5; `check_layout` routing or width problems reopen 7), `kicad_autoroute` when saved (7), `kicad_drc` (8), `run_em` (9), `check_requirements` (10), `kicad_fab` (11). Gates 2, 3 and 6 you mark by hand. Do not mark a gate done on a guess.

After any change, `run_tests {project, circuit}` re-runs the checks behind gates 1, 3, 4, 8, 9 and 10 (plus the schematic-to-board net comparison) in one call and gives one verdict. A stage that is `unknown` (the tool could not run, the tests are not written, a person must confirm, the result is stale) blocks exactly like `fail`: never report a board as passing with an unknown stage. When the sim.json has no `assert` block, `suggest_tests` drafts one from the declared rails and the dividers; read each draft's basis before saving it.

## What may be skipped

Only things that can be added later without touching the design: a **3D/STEP model** that does not exist yet, and a **part that is unavailable or out of stock** while its footprint and datasheet spec are done (choose an alternate later). Mark the requirement `defer: "<reason>"` and list every deferred item in each report. Never defer ERC, DRC, power or SPICE results, the service and firmware port, test access, antenna results or a missing footprint: a gap there costs a respin.

## When the user asks for a change

Find the earliest gate the change touches (`get_checklist` already marks it stale after the save), undo nothing, and re-run from there to the end. Each edit is a revision, so note the current `rev` first.

| Change | Re-run from |
|---|---|
| New or changed requirement | 0, then every gate it names |
| Part added, removed or swapped (same footprint) | 1 -> 2, 3, 4, 10, 11 |
| Different footprint | 5 -> 7, 8, 10, 11 (and a new 3D model) |
| Net or connection change | 1 -> 3, 4, 5 (`kicad_sync_pcb`), 7, 8, 10, 11 |
| Rail voltage, load or regulator change | 3 -> 4 (intent levels), 10 |
| Add a debug or firmware port, test points | 1 -> 4, 5, 7, 8, 10 |
| Move parts | 7 -> 8, 10; 9 if an antenna or its feed moved |
| Resize the board | Keep the antenna group at its designed pitch (never scale it): move other parts only; then 5 -> 7, 8, 9, 10 |
| Layer count or stackup | 6 -> 7, 8, 9 (the RF substrate changes antenna resonance and line impedance), 10 |
| Design rules (width, clearance, via) | 7 -> 8 |
| Antenna element, pitch or feed | 9 -> 5, 7, 8, 10 |
| Fab or supplier choice, BOM override | 2 -> 11 |
| Firmware pinout change | 4 -> 1 if a pin moves, 10 |

Rules of thumb: anything routed is invalid after a move or a net change, so remove those tracks and route again before DRC. Antenna spacing and feed length are part of the antenna, not of the layout: if either changes, gate 9 re-opens. After a change, report which gates re-opened, which stayed closed, and the new `rev`.

## Reporting

Each report: current gate, closed gates with the tool result that closed them, open items, deferred items with reasons, the `rev`, and what is estimated (power, thermal, EM and part specs are approximate). Do not call a board ready until gates 0 to 10 are closed.
