> ## Documentation Index
> Fetch the complete documentation index at: https://docs.buildwithtrace.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DRC Import

> Import manufacturer .kicad_dru constraint files to automatically apply their design rules to your project. Name the manufacturer and the AI enforces their limits.

## What It Does

DRC Import lets you load a `.kicad_dru` (KiCad Design Rule) file from any manufacturer and apply their constraints to your project. Name the manufacturer when you import, and the AI uses those constraints for all subsequent design checks — trace widths, clearances, via sizes, and more are enforced in real time.

This bridges the gap between generic DRC (which only catches obvious violations) and manufacturer-specific DRC (which catches the issues that actually cause fab failures). A board that passes generic DRC but violates your fab's minimum annular ring is a board that fails at the factory.

## How to Import

### From the Desktop App

Ask the AI in the chat panel:

```
Load PCBWay 4-layer DRC rules
```

Or import a specific file:

```
Import DRC rules from ./constraints/jlcpcb-4layer.kicad_dru
```

The AI will:

1. Parse the `.kicad_dru` file
2. Apply the constraints to your project
3. Re-run DRC and report any new violations
4. Record the manufacturer target in your `.trace/rules.md` for future sessions

### From the DRC Rule Editor

1. Open **Inspect → DRC Rule Editor**
2. Click **Import Rules** (or drag-and-drop a `.kicad_dru` file)
3. Name the manufacturer source in the dialog
4. Review the imported constraints in the editor panels
5. Save with **Ctrl+S**

### From the CLI

```bash theme={null}
buildwithtrace agent "Import DRC rules from jlcpcb-4layer.kicad_dru for JLCPCB" -p ./my-board/
```

## What Gets Imported

A `.kicad_dru` file can contain any combination of:

| Constraint Type        | Examples                                          |
| ---------------------- | ------------------------------------------------- |
| **Clearance**          | Copper-to-copper, copper-to-edge, drill-to-copper |
| **Track width**        | Minimum, optimum, maximum per net class           |
| **Via size**           | Drill diameter, annular ring, pad size            |
| **Differential pair**  | Coupling gap, impedance-derived width             |
| **Silkscreen**         | Minimum text height, stroke width                 |
| **Courtyard**          | Component-to-component spacing                    |
| **Hole size**          | Minimum drill, maximum aspect ratio               |
| **Custom expressions** | Advanced conditional rules                        |

## How Constraints Flow Into TraceRules

When you import a DRC file and name the manufacturer, the AI records this in your `.trace/rules.md`:

```markdown theme={null}
## Manufacturer
- DRC source: jlcpcb-4layer.kicad_dru (imported 2026-06-05)
- Fab: JLCPCB
- Process: 4-layer, 1oz copper
- Min trace/space: 0.09mm/0.09mm
- Min via drill: 0.2mm
- Min annular ring: 0.13mm
```

This means the AI remembers your manufacturer constraints across sessions — it doesn't just apply them once during import. Every subsequent design change is validated against these limits.

## Manufacturer Presets

Trace ships with built-in presets for common manufacturers. Ask the AI to load one:

| Command                     | Manufacturer                   |
| --------------------------- | ------------------------------ |
| "Load PCBWay 4-layer rules" | PCBWay standard 4-layer        |
| "Load PCBWay 2-layer rules" | PCBWay standard 2-layer        |
| "Load JLCPCB rules"         | JLCPCB standard process        |
| "Load Pikkolo rules"        | Pikkolo Assembly (Denver)      |
| "Load OSH Park rules"       | OSH Park (after dark, 4-layer) |

<Tip>
  Don't see your manufacturer? Any `.kicad_dru` file works. Ask your fab house for their KiCad DRC file, or export one from their online DRC tool.
</Tip>

## Workflow: Import → Design → Validate

<Steps>
  <Step title="Import constraints">
    Load your manufacturer's `.kicad_dru` file or ask the AI to apply a preset.
  </Step>

  <Step title="Design with confidence">
    The AI enforces imported constraints in real time. As it places components and routes traces, it respects your fab's minimums automatically.
  </Step>

  <Step title="Run DRC before ordering">
    A final DRC pass (`Ctrl+Shift+D`) catches any remaining violations. The [Design Review](/concepts/design-review) runs this automatically before manufacturing submission.
  </Step>

  <Step title="Iterate on violations">
    Ask the AI to fix violations: "Fix all clearance violations" or "Widen traces that are below minimum."
  </Step>
</Steps>

## Overriding Imported Rules

Imported rules can be overridden in two ways:

1. **Edit in the DRC Rule Editor** — Open **Inspect → DRC Rule Editor** and modify specific values
2. **Override in TraceRules** — Add a line to `.trace/rules.md` that takes precedence:

```markdown theme={null}
## Routing Conventions
- Override: Allow 4mil trace/space on BGA escape (manufacturer approved)
```

The AI treats TraceRules overrides as intentional engineering decisions and won't flag the overridden constraint as a violation.

<Warning>
  Be careful overriding manufacturer constraints. A rule exists because the fab can't reliably produce features below that limit. Only override when you have explicit written approval from your manufacturer for an exception.
</Warning>

## Creating a .kicad\_dru for Your Manufacturer

If your manufacturer doesn't provide a `.kicad_dru` file directly, you can create one from their capability table:

```
(version 1)

(rule "Minimum Clearance"
  (constraint clearance (min 0.1mm))
)

(rule "Minimum Track Width"
  (constraint track_width (min 0.09mm))
)

(rule "Minimum Via Drill"
  (constraint hole_size (min 0.2mm))
)

(rule "Minimum Via Annular Ring"
  (constraint annular_width (min 0.13mm))
)

(rule "Minimum Drill to Copper"
  (constraint hole_clearance (min 0.254mm))
)

(rule "Board Edge Clearance"
  (constraint edge_clearance (min 0.3mm))
)
```

Save this as `my-manufacturer.kicad_dru` and import it into Trace.

## DRC Categories You Can Ignore

When importing rules, you can tell the AI to suppress certain categories in your TraceRules:

```markdown theme={null}
## DRC Ignore
- Ignore: silkscreen overlap (cosmetic only for prototype)
- Ignore: courtyard clearance on test points
- Ignore: unconnected pin on J1 pin 5 (no-connect by design)
```

The AI will skip these categories during automated checks but will still flag them as "Info" in a full Design Review if you run one manually.

## Related

* [DRC Rule Editor](/concepts/drc-rule-editor) — Visual interface for managing design rules
* [TraceRules](/concepts/tracerules) — Project-specific AI preferences
* [Design Review](/concepts/design-review) — Pre-flight manufacturing validation
* [DFM & the Automated Line](/concepts/dfm-and-the-automated-line) — How DRC fits into the manufacturing pipeline
