Skip to main content
Circuit Generation

How to prompt AI to build tscircuit circuits

AI assistants are most useful when a circuit prompt describes the product, the important interfaces, the physical constraints, and how the result should be checked. The examples below are based on real tscircuit design prompts. They are intentionally direct: the goal is to give the AI enough engineering context to make useful decisions without prescribing every implementation detail.

Start from a form factor

Before asking an AI assistant to place parts, decide whether the board needs to fit an existing standard. Common starting points include Arduino shields, Raspberry Pi HATs, MicroMod modules, or a custom outline with mounting holes. A reusable form factor gives the AI a mechanical boundary and lets the prompt focus on the circuit.

For example, an Arduino shield can provide the board outline and headers while the prompt describes the new function:

import { ArduinoShield } from "@tscircuit/common"

export default () => (
<ArduinoShield name="example">
<resistor name="R1" resistance="220ohm" footprint="0805" pcbX={0} pcbY={5} />
<led name="LED1" color="red" footprint="0603" pcbX={0} pcbY={-5} />
<trace from=".D13" to="R1.pin1" />
<trace from="R1.pin2" to="LED1.pin1" />
<trace from="LED1.pin2" to=".GND2" />
</ArduinoShield>
)
PCB Circuit Preview

Start with the tscircuit skill

Install the tscircuit skill so your AI assistant has the syntax, CLI workflows, component-selection guidance, and layout conventions it needs:

bunx skills add tscircuit/skill

The skill is especially useful when the task involves importing parts, choosing footprints, running tsci build, inspecting placement, or iterating on a real board. See Use tscircuit with AI for the general setup.

A useful prompt structure

A strong circuit-building prompt usually contains:

  1. The product goal — what the board or device should do.
  2. The main components and interfaces — MCU, transceiver, display, connector, sensor, power input, or motor driver.
  3. Sourcing requirements — for example, parts should be available from JLCPCB, or a known component should come from tscircuit/common.
  4. Mechanical requirements — board size, mounting holes, connector direction, layer count, or a particular enclosure or form factor.
  5. Validation and workflow — commands such as tsci build, tsci check placement, snapshots, or visual inspection.
  6. A sequence of work — placement and connectivity first, then routing and optimization.

Here is a reusable template:

Use the tscircuit skill to build a board for [product or function].

The board should use [main components and interfaces].
Use [tscircuit/common components, JLCPCB imports, or specific part numbers]
where appropriate.

Mechanical constraints:
- [dimensions, mounting holes, connector orientation, enclosure, or shape]
- [layer count, size, or clearance constraints]

First create a complete, readable placement and netlist. Then run
tsci check placement, inspect the PCB image, and fix overlaps or missing
connections before enabling routing. Use tsci build and report any
remaining errors.

Prompt examples by use case

Describe a product and its important interfaces

Start with the behavior of the device and name the parts that define its architecture. This gives the AI a meaningful system boundary while leaving it room to choose supporting components.

Use tscircuit to build the following electronic device: Race-kart CAN bus
telemetry puck built around an NXP S32K144 and a TJA1051 transceiver with a
sealed M12 connector and microSD logging.

For a smaller sensor board, include the signal path and the physical arrangement:

Please create a USB-C RP2040 board (use tscircuit/common for the RP2040
circuit) that has 4 photo diodes, amplified, connected to the RP2040 using
tscircuit.

We want to be able to read photodiode levels rapidly from the RP2040 via
USB-C. Space out the diodes in a row over 100mm (the device should be shaped
like a stick) and make sure there are mounting holes.

For power electronics, state the complete power path and the size target:

Can you generate a 1 cell 18650 battery board with BMS, 3.4V to 12V step up
and USB-C charger circuit?

Keep it relatively small. Use tscircuit, use components from JLCPCB.

Other useful product-oriented prompts include:

Use tscircuit to build the following electronic device: Ultrasonic imaging
intro kit using TDC7200 time-to-digital converter to measure echo delays from
a transducer array.
Use tscircuit to build the following electronics device: I2S-to-analog hi-fi
DAC module using a PCM5102A to modernize a vintage CD player or streamer with
low-noise RCA outputs.

Recreate or extend an existing design

When a reference design exists, tell the AI what to inspect and what parts of the reference should be preserved. It can then use the reference for architecture while still producing tscircuit source.

Read this article, pull all the relevant images and analyze them (to
understand the schematic), recreate the board Pico Z80:
https://eaw.app/picoz80/

Use tsci import with JLCPCB to get the chips you need. Keep things organized
into multiple files since the project is complex. Don't worry about routing
but get decent placement.

For an existing PCB file or online reference, be explicit about the first verification step:

Please recreate this circuit board using tscircuit. Use the tscircuit skill
and tsci check placement to check placement:
https://www.kicadprojects.com/d-1281214538485596160

To extend a known tscircuit design, identify the reusable circuit and the new behavior:

Referencing tscircuit/common's RP2040 microcontroller board and
tscircuit.com/abse/gameboy, please build a dual RP2350 board where one RP2350
functions as the GPU, taking serial commands for what to draw from the CPU
RP2350.

Otherwise we want the same stuff with regard to the screen header, the
buttons, and the speaker circuit.

Give the AI sourcing and footprint constraints

If the board must be manufacturable, say so in the first prompt. The AI can then search for real footprints instead of filling the design with placeholders.

I want to build a PCB that goes on the back of a NEMA 17 stepper and is
RP2040/A4988 based. Please use the tscircuit skill and import from JLCPCB
extensively using `tsci import --jlcpcb` and `tsci search --jlcpcb`.

For a development board, specify the sourcing tradeoff and the intended use:

Can you select a good starter FPGA and create a dev board with tscircuit?
The parts should generally be available and stocked at JLCPCB so we can
order the board.

The FPGA should drive a very low-resolution 320x160 display. Include a
breakout with a pin header for an ILI9341-driven 2.8-inch screen. Ideally the
board should be programmable via USB-C; if a programmer is needed, use a
simple, inexpensive RP2040, STM32, or a part recommended by the FPGA maker.

For a single part where the footprint is the main goal, a short prompt is enough:

Using tscircuit, create an RK3326. Feel free to import a footprint from
JLCPCB.

Include the physical constraints

Physical details are not secondary to the circuit. They determine the board outline, connector placement, mounting-hole locations, and often the routing strategy.

Can you use tscircuit to make me a board that is an RP2040 XIAO board with
an I2C screen and standard push buttons so you can play Tetris with it?

Use a two-layer board, set minViaCopperDiameter to 2.5 and
minViaHoleDiameter to 1, and keep the board fairly small.

For a board that must fit a mechanical assembly, state the mounting relationship and the power architecture:

I want to build a PCB that goes on the back of a NEMA 17 stepper and is
RP2040/A4988 based. Treat USB-C and the RP2040, the motor driver and power,
sensing/protection, and the motor-side mechanical interface as separate
blocks. The board needs the NEMA 17 mounting pattern and practical motor and
USB connections.

Ask for validation before routing

The best first result is a correct, inspectable placement and netlist. Ask the AI to validate those before spending time on autorouting:

Please create a circuit for an 8x8 USB audio interface core using an XMOS
XU208 to stream multichannel audio for a small studio rack with ADAT
expansion.

Use tsci build and tsci check placement. Inspect the PCB image, make the
board compact, and keep the decoupling capacitors near the relevant pins.

Useful follow-up prompts are concrete and testable:

Use `tsci build --pcb-png` and inspect the board visually. It is extremely
sparse right now; try to pack it more tightly.
Run `tsci check placement`. Resolve every overlap and missing connection you
find before turning routing back on.
Create a simple USB-C 1:2 hub in tscircuit. First make the placement and
connectivity readable, then build it and check for placement errors.

Generate families of test circuits

For datasets or design exploration, define the common structure and the variation you want. Make the generation rules explicit so the AI does not produce ten copies of the same board:

Initialize a tscircuit dataset of typical boards with connectors on the
edges, one to three MCU-like components in the center, and 0201/0402/0603
passives around them. Import real connector and MCU footprints with tsci
search or tsci import, create the placement JSON first, then generate the
TSX circuit files. Run tsci check placement and generate five example
circuits for inspection. Keep routing disabled until placement is correct.

Then refine the family with small, measurable follow-ups:

Generate 10 more boards, keeping them at or below 60mm by 40mm and enforcing
at least 50% board density. For this batch, import some of the MCUs from the
JLCPCB Wi-Fi modules list so the examples have more variation.

A good iteration loop

After the first build, give the AI one focused correction at a time:

  1. Run tsci build with routing disabled if placement is still changing.
  2. Run tsci check placement and fix overlaps, off-board parts, courtyard violations, and missing connections.
  3. Inspect a PCB snapshot or --pcb-png output. Ask about visible empty space, connector orientation, and component grouping.
  4. Check the netlist before routing. Make sure both pins of every passive are connected.
  5. Enable routing only after the placement and connectivity are credible.
  6. Run the build and checks again after each meaningful change.

Good feedback is specific:

The USB connector is facing away from the board edge. Rotate it 180 degrees,
move it close to the edge without putting a plated hole off-board, then run
tsci check placement again.

Avoid asking for placement, routing, mechanical changes, and a new architecture in one follow-up. Small feedback loops make it easier for both you and the AI to see which change improved the board.

Common prompt mistakes

  • Only naming a chip: “Make an RP2040 board” leaves the power, USB, programming, and mechanical requirements undefined.
  • Omitting the manufacturing target: If the board must be orderable, say whether parts should be available from JLCPCB or another supplier.
  • Routing too early: Ask for placement and connectivity checks before asking for a finished routed board.
  • No physical context: A board mounted to a motor, placed in a case, or shaped like a stick needs those constraints in the first prompt.
  • No acceptance criteria: Include the commands, snapshots, or checks the AI should run before calling the task complete.