aklofas/kicad-happy/spice
- community
Checking that the SKILL.md file is still in the repository.
Run automatic SPICE simulations on subcircuits detected from KiCad schematic analysis — validates filter frequencies, divider ratios, opamp gains, LC resonance, and crystal load capacitance. Supports ngspice, LTspice, and Xyce (auto-detected). Generates testbenches, runs batch mode, produces structured pass/warn/fail report. Use when the user asks to simulate, verify, or validate any analog subcircuit — RC filters, LC filters, voltage dividers, opamp circuits, crystal oscillators. Also for "simulate my circuit", "run spice", "verify with simulation", "check my filter cutoff", "does this divider give the right voltage", "what's the bandwidth of this opamp stage". Consider suggesting simulation during design reviews when the schematic analyzer reports simulatable subcircuits and a SPICE simulator is available.
Install
npx vskill@latest install aklofas/kicad-happy/spiceSKILL.md
SPICE Simulation Skill
Automatically generates and runs SPICE testbenches for circuit subcircuits detected by the kicad skill's schematic analyzer. Supports ngspice, LTspice, and Xyce (auto-detected). Validates calculated values (filter frequencies, divider ratios, opamp gains) against actual simulation results and produces a structured report.
This skill inverts the typical simulation workflow: instead of requiring users to create simulation sources and configure analysis (which ~2.5% of KiCad users do), it generates targeted testbenches automatically from the analyzer's subcircuit detections.
Related Skills
| Skill | Purpose | |
|---|---|---|
kicad | Schematic/PCB analysis — produces the analyzer JSON this skill consumes | |
digikey | Parametric specs for behavioral models, datasheet downloads | |
mouser | Parametric specs (secondary source), datasheet downloads | |
lcsc | Parametric specs (no auth needed), datasheet downloads | |
element14 | Parametric specs (international), datasheet downloads | |
emc | EMC pre-compliance — uses this skill's simulator infrastructure for SPICE-enhanced PDN impedance and EMI filter analysis |
Handoff guidance: The kicad skill's analyze_schematic.py produces the analysis JSON with subcircuit detections in the flat findings[] array (filtered by detector field). This skill reads that JSON, generates SPICE testbenches for simulatable subcircuits, runs the detected simulator (ngspice/LTspice/Xyce), and produces a structured verification report. Always run the schematic analyzer first. During a design review, run simulation after the analyzer and before writing the final report — simulation results should appear as a verification section in the report. The emc skill reuses this skill's simulator backend for SPICE-enhanced PDN impedance and EMI filter insertion loss checks — when ngspice is available, the EMC skill's --spice-enhanced flag activates these checks automatically.
Requirements
- A SPICE simulator — one of the following (auto-detected, first available wins):
- ngspice —
sudo apt install ngspice(Linux) /brew install ngspice(macOS) / ngspice.sourceforge.io (Windows). Most common choice. - LTspice — free from analog.com/ltspice. Popular on Windows, works via wine on Linux.
- Xyce — from xyce.sandia.gov. Parallel SPICE for large circuits.
- Override with
--simulator ngspice|ltspice|xyceorSPICE_SIMULATORenv var. - Python 3.10+ — stdlib only, no pip dependencies
- Schematic analyzer JSON — from
analyze_schematic.py --output
If no simulator is installed, skip simulation gracefully and note it in the report. Do not treat a missing simulator as an error — it's an optional enhancement.
Workflow
Step 1: Run the schematic analyzer
Step 2: Run SPICE simulations
Pass --analysis-dir analysis/ — the script auto-resolves schematic.json from the manifest's current run, writes spice.json into the same run folder, and parks intermediate .cir / .raw files at <run>/spice_work/ by default.
Step 2b (optional): PCB parasitic-aware simulation
When both schematic and PCB exist, run parasitic-annotated simulation for more accurate results on analog circuits:
With --parasitics, testbenches include trace resistance and via inductance between components. The report shows the parasitic impact — e.g., "48mΩ trace resistance shifts RC filter fc down 0.3%."
When to use parasitic simulation: Consider it when the design has high-impedance feedback networks (>100kΩ), LC filters or RF matching networks, long analog signal traces, or high-frequency circuits where trace inductance matters. For typical digital designs with low-impedance power regulation, the ideal simulation is sufficient.
Step 2c (optional): Monte Carlo tolerance analysis
Run N simulations per subcircuit with randomized component values within tolerance bands. Reports statistical distributions and sensitivity analysis — which component contributes most to output variation.
Tolerance sourcing: Tolerances are extracted from component value strings first (e.g., "680K 1%" → 1%, "22uF/6.3V/20%/X5R" → 20%). When not specified in the value string, defaults are used: resistors 5%, capacitors 10%, inductors 20%.
Output: Each simulation result gains a tolerance_analysis section with:
- statistics: mean, std, min, max, 3-sigma bounds, spread percentage for the primary output metric (fc, Vout, gain, etc.)
- sensitivity: per-component contribution percentage showing which component dominates variation (e.g., "C3 (10% tol) contributes 68% of fc variation, R5 (5% tol) contributes 32%")
- components: list of toleranceable components with their resolved tolerance values
When to use Monte Carlo: Use it for feedback networks (regulator output accuracy), precision voltage dividers, RC/LC filters near spec limits, and any circuit where tolerance stacking could push behavior outside acceptable bounds. For N=100 at ~5-50ms per simulation, expect ~0.5-5s per subcircuit.
Step 3: Interpret results and present to user
Read the JSON report and incorporate findings into the design review. See the "Interpreting Results" and "Presenting to Users" sections below.
What Gets Simulated
The script selects subcircuits from the analyzer's findings[] array (grouped by detector type). Not every detection is simulatable — the script skips configurations that can't produce meaningful results (comparators, open-loop opamps, active oscillators).
| Detector | Analysis | What's Measured | Model Fidelity | Trustworthiness | |
|---|---|---|---|---|---|
rc_filters | AC sweep | -3dB frequency, phase at fc | Exact (ideal passives) | High — mathematically exact | |
lc_filters | AC sweep | Resonant frequency, Q factor, bandwidth | Near-exact (ideal L/C + ESR) | High — small Q error from ESR | |
voltage_dividers | DC operating point | Output voltage, error % | Exact (ideal passives) | High — unloaded | |
feedback_networks | DC operating point | FB pin voltage, regulator Vout | Exact (ideal passives) | High — cross-refs power_regulators | |
opamp_circuits | AC sweep | Gain, -3dB bandwidth | Per-part or ideal | High with behavioral model, medium with ideal | |
crystal_circuits | AC impedance | Load capacitance validation | Approximate (generic BVD) | Medium | |
transistor_circuits | DC sweep | Threshold voltage, on-state current | Approximate (generic FET/BJT) | Medium | |
current_sense | DC operating point | Current at 50mV/100mV drop | Exact (ideal resistor) | High | |
protection_devices | DC sweep | Diode presence, clamping onset | Approximate (generic diode) | Low | |
decoupling_analysis | AC impedance | PDN impedance profile | Exact + ESR estimates | High for passives | |
power_regulators | DC operating point | Feedback divider Vout | Exact (ideal passives) | High | |
rf_matching | AC sweep | Matching network resonance | Exact (ideal L/C) | High | |
bridge_circuits | DC sweep | FET switching verification | Approximate (generic) | Medium | |
snubber_circuits | AC impedance | Snubber damping frequency | Exact (ideal R/C) | High | |
rf_chains | Gain budget | Per-stage gain/loss estimate | Heuristic | Low — role-based | |
bms_systems | DC operating point | Cell balance resistor validation | Exact | High | |
inrush_analysis | Transient | Inrush current profile | Approximate | Medium |
What is NOT simulated
- Comparators / open-loop opamps — no feedback network to validate, skipped
- Active oscillators — self-contained modules, nothing to verify externally
- Regulator control loop stability — requires full compensator model (behavioral models cover DC feedback only)
- Level-shifter FETs — require modeling both FETs together, skipped
- High-side power switches — source and drain both on power rails, need full load context
- Fuses and varistors — require manufacturer-specific models
- Anything without parsed component values — if
parse_value()couldn't extract R/C/L values, the detection is skipped
Output Format
Status values and what they mean:
| Status | Meaning | Action | |
|---|---|---|---|
| pass | Simulation confirms the analyzer's detection within tolerance | Report as confirmed. No action needed. | |
| warn | Simulation shows something worth noting — small deviation, model limitation, or edge case | Report with context. Often the "warn" reflects a real but minor issue (e.g., slight gain error from ideal opamp model). | |
| fail | Simulation contradicts the analyzer — wrong frequency, large gain error, unexpected behavior | Investigate. Could be a real design issue, a topology misdetection by the analyzer, or a testbench generation bug. Check the .cir file and log. | |
| skip | Could not simulate — missing data, unsupported configuration, simulator error | Note in report. Check the note field for the reason. |
Interpreting Results
Passive circuits (RC filters, LC filters, voltage dividers)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/spice/SKILL.md
Popularity
- Repository stars
- 1,293
- Repository forks
- 114
- 7-day trend score
- 36
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aklofas/kicad-happy/spice)