← Commit history
README.md+32
@@ -27,6 +27,38 @@ To add or fix a limit, edit the record and run `python3 tools/generate.py`.   `condition` and in `notes`. Values are never averaged. - `n/p` below means the vendor does not publish that limit. +## Published limits and profiles++Every Adom user gets the same default for a fab: its **published** limits, exactly as the fab+states them, nothing stricter and nothing looser. Where a fab splits a limit (inner vs outer+layer, via vs component hole, copper weight), the rules split it the same way rather than+taking the worst case everywhere.++People have different comfort margins and taste. Someone may want 1 mil of extra spacing; someone+else pushes silkscreen text as small as the fab allows. Those choices are **profiles**: a file in+`rules/profiles/` that names its author and says why, and either overrides limits (as errors),+adds preferences (as warnings, never errors), or freezes a reviewed set of files.+`tools/generate.py` writes each profile's files beside the published ones as+`<vendor>[-<process>]-<n>L-<profile>.<ext>`, and `rules/index.json` lists them under their pack.+You pick a pack and a profile at the start of a design (AI Flow asks), and you can switch later.++| Profile | Fab | Author | What it changes |+|---|---|---|---|+| `circuit-forge-strict` | PCBWay standard 4L | Josh Aberdeen (Circuit Forge) | 5 mil track width on every layer (published inner: 4 mil) and 0.45 mm hole spacing for every pair (published via to via: 0.30 mm). Frozen at the bytes reviewed in PR #9. |++To add your own, put a profile JSON in `rules/profiles/` and open a PR:++```json+{"name": "small-silk", "vendorSlug": "jlcpcb", "process": "standard", "layerCount": 2,+ "author": "<you>", "why": "<why you want it>",+ "overrides": {"minSpacing": {"mm": 0.127}},+ "preferences": {"silkMinTextHeight": {"mm": 0.6}}}+```++`overrides` replace published limits and fail DRC. `preferences` (`silkMinTextHeight`,+`minTraceWidth`) only warn. A change to a published record needs the fab's own page as its source;+anything else is a profile (`tools/test_profiles.py` refuses margin wording in a record).+ ## Vendors  3rd party fab (baseline, first by design), JLCPCB, PCBWay, OSH Park,
SKILL.md+3−1
@@ -27,6 +27,7 @@ or Altium; a bridge needs the rule files for `fusion_set_design_rules   EAGLE `.dru` text, per vendor, process and layer count. - `kicad/`: `.kicad_dru` custom rules plus `.board-setup.json` constraints. - `altium/`: `.RUL` ASCII exports (generated, not yet import-verified).+- `rules/profiles/`: opt-in profiles on top of a published record (an author, a why, overrides as errors, preferences as warnings, or frozen reviewed files). Their files sit beside the published ones as `<pack>-<profile>.<ext>` and `rules/index.json` lists them under the pack. - `tools/generate.py`: regenerates every file from the records. - `verification/`: dated proof that the generated files load in real EDA   tools, with screenshots.@@ -55,7 +56,8 @@ The page.json `discovery_triggers` registry entry reads: 3. For "load rules into Fusion", send the `.edru` with `send_files` then    `fusion_electron_run {"command": "drc load <path>"}` and confirm    `fusion_alerts` is empty.-4. If a vendor or limit is missing, check the vendor's own capabilities+4. Records hold ONLY what the fab publishes. A stricter margin or a taste (bigger or smaller silkscreen text) is a profile in `rules/profiles/`, never an edit to the record; offer the user the published pack first and list the profiles for it.+5. If a vendor or limit is missing, check the vendor's own capabilities    page, add a record, run `python3 tools/generate.py`, commit and push.    A rule change is a publish, not a bridge release. 
altium/pcbway-4L-circuit-forge-strict.RULadded+44
@@ -0,0 +1,44 @@+[Design Rules]+RuleCount=6++[Rule1]+RuleKind=Width+RuleName=MinTraceWidth+Scope1=All+Scope2=+Attribute=MinWidth=0.127mm|PreferredWidth=0.254mm|MaxWidth=25.4mm++[Rule2]+RuleKind=Clearance+RuleName=MinClearance+Scope1=All+Scope2=+Attribute=Clearance=0.1524mm++[Rule3]+RuleKind=RoutingViaStyle+RuleName=MinVia+Scope1=All+Scope2=+Attribute=PreferredViaWidth=0.5mm|PreferredViaHoleWidth=0.2mm|MinViaWidth=0.5mm|MaxViaWidth=6.35mm|MinViaHoleWidth=0.2mm|MaxViaHoleWidth=6.35mm++[Rule4]+RuleKind=HoleSize+RuleName=MinHole+Scope1=All+Scope2=+Attribute=HoleWidth=0.2mm++[Rule5]+RuleKind=AnnularRing+RuleName=MinAnnularRing+Scope1=All+Scope2=+Attribute=MinAnnularRing=0.15mm++[Rule6]+RuleKind=BoardOutlineClearance+RuleName=CopperToBoardEdge+Scope1=All+Scope2=+Attribute=Clearance=0.25mm
fusion/pcbway-4L-circuit-forge-strict.druadded+71
@@ -0,0 +1,71 @@+description[PCBWay 4-layer design rules (standard process) |  | Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.  | Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. | Min drill: 0.2 mm (7.87 mil) | Min via: 0.2 mm hole / 0.5 mm pad | Annular ring: via 0.15 mm, pad 0.254 mm | Copper to board edge: 0.25 mm | Hole to hole: 0.45 mm | Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm | Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz | Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin | Max board size: 508 x 600 mm |  | Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1. |  | Sources: | - https://www.pcbway.com/capabilities.html (read 2026-09-03) | - https://www.pcbway.com/capabilities.html (read 2026-11-02) | - https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02) | - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02) | - https://m.pcbway.com/capabilities.html (read 2026-11-02)]++layerSetup = (1*2*15*16)+mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm+mtIsolate = 1.6mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm+mdWireWire = 6.0mil+mdWirePad = 6.0mil+mdWireVia = 6.0mil+mdPadPad = 6.0mil+mdPadVia = 6.0mil+mdViaVia = 6.0mil+mdSmdPad = 6.0mil+mdSmdVia = 6.0mil+mdSmdSmd = 6.0mil+mdCopperDimension = 9.84mil+mdDrill = 17.72mil+msWidth = 5.0mil+msDrill = 7.87mil+mdViaViaSameLayer = 6mil+mdSmdStop = 0mil+msMicroVia = 12mil+msBlindViaRatio = 0.5+rvPadTop = 0+rvPadInner = 0+rvPadBottom = 0+rvViaOuter = 0+rvViaInner = 0+rvMicroViaOuter = 0+rvMicroViaInner = 0+rlMinPadTop = 10.0mil+rlMaxPadTop = 80mil+rlMinPadInner = 10.0mil+rlMaxPadInner = 20mil+rlMinPadBottom = 10.0mil+rlMaxPadBottom = 80mil+rlMinViaOuter = 5.91mil+rlMaxViaOuter = 20mil+rlMinViaInner = 5.91mil+rlMaxViaInner = 20mil+rlMinMicroViaOuter = 5.91mil+rlMaxMicroViaOuter = 20mil+rlMinMicroViaInner = 5.91mil+rlMaxMicroViaInner = 20mil+psTop = -1+psBottom = -1+psFirst = -1+psElongationLong = 100+psElongationOffset = 100+mvStopFrame = 0+mvCreamFrame = 0+mlMinStopFrame = 1.5mil+mlMaxStopFrame = 4mil+mlMinCreamFrame = 0mil+mlMaxCreamFrame = 0mil+mlViaStopLimit = 20mil+srRoundness = 0+srMinRoundness = 0mil+srMaxRoundness = 0mil+slThermalIsolate = 10mil+slThermalsForVias = 0+dpMaxLengthDifference = 400mil+dpGapFactor = 2.5+checkAngle = 0+checkRestrict = 1+checkStop = 0+checkValues = 0+checkNames = 1+checkWireStubs = 1+checkPolygonWidth = 0+useDiameter = 13+maxErrors = 50
fusion/pcbway-4L-circuit-forge-strict.edruadded+148
@@ -0,0 +1,148 @@+<?xml version="1.0" encoding="utf-8"?>+<!DOCTYPE designrules SYSTEM "eagle.dtd">+<eagle version="9.7.0">+<designrules name="pcbway-4L.edru">+<classes>+<class number="0" name="default">+</class>+<class number="1" name="pwr">+</class>+</classes>+<rules>+<rulecategory type="Copper Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Keepout Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Solder-Mask Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Dimension Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Drill Distance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Restrict Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Minimum Drill Size" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Minimum Copper Width" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Acute Angle" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Air-Wire" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Small Gap" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Wire Stub" manualdrc="yes" livedrc="no"/>+ <rulecategory type="Matched Lengths" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Via Restrict Clearance" manualdrc="yes" livedrc="yes"/>+ <rule type="Minimum Copper Width" enabled="yes" priority="0" onescope="classes=1" value="0.127mm" preferredvalue="0.381mm" check_polywidth="no" name="Trace size for Power"/>+ <rule type="Minimum Copper Width" builtin_ruleid="14" enabled="yes" priority="1" value="0.127mm" preferredvalue="0.254mm" check_polywidth="no" name="minimum-copper-width-1"/>+ <rule type="Minimum Drill Size" enabled="yes" priority="0" onescope="is_via" value="0.2mm" preferredvalue="0.4mm" name="Min Via hole size on 4-layer"/>+ <rule type="Minimum Drill Size" enabled="no" priority="1" onescope="all" value="0.5mm" preferredvalue="0.5mm" name="Min Non-plated holes"/>+ <rule type="Minimum Drill Size" builtin_ruleid="15" enabled="yes" priority="2" value="0.2mm" preferredvalue="0.4mm" name="minimum-drill-size-1"/>+ <rule type="Acute Angle" builtin_ruleid="16" enabled="no" priority="0" name="acute-angle-1"/>+ <rule type="Wire Stub" builtin_ruleid="17" enabled="yes" priority="0" name="wire-stub-1"/>+ <rule type="Air-Wire" builtin_ruleid="19" enabled="yes" priority="0" name="air-wire-1"/>+ <rule type="Matched Lengths" builtin_ruleid="20" enabled="yes" priority="0" tolerance="10mm" gapfactor="2.5" name="matched-lengths-1"/>+ <rule type="Copper Clearance" enabled="no" priority="0" onescope="all" otherscope="all" value="0.25mm" preferredvalue="0.25mm" samesignal="yes" bothscope="all" name="Same-net track spacing"/>+ <rule type="Copper Clearance" builtin_ruleid="0" enabled="yes" priority="1" onescope="is_wire_polygon" otherscope="is_wire_polygon" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-1"/>+ <rule type="Copper Clearance" builtin_ruleid="1" enabled="yes" priority="2" onescope="is_wire_polygon" otherscope="is_pad_smd" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-2"/>+ <rule type="Copper Clearance" builtin_ruleid="2" enabled="yes" priority="3" onescope="is_wire_polygon" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-3"/>+ <rule type="Copper Clearance" builtin_ruleid="3" enabled="yes" priority="4" onescope="is_pad_smd" otherscope="is_pad_smd" value="0.1524mm" preferredvalue="0.1524mm" samesignal="no" name="copper-clearance-4"/>+ <rule type="Copper Clearance" builtin_ruleid="4" enabled="yes" priority="5" onescope="is_pad_smd" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-5"/>+ <rule type="Copper Clearance" builtin_ruleid="5" enabled="yes" priority="6" onescope="is_via" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-6"/>+ <rule type="Copper Clearance" builtin_ruleid="6" enabled="yes" priority="7" onescope="is_smd" otherscope="is_pad" value="0.1524mm" preferredvalue="0.3048mm" samesignal="yes" name="copper-clearance-7"/>+ <rule type="Copper Clearance" builtin_ruleid="7" enabled="yes" priority="8" onescope="is_smd" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="yes" name="copper-clearance-8"/>+ <rule type="Copper Clearance" builtin_ruleid="8" enabled="yes" priority="9" onescope="is_smd" otherscope="is_smd" value="0.1524mm" preferredvalue="0.3048mm" samesignal="yes" name="copper-clearance-9"/>+ <rule type="Dimension Clearance" builtin_ruleid="9" enabled="yes" priority="0" value="0.25mm" preferredvalue="0.4mm" name="dimension-clearance-1"/>+ <rule type="Via Restrict Clearance" builtin_ruleid="21" enabled="yes" priority="0" value="0mil" preferredvalue="0mil" name="via-restrict-clearance-1"/>+ <rule type="Restrict Clearance" builtin_ruleid="10" enabled="yes" priority="0" value="0mil" preferredvalue="0mil" name="restrict-clearance-1"/>+ <rule type="Small Gap" builtin_ruleid="18" enabled="yes" priority="0" name="small-gap-1"/>+ <rule type="Solder-Mask Clearance" builtin_ruleid="11" enabled="no" priority="0" value="0mil" preferredvalue="0mil" check_name="yes" check_value="no" name="solder-mask-clearance-1"/>+ <rule type="Drill Distance" builtin_ruleid="12" enabled="yes" priority="0" value="0.45mm" preferredvalue="0.45mm" name="drill-distance-1"/>+ <rule type="Keepout Clearance" builtin_ruleid="13" enabled="yes" priority="0" value="0mil" preferredvalue="0mil" name="keepout-clearance-1"/>+ </rules>+<param name="mdWireWire" value="0.1524mm"/>+<param name="mdWirePad" value="0.1524mm"/>+<param name="mdWireVia" value="0.1524mm"/>+<param name="mdPadPad" value="0.1524mm"/>+<param name="mdPadVia" value="0.1524mm"/>+<param name="mdViaVia" value="0.1524mm"/>+<param name="mdSmdPad" value="0.1524mm"/>+<param name="mdSmdVia" value="0.1524mm"/>+<param name="mdSmdSmd" value="0.1524mm"/>+<param name="mdCopperDimension" value="0.25mm"/>+<param name="mdDrill" value="0.45mm"/>+<param name="msWidth" value="0.127mm"/>+<param name="msDrill" value="0.2mm"/>+<param name="dpMaxLengthDifference" value="10mm"/>+<param name="dpGapFactor" value="2.5"/>+<description language="en">PCBWay 4-layer design rules (standard process)++Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. +Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.+Min drill: 0.2 mm (7.87 mil)+Min via: 0.2 mm hole / 0.5 mm pad+Annular ring: via 0.15 mm, pad 0.254 mm+Copper to board edge: 0.25 mm+Hole to hole: 0.45 mm+Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm+Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz+Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin+Max board size: 508 x 600 mm++Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1.++Sources:+- https://www.pcbway.com/capabilities.html (read 2026-09-03)+- https://www.pcbway.com/capabilities.html (read 2026-11-02)+- https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02)+- https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02)+- https://m.pcbway.com/capabilities.html (read 2026-11-02)+</description>+<param name="layerSetup" value="(1*2*15*16)"/>+<param name="mtCopper" value="0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm"/>+<param name="mtIsolate" value="1.6mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm"/>+<param name="mdViaViaSameLayer" value="6mil"/>+<param name="mnLayersViaInSmd" value="2"/>+<param name="mdSmdStop" value="0mil"/>+<param name="msMicroVia" value="0.3mm"/>+<param name="msBlindViaRatio" value="0.5"/>+<param name="rvPadTop" value="0"/>+<param name="rvPadInner" value="0"/>+<param name="rvPadBottom" value="0"/>+<param name="rvViaOuter" value="0"/>+<param name="rvViaInner" value="0"/>+<param name="rvMicroViaOuter" value="0"/>+<param name="rvMicroViaInner" value="0"/>+<param name="rlMinPadTop" value="0.254mm"/>+<param name="rlMaxPadTop" value="80mil"/>+<param name="rlMinPadInner" value="0.254mm"/>+<param name="rlMaxPadInner" value="20mil"/>+<param name="rlMinPadBottom" value="0.254mm"/>+<param name="rlMaxPadBottom" value="80mil"/>+<param name="rlMinViaOuter" value="0.15mm"/>+<param name="rlMaxViaOuter" value="20mil"/>+<param name="rlMinViaInner" value="0.15mm"/>+<param name="rlMaxViaInner" value="20mil"/>+<param name="rlMinMicroViaOuter" value="0.15mm"/>+<param name="rlMaxMicroViaOuter" value="20mil"/>+<param name="rlMinMicroViaInner" value="0.15mm"/>+<param name="rlMaxMicroViaInner" value="20mil"/>+<param name="psTop" value="-1"/>+<param name="psBottom" value="-1"/>+<param name="psFirst" value="-1"/>+<param name="psElongationLong" value="100"/>+<param name="psElongationOffset" value="100"/>+<param name="mvStopFrame" value="0"/>+<param name="mvCreamFrame" value="0"/>+<param name="mlMinStopFrame" value="0.038mm"/>+<param name="mlMaxStopFrame" value="4mil"/>+<param name="mlMinCreamFrame" value="0mil"/>+<param name="mlMaxCreamFrame" value="0mil"/>+<param name="mlViaStopLimit" value="0.5mm"/>+<param name="srRoundness" value="0"/>+<param name="srMinRoundness" value="0mil"/>+<param name="srMaxRoundness" value="0mil"/>+<param name="slThermalIsolate" value="10mil"/>+<param name="slThermalsForVias" value="0"/>+<param name="checkAngle" value="0"/>+<param name="checkRestrict" value="1"/>+<param name="checkStop" value="0"/>+<param name="checkValues" value="0"/>+<param name="checkNames" value="1"/>+<param name="checkWireStubs" value="1"/>+<param name="checkPolygonWidth" value="0"/>+<param name="useDiameter" value="13"/>+<param name="removeAnnularRing" value="0"/>+<param name="maxErrors" value="50"/>+ </designrules>+</eagle>
fusion/pcbway-4L.dru+1−1
@@ -1,4 +1,4 @@-description[PCBWay 4-layer design rules (standard process) |  | Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.  | Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. | Min drill: 0.2 mm (7.87 mil) | Min via: 0.2 mm hole / 0.5 mm pad | Annular ring: via 0.15 mm, pad 0.254 mm | Copper to board edge: 0.25 mm | Hole to hole: 0.45 mm | Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm | Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz | Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin | Max board size: 508 x 600 mm |  | Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1. |  | Sources: | - https://www.pcbway.com/capabilities.html (read 2026-09-03) | - https://www.pcbway.com/capabilities.html (read 2026-11-02) | - https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02) | - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02) | - https://m.pcbway.com/capabilities.html (read 2026-11-02)]+description[PCBWay 4-layer design rules (standard process) |  | Min trace width: 0.127 mm (5.0 mil) - outer layers, 1oz (35um) conventional: 5mil (capabilities table, 'min width/spacing of outer layer', archive sha 694ce30266e8) | Min spacing: 0.1524 mm (6.0 mil) - outer layers, 1oz conventional: 6mil (capabilities table). Inner layers publish 5mil (minSpacingInner), but KiCad cannot set a per-layer clearance floor without a custom clearance rule, which overrides netclass spacing; the board floor therefore uses the outer value, 1mil above the published inner minimum. | Min drill: 0.2 mm (7.87 mil) | Min via: 0.2 mm hole / 0.5 mm pad | Annular ring: via 0.15 mm, pad 0.254 mm | Copper to board edge: 0.25 mm | Hole to hole: 0.45 mm | Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm | Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz | Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin | Max board size: 508 x 600 mm |  | Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1. |  | Sources: | - https://www.pcbway.com/capabilities.html (read 2026-09-03) | - https://www.pcbway.com/capabilities.html (read 2026-11-02) | - https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02) | - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02) | - https://m.pcbway.com/capabilities.html (read 2026-11-02)]  layerSetup = (1*2*15*16) mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm
fusion/pcbway-4L.edru+2−2
@@ -67,8 +67,8 @@ <param name="dpGapFactor" value="2.5"/> <description language="en">PCBWay 4-layer design rules (standard process) -Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. -Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.+Min trace width: 0.127 mm (5.0 mil) - outer layers, 1oz (35um) conventional: 5mil (capabilities table, 'min width/spacing of outer layer', archive sha 694ce30266e8)+Min spacing: 0.1524 mm (6.0 mil) - outer layers, 1oz conventional: 6mil (capabilities table). Inner layers publish 5mil (minSpacingInner), but KiCad cannot set a per-layer clearance floor without a custom clearance rule, which overrides netclass spacing; the board floor therefore uses the outer value, 1mil above the published inner minimum. Min drill: 0.2 mm (7.87 mil) Min via: 0.2 mm hole / 0.5 mm pad Annular ring: via 0.15 mm, pad 0.254 mm
kicad/pcbway-4L-circuit-forge-strict.board-setup.jsonadded+50
@@ -0,0 +1,50 @@+{+  "vendor": "PCBWay",+  "process": "standard",+  "layerCount": 4,+  "boardSetupConstraints": {+    "minTrackWidthMm": 0.127,+    "minClearanceMm": 0.1524,+    "minPadClearanceMm": null,+    "minViaDrillMm": 0.2,+    "minViaDiameterMm": 0.5,+    "minHoleMm": 0.2,+    "copperEdgeClearanceMm": 0.25,+    "holeToHoleMm": 0.45,+    "annularRingViaMm": 0.15,+    "annularRingPadMm": 0.254,+    "silkMinLineWidthMm": 0.15,+    "maskExpansionMm": 0.0508+  },+  "notes": "Apply as Board Setup, Constraints. Apply the matching .kicad_dru alongside the board and project with the same stem. This JSON is an adapter contract, not a native .kicad_pro file. Separate pad/via rules and pad-pair clearance need custom rules. Confirm loaded source hashes and native negative-control findings before claiming enforcement.",+  "sources": [+    {+      "url": "https://www.pcbway.com/capabilities.html",+      "dateRead": "2026-09-03"+    },+    {+      "url": "https://www.pcbway.com/capabilities.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "694ce30266e8c0bde8173d590c3ac71e6d928eb730fad3555e6a1dd298e0a980",+      "note": "observational archive; page footer '\u00a9 2024 PCBWay' only; no vendor revision date"+    },+    {+      "url": "https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "9cebdeed859c3c61d4e104185aa5e6a54fb1a5c6ac5864591fbd5993479145e1",+      "note": "official PCBWay Engineering Questions page; states last updated 2025-06-25"+    },+    {+      "url": "https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "51142afe99832cc0ee41af19bf7d4c552a2658da466f04850523fab09bb66948",+      "note": "official PCBWay tolerances page; PTH ring 0.20 and via ring 0.15 (PTH ring weaker than capabilities table, not used)"+    },+    {+      "url": "https://m.pcbway.com/capabilities.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "d7be6170136dad3df83304c5e34dab85775f7df80e632d8de8eae85969da3357",+      "note": "mobile capabilities page (summary only): drill 0.2 min, trace/spacing 4mil min with 6mil suggested, annular 0.15"+    }+  ]+}
kicad/pcbway-4L-circuit-forge-strict.kicad_druadded+76
@@ -0,0 +1,76 @@+(version 1)++# PCBWay 4-layer design rules (standard process)+# +# Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. +# Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.+# Min drill: 0.2 mm (7.87 mil)+# Min via: 0.2 mm hole / 0.5 mm pad+# Annular ring: via 0.15 mm, pad 0.254 mm+# Copper to board edge: 0.25 mm+# Hole to hole: 0.45 mm+# Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm+# Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz+# Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin+# Max board size: 508 x 600 mm+# +# Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1.+# +# Sources:+# - https://www.pcbway.com/capabilities.html (read 2026-09-03)+# - https://www.pcbway.com/capabilities.html (read 2026-11-02)+# - https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02)+# - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02)+# - https://m.pcbway.com/capabilities.html (read 2026-11-02)++(rule "min-track-width"+  (severity error)+  (constraint track_width (min 0.127mm)))++(rule "min-hole"+  (severity error)+  (constraint hole_size (min 0.2mm)))++(rule "min-via-hole"+  (severity error)+  (constraint hole_size (min 0.2mm))+  (condition "A.Type == 'Via'"))++(rule "min-via-diameter"+  (severity error)+  (constraint via_diameter (min 0.5mm))+  (condition "A.Type == 'Via'"))++(rule "min-via-annular-width"+  (severity error)+  (constraint annular_width (min 0.15mm))+  (condition "A.Type == 'Via'"))++(rule "min-pad-annular-width"+  (severity error)+  (constraint annular_width (min 0.254mm))+  (condition "A.Type == 'Pad' && A.Pad_Type == 'Through-hole'"))++(rule "min-edge-clearance"+  (severity error)+  (constraint edge_clearance (min 0.25mm)))++(rule "min-hole-to-hole"+  (severity error)+  (constraint hole_to_hole (min 0.45mm)))++(rule "min-hole-to-inner-copper"+  (severity error)+  (constraint hole_clearance (min 0.1778mm)))++(rule "min-silk-height"+  (severity error)+  (constraint text_height (min 0.8mm))+  (layer "*.SilkS")+  (condition "A.Type == 'Text' || A.Type == 'Text Box'"))++(rule "min-silk-thickness"+  (severity error)+  (constraint text_thickness (min 0.15mm))+  (layer "*.SilkS")+  (condition "A.Type == 'Text' || A.Type == 'Text Box'"))
kicad/pcbway-4L.board-setup.json+2−2
@@ -3,14 +3,14 @@   "process": "standard",   "layerCount": 4,   "boardSetupConstraints": {-    "minTrackWidthMm": 0.127,+    "minTrackWidthMm": 0.1016,     "minClearanceMm": 0.1524,     "minPadClearanceMm": null,     "minViaDrillMm": 0.2,     "minViaDiameterMm": 0.5,     "minHoleMm": 0.2,     "copperEdgeClearanceMm": 0.25,-    "holeToHoleMm": 0.45,+    "holeToHoleMm": 0.3,     "annularRingViaMm": 0.15,     "annularRingPadMm": 0.254,     "silkMinLineWidthMm": 0.15,
kicad/pcbway-4L.kicad_dru+17−6
@@ -2,8 +2,8 @@  # PCBWay 4-layer design rules (standard process) # -# Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. -# Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.+# Min trace width: 0.127 mm (5.0 mil) - outer layers, 1oz (35um) conventional: 5mil (capabilities table, 'min width/spacing of outer layer', archive sha 694ce30266e8)+# Min spacing: 0.1524 mm (6.0 mil) - outer layers, 1oz conventional: 6mil (capabilities table). Inner layers publish 5mil (minSpacingInner), but KiCad cannot set a per-layer clearance floor without a custom clearance rule, which overrides netclass spacing; the board floor therefore uses the outer value, 1mil above the published inner minimum. # Min drill: 0.2 mm (7.87 mil) # Min via: 0.2 mm hole / 0.5 mm pad # Annular ring: via 0.15 mm, pad 0.254 mm@@ -23,9 +23,15 @@ # - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02) # - https://m.pcbway.com/capabilities.html (read 2026-11-02) -(rule "min-track-width"+(rule "min-track-width-outer"   (severity error)-  (constraint track_width (min 0.127mm)))+  (constraint track_width (min 0.127mm))+  (layer outer))++(rule "min-track-width-inner"+  (severity error)+  (constraint track_width (min 0.1016mm))+  (layer inner))  (rule "min-hole"   (severity error)@@ -55,9 +61,14 @@   (severity error)   (constraint edge_clearance (min 0.25mm))) -(rule "min-hole-to-hole"+(rule "min-hole-to-hole-via"+  (severity error)+  (constraint hole_to_hole (min 0.3mm)))++(rule "min-hole-to-hole-component"   (severity error)-  (constraint hole_to_hole (min 0.45mm)))+  (constraint hole_to_hole (min 0.45mm))+  (condition "A.Type == 'Pad' || B.Type == 'Pad'"))  (rule "min-hole-to-inner-copper"   (severity error)
rules/index.json+16
@@ -1078,6 +1078,22 @@           "archiveSha256": "d7be6170136dad3df83304c5e34dab85775f7df80e632d8de8eae85969da3357",           "note": "mobile capabilities page (summary only): drill 0.2 min, trace/spacing 4mil min with 6mil suggested, annular 0.15"         }+      ],+      "profiles": [+        {+          "name": "circuit-forge-strict",+          "author": "Josh Aberdeen (Circuit Forge)",+          "why": "Circuit Forge's opt-in strict profile for PCBWay standard 4-layer 1 oz, reviewed in PR #9 (2026-11-02). Stricter than PCBWay's published minimums in two places, by choice: 5 mil track width on every layer (published inner: 4 mil) and 0.45 mm hole spacing for every pair (published via to via: 0.30 mm). Frozen at the reviewed bytes so Circuit Forge's gate keeps matching their hashes.",+          "frozen": true,+          "definition": "rules/profiles/pcbway-4L-circuit-forge-strict.json",+          "files": {+            "kicad_dru": "kicad/pcbway-4L-circuit-forge-strict.kicad_dru",+            "board-setup.json": "kicad/pcbway-4L-circuit-forge-strict.board-setup.json",+            "dru": "fusion/pcbway-4L-circuit-forge-strict.dru",+            "edru": "fusion/pcbway-4L-circuit-forge-strict.edru",+            "RUL": "altium/pcbway-4L-circuit-forge-strict.RUL"+          }+        }       ]     },     {
rules/profiles/files/pcbway-4L-circuit-forge-strict.RULadded+44
@@ -0,0 +1,44 @@+[Design Rules]+RuleCount=6++[Rule1]+RuleKind=Width+RuleName=MinTraceWidth+Scope1=All+Scope2=+Attribute=MinWidth=0.127mm|PreferredWidth=0.254mm|MaxWidth=25.4mm++[Rule2]+RuleKind=Clearance+RuleName=MinClearance+Scope1=All+Scope2=+Attribute=Clearance=0.1524mm++[Rule3]+RuleKind=RoutingViaStyle+RuleName=MinVia+Scope1=All+Scope2=+Attribute=PreferredViaWidth=0.5mm|PreferredViaHoleWidth=0.2mm|MinViaWidth=0.5mm|MaxViaWidth=6.35mm|MinViaHoleWidth=0.2mm|MaxViaHoleWidth=6.35mm++[Rule4]+RuleKind=HoleSize+RuleName=MinHole+Scope1=All+Scope2=+Attribute=HoleWidth=0.2mm++[Rule5]+RuleKind=AnnularRing+RuleName=MinAnnularRing+Scope1=All+Scope2=+Attribute=MinAnnularRing=0.15mm++[Rule6]+RuleKind=BoardOutlineClearance+RuleName=CopperToBoardEdge+Scope1=All+Scope2=+Attribute=Clearance=0.25mm
rules/profiles/files/pcbway-4L-circuit-forge-strict.board-setup.jsonadded+50
@@ -0,0 +1,50 @@+{+  "vendor": "PCBWay",+  "process": "standard",+  "layerCount": 4,+  "boardSetupConstraints": {+    "minTrackWidthMm": 0.127,+    "minClearanceMm": 0.1524,+    "minPadClearanceMm": null,+    "minViaDrillMm": 0.2,+    "minViaDiameterMm": 0.5,+    "minHoleMm": 0.2,+    "copperEdgeClearanceMm": 0.25,+    "holeToHoleMm": 0.45,+    "annularRingViaMm": 0.15,+    "annularRingPadMm": 0.254,+    "silkMinLineWidthMm": 0.15,+    "maskExpansionMm": 0.0508+  },+  "notes": "Apply as Board Setup, Constraints. Apply the matching .kicad_dru alongside the board and project with the same stem. This JSON is an adapter contract, not a native .kicad_pro file. Separate pad/via rules and pad-pair clearance need custom rules. Confirm loaded source hashes and native negative-control findings before claiming enforcement.",+  "sources": [+    {+      "url": "https://www.pcbway.com/capabilities.html",+      "dateRead": "2026-09-03"+    },+    {+      "url": "https://www.pcbway.com/capabilities.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "694ce30266e8c0bde8173d590c3ac71e6d928eb730fad3555e6a1dd298e0a980",+      "note": "observational archive; page footer '\u00a9 2024 PCBWay' only; no vendor revision date"+    },+    {+      "url": "https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "9cebdeed859c3c61d4e104185aa5e6a54fb1a5c6ac5864591fbd5993479145e1",+      "note": "official PCBWay Engineering Questions page; states last updated 2025-06-25"+    },+    {+      "url": "https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "51142afe99832cc0ee41af19bf7d4c552a2658da466f04850523fab09bb66948",+      "note": "official PCBWay tolerances page; PTH ring 0.20 and via ring 0.15 (PTH ring weaker than capabilities table, not used)"+    },+    {+      "url": "https://m.pcbway.com/capabilities.html",+      "dateRead": "2026-11-02",+      "archiveSha256": "d7be6170136dad3df83304c5e34dab85775f7df80e632d8de8eae85969da3357",+      "note": "mobile capabilities page (summary only): drill 0.2 min, trace/spacing 4mil min with 6mil suggested, annular 0.15"+    }+  ]+}
rules/profiles/files/pcbway-4L-circuit-forge-strict.druadded+71
@@ -0,0 +1,71 @@+description[PCBWay 4-layer design rules (standard process) |  | Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.  | Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. | Min drill: 0.2 mm (7.87 mil) | Min via: 0.2 mm hole / 0.5 mm pad | Annular ring: via 0.15 mm, pad 0.254 mm | Copper to board edge: 0.25 mm | Hole to hole: 0.45 mm | Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm | Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz | Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin | Max board size: 508 x 600 mm |  | Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1. |  | Sources: | - https://www.pcbway.com/capabilities.html (read 2026-09-03) | - https://www.pcbway.com/capabilities.html (read 2026-11-02) | - https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02) | - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02) | - https://m.pcbway.com/capabilities.html (read 2026-11-02)]++layerSetup = (1*2*15*16)+mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm+mtIsolate = 1.6mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm+mdWireWire = 6.0mil+mdWirePad = 6.0mil+mdWireVia = 6.0mil+mdPadPad = 6.0mil+mdPadVia = 6.0mil+mdViaVia = 6.0mil+mdSmdPad = 6.0mil+mdSmdVia = 6.0mil+mdSmdSmd = 6.0mil+mdCopperDimension = 9.84mil+mdDrill = 17.72mil+msWidth = 5.0mil+msDrill = 7.87mil+mdViaViaSameLayer = 6mil+mdSmdStop = 0mil+msMicroVia = 12mil+msBlindViaRatio = 0.5+rvPadTop = 0+rvPadInner = 0+rvPadBottom = 0+rvViaOuter = 0+rvViaInner = 0+rvMicroViaOuter = 0+rvMicroViaInner = 0+rlMinPadTop = 10.0mil+rlMaxPadTop = 80mil+rlMinPadInner = 10.0mil+rlMaxPadInner = 20mil+rlMinPadBottom = 10.0mil+rlMaxPadBottom = 80mil+rlMinViaOuter = 5.91mil+rlMaxViaOuter = 20mil+rlMinViaInner = 5.91mil+rlMaxViaInner = 20mil+rlMinMicroViaOuter = 5.91mil+rlMaxMicroViaOuter = 20mil+rlMinMicroViaInner = 5.91mil+rlMaxMicroViaInner = 20mil+psTop = -1+psBottom = -1+psFirst = -1+psElongationLong = 100+psElongationOffset = 100+mvStopFrame = 0+mvCreamFrame = 0+mlMinStopFrame = 1.5mil+mlMaxStopFrame = 4mil+mlMinCreamFrame = 0mil+mlMaxCreamFrame = 0mil+mlViaStopLimit = 20mil+srRoundness = 0+srMinRoundness = 0mil+srMaxRoundness = 0mil+slThermalIsolate = 10mil+slThermalsForVias = 0+dpMaxLengthDifference = 400mil+dpGapFactor = 2.5+checkAngle = 0+checkRestrict = 1+checkStop = 0+checkValues = 0+checkNames = 1+checkWireStubs = 1+checkPolygonWidth = 0+useDiameter = 13+maxErrors = 50
rules/profiles/files/pcbway-4L-circuit-forge-strict.edruadded+148
@@ -0,0 +1,148 @@+<?xml version="1.0" encoding="utf-8"?>+<!DOCTYPE designrules SYSTEM "eagle.dtd">+<eagle version="9.7.0">+<designrules name="pcbway-4L.edru">+<classes>+<class number="0" name="default">+</class>+<class number="1" name="pwr">+</class>+</classes>+<rules>+<rulecategory type="Copper Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Keepout Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Solder-Mask Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Dimension Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Drill Distance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Restrict Clearance" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Minimum Drill Size" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Minimum Copper Width" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Acute Angle" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Air-Wire" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Small Gap" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Wire Stub" manualdrc="yes" livedrc="no"/>+ <rulecategory type="Matched Lengths" manualdrc="yes" livedrc="yes"/>+ <rulecategory type="Via Restrict Clearance" manualdrc="yes" livedrc="yes"/>+ <rule type="Minimum Copper Width" enabled="yes" priority="0" onescope="classes=1" value="0.127mm" preferredvalue="0.381mm" check_polywidth="no" name="Trace size for Power"/>+ <rule type="Minimum Copper Width" builtin_ruleid="14" enabled="yes" priority="1" value="0.127mm" preferredvalue="0.254mm" check_polywidth="no" name="minimum-copper-width-1"/>+ <rule type="Minimum Drill Size" enabled="yes" priority="0" onescope="is_via" value="0.2mm" preferredvalue="0.4mm" name="Min Via hole size on 4-layer"/>+ <rule type="Minimum Drill Size" enabled="no" priority="1" onescope="all" value="0.5mm" preferredvalue="0.5mm" name="Min Non-plated holes"/>+ <rule type="Minimum Drill Size" builtin_ruleid="15" enabled="yes" priority="2" value="0.2mm" preferredvalue="0.4mm" name="minimum-drill-size-1"/>+ <rule type="Acute Angle" builtin_ruleid="16" enabled="no" priority="0" name="acute-angle-1"/>+ <rule type="Wire Stub" builtin_ruleid="17" enabled="yes" priority="0" name="wire-stub-1"/>+ <rule type="Air-Wire" builtin_ruleid="19" enabled="yes" priority="0" name="air-wire-1"/>+ <rule type="Matched Lengths" builtin_ruleid="20" enabled="yes" priority="0" tolerance="10mm" gapfactor="2.5" name="matched-lengths-1"/>+ <rule type="Copper Clearance" enabled="no" priority="0" onescope="all" otherscope="all" value="0.25mm" preferredvalue="0.25mm" samesignal="yes" bothscope="all" name="Same-net track spacing"/>+ <rule type="Copper Clearance" builtin_ruleid="0" enabled="yes" priority="1" onescope="is_wire_polygon" otherscope="is_wire_polygon" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-1"/>+ <rule type="Copper Clearance" builtin_ruleid="1" enabled="yes" priority="2" onescope="is_wire_polygon" otherscope="is_pad_smd" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-2"/>+ <rule type="Copper Clearance" builtin_ruleid="2" enabled="yes" priority="3" onescope="is_wire_polygon" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-3"/>+ <rule type="Copper Clearance" builtin_ruleid="3" enabled="yes" priority="4" onescope="is_pad_smd" otherscope="is_pad_smd" value="0.1524mm" preferredvalue="0.1524mm" samesignal="no" name="copper-clearance-4"/>+ <rule type="Copper Clearance" builtin_ruleid="4" enabled="yes" priority="5" onescope="is_pad_smd" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-5"/>+ <rule type="Copper Clearance" builtin_ruleid="5" enabled="yes" priority="6" onescope="is_via" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="no" name="copper-clearance-6"/>+ <rule type="Copper Clearance" builtin_ruleid="6" enabled="yes" priority="7" onescope="is_smd" otherscope="is_pad" value="0.1524mm" preferredvalue="0.3048mm" samesignal="yes" name="copper-clearance-7"/>+ <rule type="Copper Clearance" builtin_ruleid="7" enabled="yes" priority="8" onescope="is_smd" otherscope="is_via" value="0.1524mm" preferredvalue="0.3048mm" samesignal="yes" name="copper-clearance-8"/>+ <rule type="Copper Clearance" builtin_ruleid="8" enabled="yes" priority="9" onescope="is_smd" otherscope="is_smd" value="0.1524mm" preferredvalue="0.3048mm" samesignal="yes" name="copper-clearance-9"/>+ <rule type="Dimension Clearance" builtin_ruleid="9" enabled="yes" priority="0" value="0.25mm" preferredvalue="0.4mm" name="dimension-clearance-1"/>+ <rule type="Via Restrict Clearance" builtin_ruleid="21" enabled="yes" priority="0" value="0mil" preferredvalue="0mil" name="via-restrict-clearance-1"/>+ <rule type="Restrict Clearance" builtin_ruleid="10" enabled="yes" priority="0" value="0mil" preferredvalue="0mil" name="restrict-clearance-1"/>+ <rule type="Small Gap" builtin_ruleid="18" enabled="yes" priority="0" name="small-gap-1"/>+ <rule type="Solder-Mask Clearance" builtin_ruleid="11" enabled="no" priority="0" value="0mil" preferredvalue="0mil" check_name="yes" check_value="no" name="solder-mask-clearance-1"/>+ <rule type="Drill Distance" builtin_ruleid="12" enabled="yes" priority="0" value="0.45mm" preferredvalue="0.45mm" name="drill-distance-1"/>+ <rule type="Keepout Clearance" builtin_ruleid="13" enabled="yes" priority="0" value="0mil" preferredvalue="0mil" name="keepout-clearance-1"/>+ </rules>+<param name="mdWireWire" value="0.1524mm"/>+<param name="mdWirePad" value="0.1524mm"/>+<param name="mdWireVia" value="0.1524mm"/>+<param name="mdPadPad" value="0.1524mm"/>+<param name="mdPadVia" value="0.1524mm"/>+<param name="mdViaVia" value="0.1524mm"/>+<param name="mdSmdPad" value="0.1524mm"/>+<param name="mdSmdVia" value="0.1524mm"/>+<param name="mdSmdSmd" value="0.1524mm"/>+<param name="mdCopperDimension" value="0.25mm"/>+<param name="mdDrill" value="0.45mm"/>+<param name="msWidth" value="0.127mm"/>+<param name="msDrill" value="0.2mm"/>+<param name="dpMaxLengthDifference" value="10mm"/>+<param name="dpGapFactor" value="2.5"/>+<description language="en">PCBWay 4-layer design rules (standard process)++Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. +Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.+Min drill: 0.2 mm (7.87 mil)+Min via: 0.2 mm hole / 0.5 mm pad+Annular ring: via 0.15 mm, pad 0.254 mm+Copper to board edge: 0.25 mm+Hole to hole: 0.45 mm+Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm+Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz+Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin+Max board size: 508 x 600 mm++Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1.++Sources:+- https://www.pcbway.com/capabilities.html (read 2026-09-03)+- https://www.pcbway.com/capabilities.html (read 2026-11-02)+- https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02)+- https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02)+- https://m.pcbway.com/capabilities.html (read 2026-11-02)+</description>+<param name="layerSetup" value="(1*2*15*16)"/>+<param name="mtCopper" value="0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm"/>+<param name="mtIsolate" value="1.6mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm"/>+<param name="mdViaViaSameLayer" value="6mil"/>+<param name="mnLayersViaInSmd" value="2"/>+<param name="mdSmdStop" value="0mil"/>+<param name="msMicroVia" value="0.3mm"/>+<param name="msBlindViaRatio" value="0.5"/>+<param name="rvPadTop" value="0"/>+<param name="rvPadInner" value="0"/>+<param name="rvPadBottom" value="0"/>+<param name="rvViaOuter" value="0"/>+<param name="rvViaInner" value="0"/>+<param name="rvMicroViaOuter" value="0"/>+<param name="rvMicroViaInner" value="0"/>+<param name="rlMinPadTop" value="0.254mm"/>+<param name="rlMaxPadTop" value="80mil"/>+<param name="rlMinPadInner" value="0.254mm"/>+<param name="rlMaxPadInner" value="20mil"/>+<param name="rlMinPadBottom" value="0.254mm"/>+<param name="rlMaxPadBottom" value="80mil"/>+<param name="rlMinViaOuter" value="0.15mm"/>+<param name="rlMaxViaOuter" value="20mil"/>+<param name="rlMinViaInner" value="0.15mm"/>+<param name="rlMaxViaInner" value="20mil"/>+<param name="rlMinMicroViaOuter" value="0.15mm"/>+<param name="rlMaxMicroViaOuter" value="20mil"/>+<param name="rlMinMicroViaInner" value="0.15mm"/>+<param name="rlMaxMicroViaInner" value="20mil"/>+<param name="psTop" value="-1"/>+<param name="psBottom" value="-1"/>+<param name="psFirst" value="-1"/>+<param name="psElongationLong" value="100"/>+<param name="psElongationOffset" value="100"/>+<param name="mvStopFrame" value="0"/>+<param name="mvCreamFrame" value="0"/>+<param name="mlMinStopFrame" value="0.038mm"/>+<param name="mlMaxStopFrame" value="4mil"/>+<param name="mlMinCreamFrame" value="0mil"/>+<param name="mlMaxCreamFrame" value="0mil"/>+<param name="mlViaStopLimit" value="0.5mm"/>+<param name="srRoundness" value="0"/>+<param name="srMinRoundness" value="0mil"/>+<param name="srMaxRoundness" value="0mil"/>+<param name="slThermalIsolate" value="10mil"/>+<param name="slThermalsForVias" value="0"/>+<param name="checkAngle" value="0"/>+<param name="checkRestrict" value="1"/>+<param name="checkStop" value="0"/>+<param name="checkValues" value="0"/>+<param name="checkNames" value="1"/>+<param name="checkWireStubs" value="1"/>+<param name="checkPolygonWidth" value="0"/>+<param name="useDiameter" value="13"/>+<param name="removeAnnularRing" value="0"/>+<param name="maxErrors" value="50"/>+ </designrules>+</eagle>
rules/profiles/files/pcbway-4L-circuit-forge-strict.kicad_druadded+76
@@ -0,0 +1,76 @@+(version 1)++# PCBWay 4-layer design rules (standard process)+# +# Min trace width: 0.127 mm (5.0 mil) - 4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. +# Min spacing: 0.1524 mm (6.0 mil) - 4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil.+# Min drill: 0.2 mm (7.87 mil)+# Min via: 0.2 mm hole / 0.5 mm pad+# Annular ring: via 0.15 mm, pad 0.254 mm+# Copper to board edge: 0.25 mm+# Hole to hole: 0.45 mm+# Board thickness options: 0.6 mm, 0.8 mm, 1.0 mm, 1.2 mm, 1.6 mm, 2.0 mm, 2.4 mm+# Copper weight options: 0.5 oz, 1 oz, 1.5 oz, 2 oz, 3 oz, 4 oz+# Surface finishes: HASL with lead, HASL lead free, Immersion gold (ENIG), OSP, Immersion Tin+# Max board size: 508 x 600 mm+# +# Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1.+# +# Sources:+# - https://www.pcbway.com/capabilities.html (read 2026-09-03)+# - https://www.pcbway.com/capabilities.html (read 2026-11-02)+# - https://www.pcbway.com/helpcenter/Engineering_Questions/limited_holes_spacing.html (read 2026-11-02)+# - https://www.pcbway.com/pcb_prototype/PCB_Manufacturing_tolerances.html (read 2026-11-02)+# - https://m.pcbway.com/capabilities.html (read 2026-11-02)++(rule "min-track-width"+  (severity error)+  (constraint track_width (min 0.127mm)))++(rule "min-hole"+  (severity error)+  (constraint hole_size (min 0.2mm)))++(rule "min-via-hole"+  (severity error)+  (constraint hole_size (min 0.2mm))+  (condition "A.Type == 'Via'"))++(rule "min-via-diameter"+  (severity error)+  (constraint via_diameter (min 0.5mm))+  (condition "A.Type == 'Via'"))++(rule "min-via-annular-width"+  (severity error)+  (constraint annular_width (min 0.15mm))+  (condition "A.Type == 'Via'"))++(rule "min-pad-annular-width"+  (severity error)+  (constraint annular_width (min 0.254mm))+  (condition "A.Type == 'Pad' && A.Pad_Type == 'Through-hole'"))++(rule "min-edge-clearance"+  (severity error)+  (constraint edge_clearance (min 0.25mm)))++(rule "min-hole-to-hole"+  (severity error)+  (constraint hole_to_hole (min 0.45mm)))++(rule "min-hole-to-inner-copper"+  (severity error)+  (constraint hole_clearance (min 0.1778mm)))++(rule "min-silk-height"+  (severity error)+  (constraint text_height (min 0.8mm))+  (layer "*.SilkS")+  (condition "A.Type == 'Text' || A.Type == 'Text Box'"))++(rule "min-silk-thickness"+  (severity error)+  (constraint text_thickness (min 0.15mm))+  (layer "*.SilkS")+  (condition "A.Type == 'Text' || A.Type == 'Text Box'"))
rules/profiles/pcbway-4L-circuit-forge-strict.jsonadded+15
@@ -0,0 +1,15 @@+{+  "name": "circuit-forge-strict",+  "vendorSlug": "pcbway",+  "process": "standard",+  "layerCount": 4,+  "author": "Josh Aberdeen (Circuit Forge)",+  "why": "Circuit Forge's opt-in strict profile for PCBWay standard 4-layer 1 oz, reviewed in PR #9 (2026-11-02). Stricter than PCBWay's published minimums in two places, by choice: 5 mil track width on every layer (published inner: 4 mil) and 0.45 mm hole spacing for every pair (published via to via: 0.30 mm). Frozen at the reviewed bytes so Circuit Forge's gate keeps matching their hashes.",+  "frozen": {+    "kicad_dru": {"file": "rules/profiles/files/pcbway-4L-circuit-forge-strict.kicad_dru", "sha256": "ed114795f294b9e6355627166f0d557132d848f2325389c8f54b0b7cf7ee0ef4"},+    "board-setup.json": {"file": "rules/profiles/files/pcbway-4L-circuit-forge-strict.board-setup.json", "sha256": "01edbd0b23d3bbe4807e6428dc24ca4dfe320bb4986a963db44c914e4d33a9a5"},+    "dru": {"file": "rules/profiles/files/pcbway-4L-circuit-forge-strict.dru", "sha256": "636eb209747fdd0144c8e632e78fecc660ba3ced67ff817ef07331f6f4981ba1"},+    "edru": {"file": "rules/profiles/files/pcbway-4L-circuit-forge-strict.edru", "sha256": "8f01d74f9c9128f25a1fc87f02c700ee61a7eac6cf5aa20b7c0fdcfb79a75e5e"},+    "RUL": {"file": "rules/profiles/files/pcbway-4L-circuit-forge-strict.RUL", "sha256": "527d18ee0fccf48de5bd102d45f8905c6befe998309b5971a30d7a911a82a83c"}+  }+}
rules/records/jlcpcb.json+15−3
@@ -97,7 +97,11 @@           "url": "https://jlcpcb.com/capabilities/pcb-capabilities",           "dateRead": "2026-09-03"         }-      ]+      ],+      "silkMinTextHeight": {+        "mm": 0.8,+        "condition": "Adom-tested minimum (commit 437f71a7). JLCPCB publishes 1.0 mm (40 mil); this is Adom's tested value, a candidate for an 'adom-tested' profile on top of the published 1.0 mm."+      }     },     {       "process": "standard",@@ -190,7 +194,11 @@           "url": "https://jlcpcb.com/capabilities/pcb-capabilities",           "dateRead": "2026-09-03"         }-      ]+      ],+      "silkMinTextHeight": {+        "mm": 0.8,+        "condition": "Adom-tested minimum (commit 437f71a7). JLCPCB publishes 1.0 mm (40 mil); this is Adom's tested value, a candidate for an 'adom-tested' profile on top of the published 1.0 mm."+      }     },     {       "process": "standard",@@ -281,7 +289,11 @@           "url": "https://jlcpcb.com/capabilities/pcb-capabilities",           "dateRead": "2026-09-03"         }-      ]+      ],+      "silkMinTextHeight": {+        "mm": 0.8,+        "condition": "Adom-tested minimum (commit 437f71a7). JLCPCB publishes 1.0 mm (40 mil); this is Adom's tested value, a candidate for an 'adom-tested' profile on top of the published 1.0 mm."+      }     }   ],   "unreachable": [
rules/records/pcbway.json+21−6
@@ -108,12 +108,12 @@       "minTraceWidth": {         "mm": 0.127,         "mil": 5.0,-        "condition": "4L 1oz: outer conventional 5mil (0.127) applied to every layer; inner 4mil (0.1016) is looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil. "+        "condition": "outer layers, 1oz (35um) conventional: 5mil (capabilities table, 'min width/spacing of outer layer', archive sha 694ce30266e8)"       },       "minSpacing": {         "mm": 0.1524,         "mil": 6.0,-        "condition": "4L 1oz: outer conventional 6mil (0.1524) applied to every layer; inner 5mil (0.127) looser, not used. Sources: capabilities table (std sha 694ce30266e8); mobile page suggests 6mil."+        "condition": "outer layers, 1oz conventional: 6mil (capabilities table). Inner layers publish 5mil (minSpacingInner), but KiCad cannot set a per-layer clearance floor without a custom clearance rule, which overrides netclass spacing; the board floor therefore uses the outer value, 1mil above the published inner minimum."       },       "minDrill": {         "mm": 0.2,@@ -124,14 +124,14 @@         "drillMil": 7.87,         "padMm": 0.5,         "padMil": 19.69,-        "note": "derived: drill 0.2 + 2 x 0.15 via ring (vendor page does not publish a via pad)"+        "note": "derived: drill 0.2 + 2 x 0.15 via ring (PCBWay does not publish a via pad diameter)"       },       "annularRing": {         "viaMm": 0.15,         "viaMil": 6.0,         "padMm": 0.254,         "padMil": 10.0,-        "note": "viaMm: pads with vias, 0.15mm (6mil): capabilities page AND manufacturing-tolerances page (0.15 via ring) agree. padMm: 1oz outer component-hole ring 10mil (0.254) from the capabilities table; the manufacturing-tolerances page gives 0.20 for the PTH ring, which is WEAKER and not used. Source disagreement recorded in notes."+        "note": "viaMm: pads with vias 0.15mm (capabilities page and manufacturing-tolerances page agree). padMm: 1oz outer component-hole ring 10mil (0.254) from the capabilities table, PCBWay's primary capability page; the manufacturing-tolerances page gives 0.20."       },       "copperToBoardEdge": {         "mm": 0.25,@@ -141,7 +141,7 @@       "holeToHole": {         "mm": 0.45,         "mil": 17.72,-        "condition": "different-net plated holes: 0.45mm (limited_holes_spacing page, last updated 2025-06-25) - stricter than the capabilities table (16mil = 0.4064 PTH; 11mil = 0.2794 via). Via-to-via 0.30mm on that page is looser than 0.45 and is not used separately: 0.45 applies to all pairs (conservative)."+        "condition": "plated holes of different nets where a component hole is involved: 0.45mm (limited_holes_spacing page, last updated 2025-06-25; newer than the capabilities table's 16mil)"       },       "maskExpansion": {         "mm": 0.0508,@@ -232,7 +232,22 @@         "mm": 0.8,         "condition": "minimum legend character height 0.8mm (width:height 1:5), per capabilities page silkscreen row (archive sha 694ce302...)"       },-      "kicadStrict": true+      "minTraceWidthInner": {+        "mm": 0.1016,+        "mil": 4.0,+        "condition": "inner layers, 1oz (35um): 4mil (capabilities table, archive sha 694ce30266e8)"+      },+      "minSpacingInner": {+        "mm": 0.127,+        "mil": 5.0,+        "condition": "inner layers, 1oz: 5mil (capabilities table)"+      },+      "holeToHoleVia": {+        "mm": 0.3,+        "mil": 11.81,+        "condition": "via hole to via hole: 0.30mm (limited_holes_spacing page, last updated 2025-06-25)"+      },+      "kicadConditioned": true     },     {       "process": "standard",
tools/generate.py+102−8
@@ -436,6 +436,7 @@ def gen_kicad_board_setup_legacy(vendor, rec):             "annularRingViaMm": g(rec, "annularRing", "viaMm"),             "annularRingPadMm": g(rec, "annularRing", "padMm"),             "silkMinLineWidthMm": g(rec, "silkLineWidth"),+            **({"silkMinTextHeightMm": g(rec, "silkMinTextHeight")} if rec.get("silkMinTextHeight") else {}),             "maskExpansionMm": g(rec, "maskExpansion"),         },         "notes": "Apply as Board Setup, Constraints. The matching .kicad_dru file carries the same limits as custom rules; the two are redundant on purpose so both the GUI constraints and kicad-cli DRC enforce them.",@@ -454,48 +455,65 @@ def _strict_rule_block(out, name, kind, minimum, condition=None, layer=None):         return     rows = [f'(rule "{name}"', '  (severity error)', f'  (constraint {kind} (min {fmm(minimum)}mm))']     if layer:-        rows.append(f'  (layer "{layer}")')+        # KiCad's layer keywords are bare (outer, inner); a quoted "outer" would name a layer that does not exist+        rows.append(f'  (layer {layer})' if layer in ("outer", "inner") else f'  (layer "{layer}")')     if condition:         rows.append(f'  (condition "{condition}")')     rows[-1] += ")"     out.extend(rows + [""]) +def conditioned(rec):+    """Records whose KiCad rules are conditioned by layer and item type (kicadConditioned; kicadStrict is the old name)."""+    return rec.get("kicadConditioned") is True or rec.get("kicadStrict") is True+ def gen_kicad_dru_strict(vendor, rec):-    """Opt-in (record flag kicadStrict). NO unconditional clearance rule: a global custom clearance overrides netclass clearance."""+    """Conditioned rules, each at the fab's published value for the items it applies to. NO unconditional+    clearance rule: a custom clearance overrides netclass clearance (the board-setup floor carries it)."""     via = rec["minVia"]     out = ["(version 1)", "", "# " + description_text(vendor, rec).replace("\n", "\n# "), ""]     R = lambda *a, **k: _strict_rule_block(out, *a, **k)-    R("min-track-width", "track_width", rec["minTraceWidth"]["mm"])+    if rec.get("minTraceWidthInner"):+        R("min-track-width-outer", "track_width", rec["minTraceWidth"]["mm"], None, "outer")+        R("min-track-width-inner", "track_width", rec["minTraceWidthInner"]["mm"], None, "inner")+    else:+        R("min-track-width", "track_width", rec["minTraceWidth"]["mm"])     R("min-hole", "hole_size", rec["minDrill"]["mm"])     R("min-via-hole", "hole_size", via["drillMm"], "A.Type == 'Via'")     R("min-via-diameter", "via_diameter", via["padMm"], "A.Type == 'Via'")     R("min-via-annular-width", "annular_width", rec["annularRing"]["viaMm"], "A.Type == 'Via'")     R("min-pad-annular-width", "annular_width", rec["annularRing"]["padMm"], "A.Type == 'Pad' && A.Pad_Type == 'Through-hole'")     R("min-edge-clearance", "edge_clearance", g(rec, "copperToBoardEdge", "mm"))-    R("min-hole-to-hole", "hole_to_hole", g(rec, "holeToHole", "mm"))+    if rec.get("holeToHoleVia"):+        # later rules win in KiCad: the via-to-via value first, the component-hole value after it+        R("min-hole-to-hole-via", "hole_to_hole", g(rec, "holeToHoleVia", "mm"))+        R("min-hole-to-hole-component", "hole_to_hole", g(rec, "holeToHole", "mm"), "A.Type == 'Pad' || B.Type == 'Pad'")+    else:+        R("min-hole-to-hole", "hole_to_hole", g(rec, "holeToHole", "mm"))     R("min-hole-to-inner-copper", "hole_clearance", g(rec, "minHoleToInnerCopper", "mm"))     R("min-silk-height", "text_height", g(rec, "silkMinHeightMm", "mm"), "A.Type == 'Text' || A.Type == 'Text Box'", "*.SilkS")     R("min-silk-thickness", "text_thickness", g(rec, "silkLineWidth", "mm"), "A.Type == 'Text' || A.Type == 'Text Box'", "*.SilkS")     return "\n".join(out)  def gen_kicad_dru(vendor, rec):-    if rec.get("kicadStrict") is True:+    if conditioned(rec):         return gen_kicad_dru_strict(vendor, rec)     return gen_kicad_dru_legacy(vendor, rec)  def gen_kicad_board_setup(vendor, rec):-    if rec.get("kicadStrict") is True:+    if conditioned(rec):         via_d, via_p = effective_via(rec)         setup = {             "vendor": vendor, "process": rec["process"], "layerCount": rec["layerCount"],             "boardSetupConstraints": {-                "minTrackWidthMm": rec["minTraceWidth"]["mm"],+                # the board floor is the smallest published width; the .kicad_dru holds each layer to its own+                "minTrackWidthMm": min(rec["minTraceWidth"]["mm"], g(rec, "minTraceWidthInner") or rec["minTraceWidth"]["mm"]),                 "minClearanceMm": rec["minSpacing"]["mm"],                 "minPadClearanceMm": g(rec, "minPadSpacing"),                 "minViaDrillMm": via_d, "minViaDiameterMm": via_p,                 "minHoleMm": rec["minDrill"]["mm"],                 "copperEdgeClearanceMm": g(rec, "copperToBoardEdge"),-                "holeToHoleMm": g(rec, "holeToHole"),+                # the board floor is the smallest published hole spacing; the .kicad_dru holds component holes to theirs+                "holeToHoleMm": min(g(rec, "holeToHole"), g(rec, "holeToHoleVia") or g(rec, "holeToHole")),                 "annularRingViaMm": g(rec, "annularRing", "viaMm"),                 "annularRingPadMm": g(rec, "annularRing", "padMm"),                 "silkMinLineWidthMm": g(rec, "silkLineWidth"),@@ -577,11 +595,85 @@ def gen_table(records):  # ---------------------------------------------------------------- main +# ---------------------------------------------------------------- profiles+#+# A record is the fab's PUBLISHED limits and nothing else. Anything a person or team prefers on top+# (stricter margins, smaller or bigger silkscreen text) is a profile in rules/profiles/<vendor>-<n>L-<name>.json:+#   {"name", "vendorSlug", "process", "layerCount", "author", "why",+#    "overrides": {<record field>: {...}},         limits that replace the published ones (errors)+#    "preferences": {"silkMinTextHeight": {"mm"}, "minTraceWidth": {"mm"}},  taste: KiCad warnings, never errors+#    "frozen": {<ext>: {"file", "sha256"}}}        reviewed bytes copied as is (hash-checked)+# Each profile writes <vendor>[-<process>]-<n>L-<name>.<ext> beside the published files.++OUT_DIRS = {"kicad_dru": "kicad", "board-setup.json": "kicad", "dru": "fusion", "edru": "fusion", "RUL": "altium"}+PREF_RULES = {"silkMinTextHeight": ("pref-silk-text-height", "text_height", "A.Type == 'Text' || A.Type == 'Text Box'", "*.SilkS"),+              "minTraceWidth": ("pref-track-width", "track_width", None, None)}+++def merged(rec, overrides):+    out = json.loads(json.dumps(rec))+    for k, v in (overrides or {}).items():+        out[k] = {**out[k], **v} if isinstance(out.get(k), dict) and isinstance(v, dict) else v+    return out+++def preference_rules(prefs):+    out = []+    for key, v in (prefs or {}).items():+        if key not in PREF_RULES or not isinstance(v, dict) or v.get("mm") is None:+            sys.exit(f"profile preference {key!r}: supported preferences are {sorted(PREF_RULES)}, each {{\"mm\": value}}")+        name, kind, cond, layer = PREF_RULES[key]+        rows = [f'(rule "{name}"', "  (severity warning)", f"  (constraint {kind} (min {fmm(v['mm'])}mm))"]+        if layer:+            rows.append(f'  (layer "{layer}")')+        if cond:+            rows.append(f'  (condition "{cond}")')+        rows[-1] += ")"+        out += rows + [""]+    return "\n".join(out)+++def build_profiles(by_key, index):+    import hashlib+    for pf in sorted((ROOT / "rules" / "profiles").glob("*.json")):+        p = json.loads(pf.read_text())+        for k in ("name", "vendorSlug", "process", "layerCount", "author", "why"):+            if not p.get(k):+                sys.exit(f"{pf.name}: a profile needs {k}")+        rec = by_key.get((p["vendorSlug"], p["process"], p["layerCount"]))+        if rec is None:+            sys.exit(f"{pf.name}: no published record for {p['vendorSlug']} {p['process']} {p['layerCount']}L to build on")+        vs = file_slug(p["vendorSlug"], p["process"], p["layerCount"]) + "-" + slugify(p["name"])+        files = {}+        if p.get("frozen"):+            for ext, fz in p["frozen"].items():+                data = (ROOT / fz["file"]).read_bytes()+                if hashlib.sha256(data).hexdigest() != fz["sha256"]:+                    sys.exit(f"{pf.name}: {fz['file']} no longer matches its reviewed sha256")+                (ROOT / OUT_DIRS[ext] / f"{vs}.{ext}").write_bytes(data)+                files[ext] = f"{OUT_DIRS[ext]}/{vs}.{ext}"+        else:+            r = merged(rec, p.get("overrides"))+            v = r["vendor"]+            dru = gen_kicad_dru(v, r)+            prefs = preference_rules(p.get("preferences"))+            if prefs:+                dru = dru.rstrip("\n") + "\n\n# preferences of this profile: warnings, never errors\n" + prefs+            outs = {"kicad_dru": dru, "board-setup.json": gen_kicad_board_setup(v, r), "dru": gen_dru(v, r), "edru": gen_edru(v, r), "RUL": gen_rul(v, r)}+            for ext, text in outs.items():+                (ROOT / OUT_DIRS[ext] / f"{vs}.{ext}").write_text(text)+                files[ext] = f"{OUT_DIRS[ext]}/{vs}.{ext}"+        entry = next(e for e in index["vendors"] if (e["vendorSlug"], e["process"], e["layerCount"]) == (p["vendorSlug"], p["process"], p["layerCount"]))+        entry.setdefault("profiles", []).append({"name": p["name"], "author": p["author"], "why": p["why"], "frozen": bool(p.get("frozen")),+                                                 "definition": f"rules/profiles/{pf.name}", "files": files})++ def main():     rec_files = sorted((ROOT / "rules" / "records").glob("*.json"))     if not rec_files:         sys.exit("no records found")     records = []+    by_key = {}     index = {"generatedBy": "tools/generate.py", "unitNote": "mm primary, mil secondary (1 mil = 0.0254 mm)", "vendors": []}     for rf in rec_files:         data = json.loads(rf.read_text())@@ -590,6 +682,7 @@ def main():             rec["vendor"] = data["vendor"]             rec["vendorSlug"] = data["vendorSlug"]             records.append(rec)+            by_key[(data["vendorSlug"], rec["process"], rec["layerCount"])] = rec             vs = file_slug(data["vendorSlug"], rec["process"], rec["layerCount"])             gen_ok = all(rec.get(k) for k in ("minTraceWidth", "minSpacing", "minDrill"))             if gen_ok:@@ -615,6 +708,7 @@ def main():             if not gen_ok:                 entry["note"] = "No generated rule files: the vendor does not publish one or more of min trace width, min spacing, min drill for this process/layer count."             index["vendors"].append(entry)+    build_profiles(by_key, index)     (ROOT / "rules" / "index.json").write_text(json.dumps(index, indent=2) + "\n")      table = gen_table(records)
tools/test_legacy_unchanged.py+5−5
@@ -1,4 +1,4 @@-"""Blast-radius guard: every record WITHOUT kicadStrict must produce byte-identical KiCad export to main's legacy functions."""+"""Blast-radius guard: every record that is not conditioned (kicadConditioned, formerly kicadStrict) must produce byte-identical KiCad export to the legacy functions.""" import unittest, importlib.util, json from pathlib import Path BASE = Path(__file__).resolve().parents[1]@@ -13,13 +13,13 @@ class LegacyUnchanged(unittest.TestCase):     def test_non_strict_records_use_legacy_kicad_export(self):         checked = 0         for vendor, rec in RECS:-            if rec.get('kicadStrict') is True: continue+            if g.conditioned(rec): continue             if not all(rec.get(k) for k in ('minTraceWidth', 'minSpacing', 'minDrill')): continue             self.assertEqual(g.gen_kicad_dru(vendor, rec), g.gen_kicad_dru_legacy(vendor, rec), vendor)             self.assertEqual(g.gen_kicad_board_setup(vendor, rec), g.gen_kicad_board_setup_legacy(vendor, rec), vendor)             checked += 1         self.assertGreater(checked, 50)-    def test_only_pcbway_standard_4l_is_strict(self):-        strict = [(v, r['process'], r['layerCount']) for v, r in RECS if r.get('kicadStrict') is True]-        self.assertEqual(strict, [('PCBWay', 'standard', 4)])+    def test_only_pcbway_standard_4l_is_conditioned(self):+        cond = [(v, r['process'], r['layerCount']) for v, r in RECS if g.conditioned(r)]+        self.assertEqual(cond, [('PCBWay', 'standard', 4)]) if __name__ == '__main__': unittest.main(verbosity=2)
tools/test_pcbway_4l.py+18−7
@@ -1,4 +1,4 @@-"""PCBWay standard 4-layer 1 oz: sourced limits must appear in the generated KiCad rules, each as an explicit error.+"""PCBWay standard 4-layer 1 oz: the PUBLISHED limits, split the way PCBWay splits them, must appear in the generated KiCad rules, each as an explicit error. Source archive SHA-256 values are the ones recorded in the PCBDS r7 proof. Syntax-only passes are NOT accepted as proof: see DRC coupon evidence.""" import unittest, importlib.util, json, re from pathlib import Path@@ -16,13 +16,20 @@ def rule(name): class PCBWay4L(unittest.TestCase):     def test_no_invalid_keyword_or_layer_qualifier(self):         self.assertNotIn('(constraint hole ', TXT)-        self.assertNotIn('(layer "inner")', TXT)+        self.assertNotIn('(layer "inner")', TXT)  # KiCad's layer keywords are bare+        self.assertNotIn('(layer "outer")', TXT)     def test_every_rule_is_explicit_error(self):         blocks = re.findall(r'\(rule "[^"]+"\n(.*?)(?:\n\n|\Z)', TXT, flags=re.S)         self.assertTrue(blocks)         for b in blocks: self.assertIn('(severity error)', b)-    def test_track_width_outer_1oz_applied_globally(self):-        self.assertIn('(constraint track_width (min 0.127mm))', rule('min-track-width'))+    def test_track_width_published_per_layer(self):+        # outer 1 oz 5 mil, inner 1 oz 4 mil (capabilities table)+        self.assertIn('(constraint track_width (min 0.127mm))', rule('min-track-width-outer'))+        self.assertIn('(layer outer)', rule('min-track-width-outer'))+        self.assertIn('(constraint track_width (min 0.1016mm))', rule('min-track-width-inner'))+        self.assertIn('(layer inner)', rule('min-track-width-inner'))+        bs = json.loads(g.gen_kicad_board_setup('PCBWay', REC))+        self.assertEqual(bs['boardSetupConstraints']['minTrackWidthMm'], 0.1016)     def test_no_unconditional_clearance_rule_and_board_floor_carries_0_1524(self):         self.assertIsNone(rule('min-clearance'))  # would override netclass clearance (measured)         bs = json.loads(g.gen_kicad_board_setup('PCBWay', REC))@@ -32,9 +39,13 @@ class PCBWay4L(unittest.TestCase):         self.assertIn('(constraint annular_width (min 0.15mm))', rule('min-via-annular-width'))         self.assertIn("A.Pad_Type == 'Through-hole'", rule('min-pad-annular-width'))         self.assertIn('(constraint annular_width (min 0.254mm))', rule('min-pad-annular-width'))-    def test_hole_spacing_at_least_0_45mm_for_all_pairs(self):-        self.assertIn('(constraint hole_to_hole (min 0.45mm))', rule('min-hole-to-hole'))-        self.assertIsNone(re.search(r'hole_to_hole[^\n]*condition', TXT))+    def test_hole_spacing_published_per_hole_type(self):+        # limited_holes_spacing page: 0.30 mm via to via, 0.45 mm where a component hole is involved; the+        # component rule comes after the via rule because the later matching KiCad rule wins+        self.assertIn('(constraint hole_to_hole (min 0.3mm))', rule('min-hole-to-hole-via'))+        self.assertIn('(constraint hole_to_hole (min 0.45mm))', rule('min-hole-to-hole-component'))+        self.assertIn("A.Type == 'Pad' || B.Type == 'Pad'", rule('min-hole-to-hole-component'))+        self.assertLess(TXT.index('min-hole-to-hole-via'), TXT.index('min-hole-to-hole-component'))     def test_inner_hole_to_copper_7mil_is_emitted(self):         self.assertIn('(constraint hole_clearance (min 0.1778mm))', rule('min-hole-to-inner-copper'))     def test_silk_height_and_width(self):
tools/test_profiles.pyadded+80
@@ -0,0 +1,80 @@+"""Published records vs profiles (John, 2026-11-03): a record is the fab's PUBLISHED limits and nothing else;+anyone's stricter margins or text-size taste live in rules/profiles/, chosen by the user. These tests keep+comfort margins from creeping back into a record, keep frozen profiles at their reviewed bytes, and check+that overrides and preferences build."""+import hashlib, importlib.util, json, re, unittest+from pathlib import Path+BASE = Path(__file__).resolve().parents[1]+spec = importlib.util.spec_from_file_location('rules', BASE / 'tools' / 'generate.py')+g = importlib.util.module_from_spec(spec); spec.loader.exec_module(g)+PROFILES = sorted((BASE / 'rules' / 'profiles').glob('*.json'))+# wording that means "this value is not what the fab publishes": it belongs in a profile+NOT_PUBLISHED = re.compile(r'\b(conservative|applied to every layer|not used separately|stricter than the|our own margin)\b', re.I)+++def records():+    for f in sorted((BASE / 'rules' / 'records').glob('*.json')):+        d = json.loads(f.read_text(encoding='utf-8'))+        for r in d['records']:+            yield f.name, d['vendor'], r+++class PublishedRecords(unittest.TestCase):+    def test_records_carry_no_comfort_margins(self):+        for name, vendor, rec in records():+            for key, v in rec.items():+                if isinstance(v, dict):+                    text = ' '.join(str(x) for x in v.values() if isinstance(x, str))+                    self.assertIsNone(NOT_PUBLISHED.search(text), f'{name} {vendor} {rec["process"]} {rec["layerCount"]}L {key}: "{text[:120]}" reads as a margin, not a published limit; put it in a profile')++    def test_records_have_no_profile_flags(self):+        for name, vendor, rec in records():+            self.assertNotIn('kicadStrict', rec, f'{name}: strictness is a profile, not a record flag')+++class Profiles(unittest.TestCase):+    def test_every_profile_names_author_reason_and_published_base(self):+        recs = {(json.loads(f.read_text())['vendorSlug'], r['process'], r['layerCount']) for f in (BASE / 'rules' / 'records').glob('*.json') for r in json.loads(f.read_text())['records']}+        self.assertTrue(PROFILES)+        for pf in PROFILES:+            p = json.loads(pf.read_text())+            for k in ('name', 'author', 'why', 'vendorSlug', 'process', 'layerCount'):+                self.assertTrue(p.get(k), f'{pf.name}: {k}')+            self.assertIn((p['vendorSlug'], p['process'], p['layerCount']), recs, pf.name)++    def test_frozen_profiles_keep_their_reviewed_bytes(self):+        for pf in PROFILES:+            p = json.loads(pf.read_text())+            for ext, fz in (p.get('frozen') or {}).items():+                self.assertEqual(hashlib.sha256((BASE / fz['file']).read_bytes()).hexdigest(), fz['sha256'], f'{pf.name} {ext}')+                vs = g.file_slug(p['vendorSlug'], p['process'], p['layerCount']) + '-' + g.slugify(p['name'])+                out = BASE / g.OUT_DIRS[ext] / f'{vs}.{ext}'+                self.assertEqual(out.read_bytes(), (BASE / fz['file']).read_bytes(), f'{out.name} is the published copy of the frozen profile')++    def test_circuit_forge_strict_keeps_the_hashes_its_gate_checks(self):+        self.assertEqual(hashlib.sha256((BASE / 'kicad/pcbway-4L-circuit-forge-strict.kicad_dru').read_bytes()).hexdigest(), 'ed114795f294b9e6355627166f0d557132d848f2325389c8f54b0b7cf7ee0ef4')+        self.assertEqual(hashlib.sha256((BASE / 'kicad/pcbway-4L-circuit-forge-strict.board-setup.json').read_bytes()).hexdigest(), '01edbd0b23d3bbe4807e6428dc24ca4dfe320bb4986a963db44c914e4d33a9a5')++    def test_overrides_are_errors_and_preferences_only_warn(self):+        rec = [r for _, v, r in records() if v == 'PCBWay' and r['process'] == 'standard' and r['layerCount'] == 2][0]+        rec = {**rec, 'vendor': 'PCBWay'}+        tighter = g.merged(rec, {'minTraceWidth': {'mm': 0.2}})+        self.assertEqual(tighter['minTraceWidth']['mm'], 0.2)+        self.assertEqual(rec['minTraceWidth']['mm'] != 0.2, True, 'the record itself is untouched')+        prefs = g.preference_rules({'silkMinTextHeight': {'mm': 0.6}})+        self.assertIn('(severity warning)', prefs)+        self.assertIn('(constraint text_height (min 0.6mm))', prefs)+        self.assertNotIn('(severity error)', prefs)+        with self.assertRaises(SystemExit):+            g.preference_rules({'unknownThing': {'mm': 1}})++    def test_index_lists_profiles_beside_their_published_pack(self):+        idx = json.loads((BASE / 'rules' / 'index.json').read_text())+        e = next(e for e in idx['vendors'] if (e['vendorSlug'], e['process'], e['layerCount']) == ('pcbway', 'standard', 4))+        names = [p['name'] for p in e.get('profiles', [])]+        self.assertIn('circuit-forge-strict', names)+        self.assertEqual(e['files']['kicadDru'], 'kicad/pcbway-4L.kicad_dru', 'the published pack keeps its file')+++if __name__ == '__main__':+    unittest.main(verbosity=2)