Skip to content
Skills Library
Programming · Testing

run_drc

/run_drc

Run KiCad's Design Rules Check on a PCB layout, sort the violations and unrouted connections, judge pass or fail, and record the result in the twin pinned to the board revision it checked. Use when the user asks to run DRC, check a board for clearance, track width, courtyard or unrouted-net problems, asks whether a layout is ready for Gerbers or fab, or when a flow gate needs DRC evidence.

Repository
metaforge ↗
Licence
Apache-2.0
Last repository change
27.10.2026

Assessment and security

95/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Run KiCad's Design Rules Check on a PCB layout, sort the violations and unrouted connections, judge pass or fail, and record the result in the twin pinned to the board revision it checked. Use when the user asks to run DRC, check a board for clearance, track width, courtyard or unrouted-net problems, asks whether a layout is ready for Gerbers or fab, or when a flow gate needs DRC evidence.

Original author description

Run KiCad's Design Rules Check on a PCB layout, sort the violations and unrouted connections, judge pass or fail, and record the result in the twin pinned to the board revision it checked. Use when the user asks to run DRC, check a board for clearance, track width, courtyard or unrouted-net problems, asks whether a layout is ready for Gerbers or fab, or when a flow gate needs DRC evidence.

How it works

  1. When to use it
  2. Tools and profile
  3. Inputs you need before you start
  4. Procedure
  5. Checks before you report
  6. Failure handling
  7. Limits
Original SKILL.md headings · 172 lines, 1,519 words
SKILL.md preview
---
name: run_drc
description: Run KiCad's Design Rules Check on a PCB layout, sort the violations and unrouted connections, judge pass or fail, and record the result in the twin pinned to the board revision it checked. Use when the user asks to run DRC, check a board for clearance, track width, courtyard or unrouted-net problems, asks whether a layout is ready for Gerbers or fab, or when a flow gate needs DRC evidence.
domain: electronics
---

# run_drc

Check a KiCad PCB layout against its design rules with KiCad's own DRC, and
leave behind a result a reviewer can trust: which board and revision was
checked, which rules applied, every error, warning and unrouted connection,
and a pass or fail that follows a stated rule.

## When to use it

- "Run DRC on the FC board."
- "Is the layout ready to export Gerbers?"
- "Are there any clearance violations on the power section?"
- A design-flow phase or requirement asks for DRC evidence before the board
  is released to manufacture.

Not for: the schematic (use `run_erc` and `kicad.run_erc`), exporting
manufacturing files (`kicad.export_gerber`, after DRC is clean), impedance or
signal-integrity analysis (no tool on this server does that), or fixing the
layout: MetaForge's KiCad support is read-only in this phase.

## Tools and profile

`kicad.*` is served on the **`electronics`** profile. `twin.stage_work_product_file`
is on `mechanical`, `simulation` and `robotics`, and `twin.record_document`
is on `core`. A connection with no `?profile=` serves all of them. If a tool
below is missing, call `health.check`, read its `profile` field, and tell the
user which profile (or no profile) they need.

| Step | Tool | Profile |
|---|---|---|
| Check the adapter is up | `health.check` | all |
| Find the board work product | `twin.get_node`, `metaforge://twin/brief/<project_id>` | all |
| Put the file where KiCad can read it | `twin.stage_work_product_file` | mechanical, simulation, robotics, no profile |
| Run DRC | `kicad.run_drc` | electronics |
| Manufacturing export, only once clean | `kicad.export_gerber` | electronics |
| Record the result | `twin.record_document` | core |
| Record an accepted violation | `twin.record_decision` | all |
| Link to a requirement | `twin.record_evidence` (only if listed) | not on the dev server |

## Inputs you need before you start

Ask the user for anything missing. Do not pick a board or a rule set for them.

| Input | Why it matters | Example |
|---|---|---|
| Which board | The result is only valid for that file and revision | `FC-Main` .kicad_pcb, or a twin node id |
| Where the file lives | `kicad.run_drc` runs inside the KiCad adapter container and can only open paths on its filesystem | a twin work product to stage, or a path in the shared adapter workspace |
| Which rules apply | KiCad keeps the board's constraints and net classes in the project file (.kicad_pro) and custom rules in a .kicad_dru file next to the board; a board staged alone runs without them | "the fab's 6/6 mil rules are in the project file" |
| What counts as a pass | Default rule: zero errors and zero unrouted connections, warnings reported | "warnings must be zero for release" |
| Known accepted violations | Some are deliberate (a net tie, a silkscreen overlap) | "the antenna keepout warning is expected" |

## Procedure

### 1. Check the connection

Call `health.check`. If `unreachable_adapters` names `kicad`, stop and tell
the user: every `kicad.*` call will fail with `-32001` until the KiCad
adapter container is running.

### 2. Find the board and get a path KiCad can open

1. If the board was imported into the project (dashboard or gateway import
   creates a `pcb_layout` work product), find it in
   `metaforge://twin/brief/<project_id>` or with `twin.get_node`. Note the
   node id and revision: the result is pinned to both.
2. Call `twin.stage_work_product_file` with `node_id`. It writes the file
   into the shared adapter workspace, which the KiCad adapter mounts, and
   returns `file_path`.
3. If the board is not in the twin, ask the user for a path the adapter can
   read. A file in the user's own repo is not visible to the container unless
   that folder is mounted into it. Do not invent a path.
4. Staging copies one file. If the board's rules live in its .kicad_pro or a
   .kicad_dru, tell the user the check ran without them unless those files
   sit beside the board in the workspace. A DRC that ran on default rules is
   not evidence that the fab's rules are met.

### 3. Run DRC

Call `kicad.run_drc` with:

- `pcb_file`: the path from step 2
- `severity_filter`: `"all"`. Filtering hides findings from the list. It
  does not change `passed`, which counts every error.
- `rule_set` (optional): custom design rules, either a path to a
  `.kicad_dru` file on the adapter or the rules text itself. KiCad has no
  rules flag, so the tool runs DRC on a copy of the board with these rules
  as its `.kicad_dru`. The result's `rule_set_applied` says whether that
  happened; only say custom rules were applied when it is `true`.

Read from the result: `total_violations`, `errors`, `warnings`,
`unconnected_items`, `rule_set_applied`, `passed`, and `violations`. Each violation has
`rule_id` (KiCad's type, for example `clearance` or `track_width`),
`severity`, `message`, and `location` as an object with `x`, `y` (board
coordinates in KiCad's report units, millimetres by default) and `layer`.

### 4. Judge the result

- `unconnected_items` counts nets KiCad considers unrouted. They are not in
  `violations` and not in `errors`, but a board with any is not ready for
  manufacture. Report the count every time.
- `passed` is true with zero error-severity violations and zero unconnected
  items, counted before any severity filter. Warnings do not fail it; report
  them. This is the same rule the `run_drc` skill applies. If the user set a
  stricter one (zero warnings), apply theirs and say so.
- If `total_violations` is not `errors + warnings`, list the violations with
  another severity separately.
- Group by `rule_id` and layer; give the location of each error so the user
  can find it in KiCad.
- Explain what each error means for fabrication or assembly. Do not present a
  layout fix as fact; the user owns the board.

### 5. Record the result

Only when the user asked for it, or a flow phase needs it:

1. `twin.record_document` with `document_type: "documentation"`, a `name`
   like `DRC, FC-Main, rev 7`, `content` holding the verdict and rule, which
   rules were in effect (project file present or not), counts, unrouted
   count, each error with location, warnings grouped, and
   `source_part_node_ids: [<board node id>]`.
2. If `twin.record_evidence` is in your tool list, record evidence with
   `producer: {"tool": "kicad.run_drc"}`, `inputs` (file, filter, whether the
   project rules were present), `result` set to the tool's own output
   unchanged, `supports` or `contradicts` naming the requirement, and
   `valid_against` naming the board work product. If it is not listed, tell
   the user the requirement link was not recorded on this connection.
3. A violation the user accepts rather than fixes goes to
   `twin.record_decision` with `title`, `rationale` and `alternatives`.

### 6. Report

- Verdict, rule used, board and revision, and which design rules were in
  effect
- Errors (with location and layer), warnings grouped, unrouted connections
- Whether the board is ready for `kicad.export_gerber`, and if not, what
  blocks it
- What was recorded, with node ids

## Checks before you report

- [ ] `kicad` reachable, or you said it is not
- [ ] The board checked is the one the user meant, at a known revision
- [ ] You know whether the project rules were present; you said so
- [ ] Ran with `severity_filter: "all"`
- [ ] `unconnected_items` reported, and counted against the verdict
- [ ] `total_violations` equals `errors + warnings`, or the rest are listed
- [ ] Custom rules claimed only when `rule_set_applied` is `true`

## Failure handling

| Symptom | Likely cause | What to do |
|---|---|---|
| `-32001` naming `kicad` | KiCad adapter container is down | Tell the user; do not retry in a loop. |
| kicad-cli not found | The adapter image has no KiCad 8 | Report it; DRC cannot run on this server. |
| File not found, or kicad-cli fails with no report | Path not on the adapter's filesystem, or not a .kicad_pcb | Stage with `twin.stage_work_product_file`, or ask for an adapter-visible path. |
| Far fewer violations than KiCad shows the user | Board ran without its .kicad_pro / .kicad_dru rules | Say so; ask for the project files in the workspace and run again. |
| Timed out | Large board (limit is about 120 s) | Report it; do not loop. |
| `kicad.run_drc` not in your list | Connection is not on `electronics` | Check `health.check` `profile`; ask the user to reconnect. |
| Staging or recording tools not in your list | `electronics` does not serve them | Ask for a no-profile connection, or report without recording and say so. |
| A record call held for approval | Writes need a person on this connection | Tell the user where it waits; do not retry or reword. |

## Limits

- Detection only; MetaForge cannot edit the layout in this phase.
- A `rule_set` replaces any `.kicad_dru` beside the board for that run; it
  is not merged with it.
- Standard DRC only: no controlled-impedance, length matching beyond what
  the board's own rules encode, thermal or current-capacity analysis.
- A result belongs to the revision it ran on. After the board changes, run
  it again before exporting Gerbers.

Versions

The database has no other skills named run_drc.

Identical content appears in 3 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 8f19f1a0fdf5 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95run_erc
    Run KiCad's Electrical Rules Check on a schematic, sort the violations into errors and warnings, judge pass or fail on errors, and record the result in the twin pinned to the schematic it checked. Use when the user asks to run ERC, check a schematic for electrical errors, asks…
  • 100kicad-review
    Design review and validation workflow for KiCAD projects via MCP tools. Triggers on: "review my design", "check for errors", "audit", "DRC", "ERC", "find problems", "design review", "is this ready", "validate", "check my schematic", "check my PCB", "what's wrong", "run checks", "pre-fab review".
  • 100pb-pcb-to-case
    From a KiCad board to a parametric enclosure that fits it: ERC and DRC clean, board dimensions extracted, an OpenSCAD case with your clearance, Gerbers exported, fab hand-off only after GO. Use for "PCB to enclosure", "case for this board", "KiCad to OpenSCAD case".
  • 90makeirl-release-gate
    Check a KiCad 9 board before manufacturing with the MakeIRL MCP. Use when asked to run ERC, DRC, schematic-to-PCB parity, BOM completeness, or export checks on a KiCad project, to explain BLOCKED, REVIEW, or READY findings, or to prepare a board release.
  • 95design_pcb
    Generate a KiCad 9 schematic, PCB and routing through MetaForge from the circuit the user and you have worked out (parts as KiCad symbols and footprints, nets as REF.PIN), each step checked by KiCad's own ERC, DRC and schematic parity, and record the result. Use when the user…
  • 100kicad-pcb
    Workflow skill for KiCAD PCB layout and routing via MCP tools. Triggers on: "layout the board", "route traces", "PCB", "place footprints", "copper pour", "board outline", "differential pair", "board setup", "track width", "via", "zone", "design rules", "stackup", "silkscreen".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.