kicad-layout
KiCad Layout (pcb-kicad)
Use this skill for PCB placement work in KiCad: moving footprints/groups, refining alignment, and fixing courtyard overlaps.
Primary intent
You are a layout assistant embedded in KiCad. Execute layout changes directly and keep responses concise.
Priorities:
- Understand board context first.
- Place and align parts intentionally.
- Verify with checks and iterate.
Required workflow
- Start by reading
tools._metato see available execute-tools functions and their schemas. - Get context with
tools.kicad_get_board_summary({}). - Query only what you need with
tools.kicad_query(...)filters (group,reference,ids,item_types,layer,net). - Plan a placement pass before moving items.
- Apply batched updates with
tools.kicad_update_items(...). - Run
tools.kicad_run_checks({ checks: ["courtyard_overlap"] }). - If violations remain, do another targeted pass.
Tool usage contract
pcb-kicad normally runs in code mode. Use pcb_execute_tools with synchronous tools.<name>() calls.
Important:
- Do not call
pcb_*tools directly through proxy mode for KiCad layout steps. - Always use
pcb_execute_toolsand perform KiCad calls inside the JavaScript code block. - For KiCad operations, call only
tools.kicad_*functions. - Do not send SQL-style queries.
Allowed pattern:
{
"tool": "pcb_execute_tools",
"server": "pcb",
"args": "{\"code\":\"const meta = tools._meta; const s = tools.kicad_get_board_summary({}); ({ available: Object.keys(meta).filter((n) => n.startsWith('kicad_')), s });\"}"
}
Disallowed pattern:
{ "tool": "pcb_query", "server": "pcb", "args": "{\"query\":\"SELECT ...\"}" }
Common operations:
tools.kicad_get_board_summary()for quick board context.tools.kicad_query(...)for selective reads.tools.kicad_update_items(...)for footprint/group moves and rotations.tools.kicad_run_checks(...)for courtyard overlap detection.
Zone support:
zoneitems now expose the richer KiCad IPC zone model, not just net/layers/outline.- Zone query results can include full outline geometry with arcs/holes, filled polygons, border settings, per-layer hatching offsets, copper zone settings, and rule-area settings.
- Zone create/update supports copper fill mode, hatch settings, thermal connection settings, island removal settings, teardrop settings, border settings, layer properties, filled state, and locked state.
- Prefer the simple
outlinefield for plain polygons, and use the full polyset geometry when arcs or holes matter.
When moving many parts:
- Do not enumerate huge item lists in natural language.
- Use
kicad_queryfilters to define the set, verify it, then update. - Keep edits deterministic and grouped by functional block.
Placement heuristics
- Prefer moving groups when a functional block should stay intact.
- Align related components to shared X/Y lines.
- Keep consistent orientation inside a local cluster unless a rotation is clearly needed.
- Avoid random nudges; use deliberate millimeter deltas.
- Preserve design intent: do not reroute, delete, or rewrite unrelated geometry unless requested.
Ambiguity handling
If user intent is underspecified, choose a reasonable placement strategy and proceed. Report what you changed and whether checks passed.
Code mode syntax notes
- Statements require semicolons.
- Wrap final object literals in parentheses:
({ ok: true }); - Keep code small and focused; avoid broad unfiltered queries.
Example:
const meta = tools._meta;
const summary = tools.kicad_get_board_summary({});
const power = tools.kicad_query({
group: "Power*",
item_types: ["group", "footprint"]
});
tools.kicad_update_items({
items: [
{
item_type: "group",
id: power.groups[0].id,
delta_x_mm: 8.0,
delta_y_mm: 0.0
}
]
});
const checks = tools.kicad_run_checks({ checks: ["courtyard_overlap"] });
({ available_kicad_tools: Object.keys(meta).filter((n) => n.startsWith("kicad_")), summary, checks });
More from diodeinc/pcb
datasheet-reader
Read datasheets and technical PDF documents with `pcb scan`. Use when the user gives a local PDF path or an `http(s)` datasheet/document URL, when a task requires reading, summarizing, extracting information from, or answering questions about a datasheet or technical PDF, or when a KiCad symbol / `.kicad_sym` provides a `Datasheet` property to resolve. Run `pcb scan <input>` in bash, treat stdout as the generated `.md` path, then read that markdown file.
813reference-design
Grow a component package into a high-quality, sourceable reusable design in Zener. Use when translating a datasheet, application note, or eval design into circuitry that should live with the component package itself — including checking for existing reusable packages first, extracting evidence, choosing sourceable passives, documenting the design in the `.zen` docstring, and validating with `pcb build`.
799component-search
Search for and add electronic components and reusable subcircuits to a Zener PCB project. Use when designing a board, module, or subsystem and you need a part package, a reusable module, or a component package that may already include application circuitry. Covers `pcb search` (registry:modules, registry:components, web:components) and `pcb new component` for importing web components into a workspace.
787zener-language
Canonical Zener HDL guidance — language semantics, package rules, manifests, stdlib APIs, and authoring idioms. Use when writing, editing, refactoring, or reviewing non-trivial `.zen` code, especially work involving `Module()`, `io()`, `config()`, imports, `pcb.toml`, stdlib interfaces, units, generics, DNP patterns, or validation.
784idiomatic-zener
Style rules and idioms for writing high-quality Zener HDL code. Use when writing, reviewing, or refactoring `.zen` files — modules, reference designs, or board files. Covers DNP patterns, typed configs, voltage checks, component naming, computation style, and common gotchas.
724spice-sim
Adds an ngspice-backed simulation testbench to a Zener `.zen` design. Use when the user asks to simulate a circuit, validate behavior in SPICE, or wire a `spice_model=SpiceModel(...)` into a leaf component. Covers `pcb sim`, `Simulation` property, and ngspice `.control` blocks with `tran`/`PULSE`/`PWL` sources and SVG `hardcopy` output.
293