$npx -y skills add aklofas/kicad-happy --skill emcEMC pre-compliance risk analysis for KiCad PCB designs — 18 check categories, 44 rule IDs covering ground planes, decoupling, I/O filtering, switching harmonics, clock routing, differential pair skew, board edge radiation, PDN impedance, return paths, crosstalk, ESD protection, s
| 1 | # EMC Pre-Compliance Skill |
| 2 | |
| 3 | Automated EMC risk analysis for KiCad PCB designs. Identifies the most common causes of EMC test failures using geometric rule checks, analytical emission formulas, and optional SPICE simulation. |
| 4 | |
| 5 | **This is a risk analyzer, not a compliance predictor.** It catches ~70% of common EMC design mistakes before fabrication. It cannot guarantee FCC/CISPR compliance — only a calibrated measurement in an accredited lab can do that. But it can reduce the first-spin failure rate from ~50% toward ~20-30%, potentially saving $5K-$50K per avoided board respin. |
| 6 | |
| 7 | ## Related Skills |
| 8 | |
| 9 | | Skill | Purpose | |
| 10 | |-------|---------| |
| 11 | | `kicad` | Schematic/PCB analysis — produces the analyzer JSON this skill consumes | |
| 12 | | `kicad` (thermal) | Thermal hotspot analysis — MLCC derating and ferrite/inductor overheating findings can amplify EMC decoupling and filter issues (an over-stressed MLCC degrades; a hot ferrite drifts impedance). Worth cross-checking when EMC flags DC-001/DC-002 or EF-001/EF-002. | |
| 13 | | `spice` | SPICE simulation — provides simulator backend for SPICE-enhanced PDN/filter checks | |
| 14 | |
| 15 | **Handoff guidance:** Run the `kicad` skill's `analyze_schematic.py` and `analyze_pcb.py` first — this skill consumes their JSON output. Use `--full` on the PCB analyzer for best results (enables per-track coordinates for ground plane crossing, edge proximity, and return path checks). During a design review, run EMC analysis after the schematic/PCB analyzers, SPICE simulation, and thermal analysis, then incorporate EMC findings into the report. |
| 16 | |
| 17 | ## Requirements |
| 18 | |
| 19 | - **Python 3.10+** — stdlib only, no pip dependencies |
| 20 | - **Schematic analyzer JSON** — from `analyze_schematic.py --output` |
| 21 | - **PCB analyzer JSON** — from `analyze_pcb.py --full --output` (recommended with `--full`) |
| 22 | - **SPICE simulator** *(optional)* — ngspice, LTspice, or Xyce for SPICE-enhanced PDN/filter checks. Auto-detected. Without one, analytical models run unchanged. |
| 23 | |
| 24 | ## Workflow |
| 25 | |
| 26 | ### Step 1: Run the analyzers |
| 27 | |
| 28 | ```bash |
| 29 | python3 <kicad-skill-path>/scripts/analyze_schematic.py design.kicad_sch --analysis-dir analysis/ |
| 30 | python3 <kicad-skill-path>/scripts/analyze_pcb.py design.kicad_pcb --full --analysis-dir analysis/ |
| 31 | ``` |
| 32 | |
| 33 | ### Step 2: Run EMC analysis |
| 34 | |
| 35 | Pass `--analysis-dir analysis/` — the script auto-resolves `schematic.json` |
| 36 | and `pcb.json` from the manifest's current run, and writes `emc.json` into |
| 37 | the same folder so the manifest tracks it. |
| 38 | |
| 39 | ```bash |
| 40 | # Recommended: auto-resolve inputs from the current run |
| 41 | python3 <skill-path>/scripts/analyze_emc.py --analysis-dir analysis/ |
| 42 | |
| 43 | # Equivalent — explicit paths still accepted (and required if you want to |
| 44 | # point at a non-current run or override one input) |
| 45 | python3 <skill-path>/scripts/analyze_emc.py \ |
| 46 | --schematic analysis/<run_id>/schematic.json \ |
| 47 | --pcb analysis/<run_id>/pcb.json \ |
| 48 | --analysis-dir analysis/ |
| 49 | |
| 50 | # One-off JSON (bypasses the cache) |
| 51 | python3 <skill-path>/scripts/analyze_emc.py --schematic schematic.json --pcb pcb.json --output emc.json |
| 52 | |
| 53 | # SPICE-enhanced (improved PDN and filter accuracy) |
| 54 | python3 <skill-path>/scripts/analyze_emc.py --analysis-dir analysis/ --spice-enhanced |
| 55 | |
| 56 | # Select target standard |
| 57 | python3 <skill-path>/scripts/analyze_emc.py --analysis-dir analysis/ --standard cispr-class-b |
| 58 | |
| 59 | # Select target market (sets all applicable standards) |
| 60 | python3 <skill-path>/scripts/analyze_emc.py --analysis-dir analysis/ --market eu |
| 61 | |
| 62 | # Filter by severity |
| 63 | python3 <skill-path>/scripts/analyze_emc.py --analysis-dir analysis/ --severity high |
| 64 | |
| 65 | # Human-readable text output |
| 66 | python3 <skill-path>/scripts/analyze_emc.py --analysis-dir analysis/ --text |
| 67 | ``` |
| 68 | |
| 69 | ### Step 3: Interpret results |
| 70 | |
| 71 | Read the JSON report and incorporate findings into the design review. Each finding has a severity, rule ID, description, and actionable recommendation. See "Interpreting Results" below. |
| 72 | |
| 73 | ## What Gets Checked |
| 74 | |
| 75 | 44 rule IDs across 18 categories. Each rule has a specific threshold, rationale, and source citation — see `references/pcb-emc-rules.md` for full details. |
| 76 | |
| 77 | | Category | Rules | What it detects | |
| 78 | | |