KiCad Custom DRC Rules

I got a board sent back by JLCPCB the other day due to a DRC rule I hadn’t come across before:

“If the copper area is less than 30% of the outer layers, then the trace-trace spacing should be at least 0.15 mm.”

This is in contrast to their usual minimum spacing of 0.09 mm. The fix? A custom DRC rule.

(version 1)
(rule top_bottom_clearance
    (constraint clearance (min 0.15mm))
    (condition "A.Layer == 'F.Cu' || A.Layer == 'B.Cu'"))

Worked great!

The KiCad rule editor is reactive and suggests valid keywords as you type, which made writing the rule almost as easy as checking a box.

For more on custom DRC rules, check out the KiCad documentation. Note the custom rules are stored in a .kicad_dru file for rules you reuse frequently.