LLM Circuit Schematic Generation for KiCad
An Intermediate Representation Between the Model and the File
My Role
- LLM writes JSON circuit; code writes KiCad files
- Reasoning models list design rules before generating
- Case library retrieval instead of early fine-tuning
Approach at a Glance
Details- 1Intermediate Representation Between the Model and the File
- 2Deterministic Translator to KiCad
- 3Explicit Design Rules
- 4Reasoning Before Generating
- 5A Case Library Instead of Memory
- 6Model Evaluation and Roadmap
Executive Summary
An independent consulting engagement for an embedded-systems engineer building a tool that generates electronic circuit schematics with an LLM. The tool asked Claude to write KiCad schematic files directly. On simple circuits it worked. On more complex ones it failed in ways no engineer would accept: wires ending in the air instead of on a pin, and traces crossing straight through chip bodies.
My diagnosis was that the model was being asked to do two different jobs at once: design the circuit's logic, and write KiCad's verbose, coordinate-heavy file format. The fix I proposed and prototyped separates them:
- the LLM designs the circuit as a clean JSON description of components, pins and connections, validated against a schema;
- deterministic code writes the KiCad files, handling placement, routing, layers and design-rule checks.
In my prototype, this cut connection errors by 2.5x. Once a circuit is described, the translator generates a complete KiCad project, with schematic, project files, a description and a priced bill of materials, in 0.14 seconds. I delivered the diagnosis, the architecture, three reference circuits and an 8-week roadmap for the client to take it to production.
Client Profile
The client, an experienced embedded-systems engineer, wanted to speed up electronic design by letting an LLM draft schematics in KiCad, the open-source design suite. The early results were promising: the model clearly understood circuit topology. But the output wasn't reliable enough to use on real designs, because of four problems:
- Structural failures: components not connected, wire endpoints floating instead of ending on pins, and traces routed through component bodies, which breaks basic electrical design rules.
- Context limits: as circuits grew, the model lost track of all the components, relationships and constraints at once.
- "Contextual amnesia": the model applied corrections within a session but forgot them in the next project or conversation, so nothing learned accumulated.
- A hostile output format: KiCad files mix the logical circuit with exact coordinates, hierarchical symbol definitions and strict syntax. Every extra detail the model has to write is another chance to get it wrong.
Technical Approach
-
Intermediate Representation Between the Model and the File – This was the central change. The LLM no longer writes KiCad syntax. It writes a JSON description of the circuit: each component with its type and properties (value, voltage, package), the connections from one component's pin to another's, and the design rules checked. A JSON schema validates this description before anything is generated, so a missing connection or an unknown pin is caught as a structural error instead of turning into a broken drawing.
-
Deterministic Translator to KiCad – Python code converts the validated JSON into a complete KiCad project: the schematic, project and board files, a description of the circuit with its key formulas (for example, the cut-off frequency of the RC filter), and a bill of materials with part numbers, suppliers and prices. Placement, routing and layer assignment are the translator's job, not the model's. Because the code is deterministic, it is testable, and a change in the KiCad format only means updating the translator, not re-teaching the model. In the prototype, this split cut connection errors by 2.5x, and the translator generates a project in 0.14 seconds.
-
Explicit Design Rules – The design knowledge in the engineer's head had to become a written, structured rule set: electrical rules (power sequencing, decoupling), physical rules (spacing, vias) and KiCad conventions (layers, naming), organised by type and severity. The rule set goes into every generation request, so the model doesn't depend on remembering previous sessions.
-
Reasoning Before Generating – I recommended reasoning-capable models and prompts that make the model first list the constraints that apply (every pin connected, no trace through a body, power properly decoupled), and only then generate the circuit step by step while checking them. This turns the model from a pattern generator into a design-rule checker of its own work.
-
A Case Library Instead of Memory – To solve the "amnesia" without fine-tuning, I proposed a library of validated circuits, organised by topology (regulators, switching supplies, signal conditioning and others) and indexed in a vector database. For a new request, the 2–3 most similar circuits are retrieved and added to the prompt as reference examples, together with common errors and their corrections. Fine-tuning only makes sense later, once there are over 1,000 validated examples or dozens of circuits generated per day, and the case library collects exactly the data it would need.
-
Model Evaluation and Roadmap – For complex, multi-page circuits, the plan includes benchmarking models with larger context windows against Claude on representative circuits of increasing complexity, measuring connection accuracy and design-rule violations. All of this is laid out in an 8-week roadmap: the schema and translator with test coverage first, then model comparison and rule codification with an initial library of 20–30 validated circuits, then retrieval and a validation pipeline.
Business Outcome
The client got a clear explanation of why the tool failed on complex circuits and a working way out of it. In the prototype, separating circuit logic from file format cut connection errors by 2.5x. Three reference circuits, an RC low-pass filter, a 7805 voltage regulator and an NE555 timer, showed the translator producing complete KiCad projects with priced bills of materials in 0.14 seconds. The 8-week roadmap gave the client a path to production without an expensive fine-tuning project up front.
The lesson applies well beyond electronics: when an LLM must produce a strict, verbose file format, let it produce the meaning in a simple structure and let code produce the format.
Technologies
Planning something similar?
Tell me about it on a short call. New projects can start within 2 weeks