with one click
Run DFM guard tests and add new regression tests after fixing PCB issues
npx skills add https://github.com/pjcau/esp32-emu-turbo --skill dfm-testCopy and paste this command into Claude Code to install the skill
Run DFM guard tests and add new regression tests after fixing PCB issues
npx skills add https://github.com/pjcau/esp32-emu-turbo --skill dfm-testCopy and paste this command into Claude Code to install the skill
| name | dfm-test |
| model | claude-opus-4-7 |
| description | Run DFM guard tests and add new regression tests after fixing PCB issues |
| disable-model-invocation | true |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob |
Run DFM verification tests and manage regression guards for the PCB.
scripts/generate_pcb/) to verify no regressionscd /Users/pierrejonnycau/Documents/WORKS/esp32-emu-turbo
python3 -m scripts.generate_pcb hardware/kicad
python3 scripts/verify_dfm_v2.py
The test suite covers 43 DFM tests + 9 DFA tests:
DFM tests (verify_dfm_v2.py ā 43 tests):
| # | Category | Tests | What it checks |
|---|---|---|---|
| 1-4 | CPL positions | 4 | J1, SW_PWR, U1, U5 position/rotation in JLCPCB CPL |
| 5-6 | Silkscreen | 2 | Reference/Value on Fab layer, mounting holes on Fab |
| 7-8 | Spacing | 2 | C1/C2-U3 gap >= 1.5mm, gr_text >= 6mm from holes |
| 9 | Via ring | 1 | Annular ring >= 0.075mm on all vias |
| 10 | Gerbers | 1 | gerbers.zip has >= 12 files |
| 11-12 | Footprints | 2 | U5 pin alignment analysis, SOP-16 aperture |
| 13-15 | KiCad DRC | 3 | copper_edge=0, hole_to_hole=0, silk issues=0 |
| 16 | Trace spacing | 1 | Parallel trace gap violations <= baseline |
| 17 | Via spacing | 1 | Via hole-to-hole gap >= 0.25mm |
| 18 | Display stagger | 1 | Bottom stagger traces use ESP32 pin midpoints |
| 19+ | Mounting/drill | 2+ | Mounting hole trace clearance, drill-trace clearance |
| 42 | Drill-trace | 1 | Drill doesn't cut different-net traces (JLCPCB) |
| 43 | Trace-pad net | 1 | Trace-pad different-net clearance check |
DFA tests (verify_dfa.py ā 9 tests):
| # | Category | Tests | What it checks |
|---|---|---|---|
| 1-3 | BOM | 3 | File exists, component counts, part numbers |
| 4-6 | CPL | 3 | File exists, positions, rotations |
| 7-9 | Polarity | 3 | Polarity-sensitive components correct |
If you just fixed a DFM issue, add a regression guard test to scripts/verify_dfm_v2.py:
Read the test file:
cat scripts/verify_dfm_v2.py
Add a new test function following the existing pattern:
def test_new_check():
"""Test N: Description of what this guards against."""
print("\nāā New Check āā")
with open(PCB_FILE) as f:
content = f.read()
# ... parse and check ...
check("Description", condition, f"detail={value}")
Register it in __main__ block at the bottom.
Update the test count in this SKILL.md and in .claude/skills/verify/SKILL.md.
The test file provides reusable helpers:
| Function | Returns | Use for |
|---|---|---|
read_cpl() | dict[ref ā row] | CPL position/rotation checks |
_parse_segments(content) | list[dict] | Trace analysis (x1,y1,x2,y2,w,layer,net) |
_parse_vias(content) | list[dict] | Via analysis (x,y,size,drill,net) |
_seg_min_dist(s1,s2) | float or None | Edge-to-edge gap between parallel traces |
check(name, cond, detail) | ā | Register pass/fail result |
Some tests use baselines for inherent violations in dense areas:
scripts/verify_dfm_v2.py ā Test suite (source of truth)scripts/generate_pcb/routing.py ā Trace routing (most DFM issues originate here)scripts/generate_pcb/footprints.py ā Footprint pad/mask definitionsscripts/generate_pcb/board.py ā Component placement, silkscreenscripts/generate_pcb/jlcpcb_export.py ā CPL rotation/position correctionsFull PCB verification loop using local kicad-cli (DRC + 3D render + gerbers)
Create a new Claude Code skill for this project. Use when you need to add a new skill, improve an existing skill, or convert a workflow into a reusable skill.
Verifies that every PCB pad-to-net assignment matches the manufacturer datasheet pin specifications. Use when changing board.py/routing.py/footprints.py, after GPIO remapping, before releases, or when adding new components. Automated guard against wiring errors like unconnected VBUS, wrong pin assignments, or missing GND connections.
Design intent adversary ā cross-checks GPIO, nets, power chains, signal paths across firmware/schematic/PCB/datasheet sources to find lost connections and inconsistencies
Analyze a DFM report and fix all issues in the PCB generation scripts
Scan all documentation against source-of-truth files (config.py, board_config.h, routing.py, BOM, PCB) and report/fix outdated values. Use after PCB changes, GPIO remapping, BOM updates, or before releases.