tsci-agent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/cli.js +280061 -0
- package/dist/skill/CHECKLIST.md +26 -0
- package/dist/skill/CLI.md +180 -0
- package/dist/skill/LICENSE +21 -0
- package/dist/skill/README.md +32 -0
- package/dist/skill/SKILL.md +163 -0
- package/dist/skill/SYNTAX.md +229 -0
- package/dist/skill/WORKFLOW.md +92 -0
- package/dist/skill/elements/analogsimulation.md +32 -0
- package/dist/skill/elements/battery.md +24 -0
- package/dist/skill/elements/board.md +23 -0
- package/dist/skill/elements/breakout.md +68 -0
- package/dist/skill/elements/breakoutpoint.md +27 -0
- package/dist/skill/elements/cadassembly.md +39 -0
- package/dist/skill/elements/cadmodel.md +31 -0
- package/dist/skill/elements/capacitor.md +28 -0
- package/dist/skill/elements/chip.md +44 -0
- package/dist/skill/elements/connector.md +125 -0
- package/dist/skill/elements/constraint.md +73 -0
- package/dist/skill/elements/copperpour.md +34 -0
- package/dist/skill/elements/coppertext.md +28 -0
- package/dist/skill/elements/courtyardcircle.md +32 -0
- package/dist/skill/elements/courtyardoutline.md +42 -0
- package/dist/skill/elements/courtyardpill.md +29 -0
- package/dist/skill/elements/courtyardrect.md +38 -0
- package/dist/skill/elements/crystal.md +28 -0
- package/dist/skill/elements/currentsource.md +26 -0
- package/dist/skill/elements/cutout.md +35 -0
- package/dist/skill/elements/diode.md +23 -0
- package/dist/skill/elements/fabricationnotedimension.md +27 -0
- package/dist/skill/elements/fabricationnotepath.md +29 -0
- package/dist/skill/elements/fabricationnoterect.md +40 -0
- package/dist/skill/elements/fabricationnotetext.md +32 -0
- package/dist/skill/elements/fiducial.md +34 -0
- package/dist/skill/elements/footprint.md +95 -0
- package/dist/skill/elements/fuse.md +28 -0
- package/dist/skill/elements/group.md +29 -0
- package/dist/skill/elements/hole.md +23 -0
- package/dist/skill/elements/inductor.md +27 -0
- package/dist/skill/elements/jumper.md +23 -0
- package/dist/skill/elements/led.md +23 -0
- package/dist/skill/elements/mosfet.md +26 -0
- package/dist/skill/elements/mountedboard.md +26 -0
- package/dist/skill/elements/net.md +27 -0
- package/dist/skill/elements/netalias.md +25 -0
- package/dist/skill/elements/netlabel.md +60 -0
- package/dist/skill/elements/opamp.md +30 -0
- package/dist/skill/elements/panel.md +24 -0
- package/dist/skill/elements/pcbkeepout.md +22 -0
- package/dist/skill/elements/pcbnotedimension.md +31 -0
- package/dist/skill/elements/pcbnoteline.md +30 -0
- package/dist/skill/elements/pcbnotepath.md +31 -0
- package/dist/skill/elements/pcbnoterect.md +30 -0
- package/dist/skill/elements/pcbnotetext.md +29 -0
- package/dist/skill/elements/pcbtrace.md +30 -0
- package/dist/skill/elements/pinheader.md +34 -0
- package/dist/skill/elements/pinout.md +26 -0
- package/dist/skill/elements/platedhole.md +34 -0
- package/dist/skill/elements/port.md +38 -0
- package/dist/skill/elements/potentiometer.md +27 -0
- package/dist/skill/elements/pushbutton.md +26 -0
- package/dist/skill/elements/resistor.md +27 -0
- package/dist/skill/elements/resonator.md +28 -0
- package/dist/skill/elements/schematicarc.md +39 -0
- package/dist/skill/elements/schematicbox.md +22 -0
- package/dist/skill/elements/schematiccell.md +26 -0
- package/dist/skill/elements/schematiccircle.md +36 -0
- package/dist/skill/elements/schematicline.md +39 -0
- package/dist/skill/elements/schematicpath.md +40 -0
- package/dist/skill/elements/schematicrect.md +38 -0
- package/dist/skill/elements/schematicrow.md +26 -0
- package/dist/skill/elements/schematicsection.md +91 -0
- package/dist/skill/elements/schematictable.md +48 -0
- package/dist/skill/elements/schematictext.md +23 -0
- package/dist/skill/elements/silkscreencircle.md +27 -0
- package/dist/skill/elements/silkscreenline.md +31 -0
- package/dist/skill/elements/silkscreenpath.md +70 -0
- package/dist/skill/elements/silkscreenrect.md +25 -0
- package/dist/skill/elements/silkscreentext.md +23 -0
- package/dist/skill/elements/smtpad.md +35 -0
- package/dist/skill/elements/solderjumper.md +21 -0
- package/dist/skill/elements/subcircuit.md +29 -0
- package/dist/skill/elements/subpanel.md +26 -0
- package/dist/skill/elements/switch.md +21 -0
- package/dist/skill/elements/symbol.md +54 -0
- package/dist/skill/elements/testpoint.md +26 -0
- package/dist/skill/elements/trace.md +28 -0
- package/dist/skill/elements/tracehint.md +24 -0
- package/dist/skill/elements/transistor.md +25 -0
- package/dist/skill/elements/via.md +30 -0
- package/dist/skill/elements/voltageprobe.md +36 -0
- package/dist/skill/elements/voltagesource.md +36 -0
- package/dist/skill/scripts/export_svgs.sh +23 -0
- package/dist/skill/scripts/fetch_ai_txt.sh +15 -0
- package/dist/skill/scripts/smoke_test.sh +48 -0
- package/dist/skill/templates/arduino-shield-led.tsx +14 -0
- package/dist/skill/templates/chip-with-pinouts.tsx +65 -0
- package/dist/skill/templates/group-layout.tsx +13 -0
- package/dist/skill/templates/minimal-board.tsx +13 -0
- package/package.json +39 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Pre-export / pre-fab checklist
|
|
2
|
+
|
|
3
|
+
Connectivity
|
|
4
|
+
- All intended nets are connected; no floating power pins.
|
|
5
|
+
- No accidental shorts between rails.
|
|
6
|
+
|
|
7
|
+
Footprints and pinout
|
|
8
|
+
- Footprints match intended package size and orientation.
|
|
9
|
+
- Pin 1 orientation is correct for polarized parts.
|
|
10
|
+
|
|
11
|
+
PCB constraints
|
|
12
|
+
- Board outline, mounting holes, and keepouts are correct.
|
|
13
|
+
- Trace width/clearance meets target fab rules.
|
|
14
|
+
|
|
15
|
+
Schematic hygiene
|
|
16
|
+
- Key nets labeled; power/ground clear.
|
|
17
|
+
- Reference designators present and stable.
|
|
18
|
+
|
|
19
|
+
Assembly readiness
|
|
20
|
+
- Use `supplierPartNumbers` for critical parts / specific suppliers.
|
|
21
|
+
- Mark hand-soldered parts with `doNotPlace`.
|
|
22
|
+
|
|
23
|
+
Build/export
|
|
24
|
+
- `tsci build` succeeds without unexpected errors.
|
|
25
|
+
- Exported artifacts match your needs (SVG, netlist, DSN, 3D, KiCad library).
|
|
26
|
+
- Fabrication zip contains Gerbers, BOM CSV, Pick'n'Place CSV.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# tsci CLI primer
|
|
2
|
+
|
|
3
|
+
Prereqs
|
|
4
|
+
- Node.js or Bun
|
|
5
|
+
- Install the tscircuit CLI (global install):
|
|
6
|
+
- npm: `npm install -g tscircuit`
|
|
7
|
+
- bun: `bun install --global tscircuit`
|
|
8
|
+
|
|
9
|
+
Core commands
|
|
10
|
+
|
|
11
|
+
1) Create / bootstrap a project
|
|
12
|
+
- `tsci init` (interactive)
|
|
13
|
+
- `tsci init -y` (accept defaults)
|
|
14
|
+
|
|
15
|
+
Typical output includes:
|
|
16
|
+
- `index.circuit.tsx` (main circuit entrypoint)
|
|
17
|
+
- `package.json`, `tsconfig.json`
|
|
18
|
+
- `tscircuit.config.json`
|
|
19
|
+
|
|
20
|
+
2) Preview locally (interactive)
|
|
21
|
+
- `tsci dev`
|
|
22
|
+
- Opens a local preview server (commonly https://localhost:3020)
|
|
23
|
+
- Note: For AI-driven iteration, prefer `tsci build` over `tsci dev`—dev mode is primarily for interactive visual feedback.
|
|
24
|
+
|
|
25
|
+
3) Search the ecosystem
|
|
26
|
+
- `tsci search "<query>"`
|
|
27
|
+
- Finds footprints, components, and packages across multiple sources
|
|
28
|
+
|
|
29
|
+
Search flags:
|
|
30
|
+
- `--jlcpcb` (or `--lcsc`) – Search JLCPCB/LCSC components by name or part number
|
|
31
|
+
- `--kicad` – Search KiCad footprint library
|
|
32
|
+
- `--tscircuit` – Search tscircuit registry packages
|
|
33
|
+
- `--json` – Return machine-readable JSON output instead of plain text
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
```bash
|
|
37
|
+
# Search JLCPCB for microcontrollers
|
|
38
|
+
tsci search --jlcpcb "ATmega328"
|
|
39
|
+
# Output: ATMEGA328P-AU (C14877) - stock: 20,226
|
|
40
|
+
|
|
41
|
+
# Search JLCPCB by part number
|
|
42
|
+
tsci search --jlcpcb "C14877"
|
|
43
|
+
|
|
44
|
+
# Search JLCPCB for Micro-USB connectors
|
|
45
|
+
tsci search --jlcpcb "micro usb connector"
|
|
46
|
+
|
|
47
|
+
# Search KiCad footprints
|
|
48
|
+
tsci search --kicad "QFP-32"
|
|
49
|
+
# Output: kicad:Package_QFP/LQFP-32_5x5mm_P0.5mm
|
|
50
|
+
|
|
51
|
+
# Search KiCad for SMD resistor footprints
|
|
52
|
+
tsci search --kicad "0402"
|
|
53
|
+
|
|
54
|
+
# Search tscircuit registry for existing projects
|
|
55
|
+
tsci search --tscircuit "LED"
|
|
56
|
+
# Output: seveibar/usb-c-flashlight - Stars: 5
|
|
57
|
+
|
|
58
|
+
# Search without flags (searches all sources)
|
|
59
|
+
tsci search "ESP32"
|
|
60
|
+
|
|
61
|
+
# Search with JSON output (useful for scripts)
|
|
62
|
+
tsci search --jlcpcb "ATmega328" --json
|
|
63
|
+
# Example output:
|
|
64
|
+
# {
|
|
65
|
+
# "results": [
|
|
66
|
+
# {
|
|
67
|
+
# "source": "jlcpcb",
|
|
68
|
+
# "name": "ATMEGA328P-AU",
|
|
69
|
+
# "part_number": "C14877",
|
|
70
|
+
# "description": "Microcontroller Unit, 8-bit AVR",
|
|
71
|
+
# "manufacturer": "Microchip Tech",
|
|
72
|
+
# "stock": 20226,
|
|
73
|
+
# "price": "0.735"
|
|
74
|
+
# }
|
|
75
|
+
# ]
|
|
76
|
+
# }
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
4) Add existing registry packages to your project
|
|
80
|
+
- `tsci add <author/pkg>`
|
|
81
|
+
- Use when a reusable tscircuit package already exists in the registry
|
|
82
|
+
- Example: `tsci add seveibar/PICO_W`
|
|
83
|
+
- Imports look like: `import { PICO_W } from "@tsci/seveibar.PICO_W"`
|
|
84
|
+
- The `@tsci/` scope with dot notation (`author.pkg`) is the registry convention
|
|
85
|
+
|
|
86
|
+
5) Import components (e.g., from JLCPCB)
|
|
87
|
+
- `tsci import <query>`
|
|
88
|
+
- Use when you need to bring a specific part into your project
|
|
89
|
+
- Searches both the tscircuit registry and JLCPCB parts database
|
|
90
|
+
- Opens an interactive picker to select and import the component
|
|
91
|
+
- For USB-C connectors, prefer `<connector standard="usb_c" />` directly instead of importing from JLCPCB
|
|
92
|
+
|
|
93
|
+
Workflow:
|
|
94
|
+
```bash
|
|
95
|
+
# First, search to find the part number
|
|
96
|
+
tsci search --jlcpcb "ATmega328"
|
|
97
|
+
# Output: ATMEGA328P-AU (C14877) - stock: 20,226
|
|
98
|
+
|
|
99
|
+
# Then import using the part number or name
|
|
100
|
+
tsci import "C14877"
|
|
101
|
+
# or
|
|
102
|
+
tsci import "ATmega328"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The interactive picker shows:
|
|
106
|
+
- Registry packages (already wrapped by other users): `author/PART_NAME`
|
|
107
|
+
- JLCPCB parts (raw import): `[jlcpcb] PART_NAME (CXXXXXX)`
|
|
108
|
+
|
|
109
|
+
Tip: If someone has already imported the part, prefer the registry version—it may have better pin mappings or schematic symbols.
|
|
110
|
+
|
|
111
|
+
6) Build (generate circuit.json)
|
|
112
|
+
|
|
113
|
+
Before placement checks or builds, run a netlist check first:
|
|
114
|
+
- `tsci check netlist [file]`
|
|
115
|
+
|
|
116
|
+
Then check schematic placement:
|
|
117
|
+
- `tsci check schematic-placement [file]`
|
|
118
|
+
|
|
119
|
+
Then generate a placement snapshot before routing checks:
|
|
120
|
+
- `tsci snapshot`
|
|
121
|
+
|
|
122
|
+
Then check placement of the entire board or a specific component:
|
|
123
|
+
- `tsci check placement [file] [refdes]`
|
|
124
|
+
|
|
125
|
+
After placement, identify potential congestion before routing:
|
|
126
|
+
- `tsci check routing-difficulty [file]`
|
|
127
|
+
|
|
128
|
+
- `tsci build` (auto-detects entrypoint)
|
|
129
|
+
- `tsci build path/to/file.circuit.tsx`
|
|
130
|
+
|
|
131
|
+
Notes
|
|
132
|
+
- If no path is provided, `tsci build` searches for `index.circuit.tsx` or `mainEntrypoint` in `tscircuit.config.json`.
|
|
133
|
+
- `*.circuit.tsx` files are built automatically.
|
|
134
|
+
- Outputs go to `dist/`.
|
|
135
|
+
|
|
136
|
+
Useful flags
|
|
137
|
+
- `--all-images` (emit PCB/schematic/3D renders into `dist/`)
|
|
138
|
+
|
|
139
|
+
DRC (Design Rule Check)
|
|
140
|
+
- DRC errors are often reported but can frequently be ignored during development.
|
|
141
|
+
- Focus on getting the circuit correct first; DRC violations can be addressed later when preparing for manufacturing.
|
|
142
|
+
|
|
143
|
+
7) Export (SVG/netlist/3D/library)
|
|
144
|
+
- `tsci export <file> -f <format>`
|
|
145
|
+
|
|
146
|
+
Common formats
|
|
147
|
+
- `schematic-svg`
|
|
148
|
+
- `pcb-svg`
|
|
149
|
+
- `readable-netlist`
|
|
150
|
+
- `specctra-dsn`
|
|
151
|
+
- `gltf` / `glb`
|
|
152
|
+
- `kicad-library`
|
|
153
|
+
|
|
154
|
+
8) Visual snapshots for analysis and verification
|
|
155
|
+
- `tsci snapshot` generates visual outputs (schematic/PCB, optionally 3D) and writes/overwrites snapshots by default.
|
|
156
|
+
- Use these visuals to inspect placement, orientation, and overall circuit understanding during iteration.
|
|
157
|
+
- `tsci snapshot --test` switches to regression-test mode: it fails on visual diffs and does **not** overwrite snapshots.
|
|
158
|
+
- `tsci snapshot --pcb-only` generates only PCB visuals, which is especially useful for placement-focused iteration.
|
|
159
|
+
- `tsci snapshot --3d` includes 3D snapshots in the output.
|
|
160
|
+
|
|
161
|
+
Recommended pattern:
|
|
162
|
+
```bash
|
|
163
|
+
# During development: generate fresh visuals for analysis and review
|
|
164
|
+
tsci snapshot
|
|
165
|
+
|
|
166
|
+
# During placement-heavy iterations: focus only on PCB output
|
|
167
|
+
tsci snapshot --pcb-only
|
|
168
|
+
|
|
169
|
+
# In CI/regression checks: detect unexpected visual changes without overwriting
|
|
170
|
+
tsci snapshot --test
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
9) Auth / publish
|
|
174
|
+
- `tsci login` (browser-based)
|
|
175
|
+
- `tsci push` (publish package)
|
|
176
|
+
- `tsci auth print-token`
|
|
177
|
+
|
|
178
|
+
Guidance
|
|
179
|
+
- Prefer `tsci --help` and `tsci <cmd> --help` when unsure about flags.
|
|
180
|
+
- Avoid `tsci push` unless the user explicitly asks to publish.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tscircuit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# tscircuit Agent Skill
|
|
2
|
+
|
|
3
|
+
This folder is intended to be used as an agent Skill.
|
|
4
|
+
|
|
5
|
+
Install as:
|
|
6
|
+
|
|
7
|
+
- `npx skills add tscircuit/skill`
|
|
8
|
+
|
|
9
|
+
The canonical entrypoint is `SKILL.md`.
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- `SKILL.md` – Main skill definition (frontmatter + instructions)
|
|
14
|
+
- `CLI.md` – tsci CLI command reference
|
|
15
|
+
- `SYNTAX.md` – tscircuit JSX syntax primer
|
|
16
|
+
- `WORKFLOW.md` – Recommended development workflow
|
|
17
|
+
- `CHECKLIST.md` – Pre-export/pre-fab checklist
|
|
18
|
+
- `templates/` – Reference TSX examples (copy into your project)
|
|
19
|
+
- `scripts/` – Helper shell scripts
|
|
20
|
+
|
|
21
|
+
## Templates
|
|
22
|
+
|
|
23
|
+
The files in `templates/` are **reference examples**—they are not standalone runnable projects. To use them:
|
|
24
|
+
|
|
25
|
+
1. Create a tscircuit project: `tsci init`
|
|
26
|
+
2. Copy the desired template into your project
|
|
27
|
+
3. Install any additional dependencies (e.g., `npm install @tscircuit/common` for Arduino/RPi templates)
|
|
28
|
+
4. Run `tsci build` or `tsci dev`
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
See `LICENSE` for terms.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tscircuit
|
|
3
|
+
description: Build, modify, and debug tscircuit (React/TypeScript) PCB designs. Use when working with tsci CLI (init/dev/search/add/import/build/export/snapshot/push), choosing footprints, placing parts, wiring nets/traces, or preparing fabrication outputs (Gerbers/BOM/PnP).
|
|
4
|
+
allowed-tools: Read, Write, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# tscircuit
|
|
8
|
+
|
|
9
|
+
You are helping the user design electronics using tscircuit (React/TypeScript) and the `tsci` CLI.
|
|
10
|
+
|
|
11
|
+
When this Skill is active:
|
|
12
|
+
|
|
13
|
+
- Prefer tscircuit’s documented primitives and CLI behavior. If something is unclear, confirm by:
|
|
14
|
+
- Reading local files in the repo (e.g., `tscircuit.config.json`, `index.circuit.tsx`, `package.json`)
|
|
15
|
+
- Running `tsci --help` or the specific subcommand’s `--help`
|
|
16
|
+
- Avoid “inventing” JSX props or CLI flags.
|
|
17
|
+
|
|
18
|
+
## Default workflow
|
|
19
|
+
|
|
20
|
+
1) Clarify requirements (if not already given)
|
|
21
|
+
- Board form factor / size constraints
|
|
22
|
+
- Power sources and voltage rails
|
|
23
|
+
- I/O: connectors, headers, mounting holes, mechanical constraints
|
|
24
|
+
- Target manufacturer constraints (trace/space, assembly, supplier)
|
|
25
|
+
|
|
26
|
+
2) Choose a starting point
|
|
27
|
+
- If the repo is not a tscircuit project, recommend:
|
|
28
|
+
- Install CLI, then `tsci init` to bootstrap a project.
|
|
29
|
+
- If a form-factor template is appropriate (Arduino Shield, Raspberry Pi HAT, etc.), prefer `@tscircuit/common` templates.
|
|
30
|
+
|
|
31
|
+
3) Find and install components
|
|
32
|
+
- Use `tsci search "<query>"` to discover footprints and tscircuit registry packages.
|
|
33
|
+
- For USB-C receptacles/connectors, prefer builtin syntax with `<connector standard="usb_c" />` instead of importing from JLCPCB.
|
|
34
|
+
- Use one of:
|
|
35
|
+
- `tsci add <author/pkg>` for registry packages (installs `@tsci/*` packages)
|
|
36
|
+
- `tsci import <query>` when you need to import a component from JLCPCB or the registry.
|
|
37
|
+
|
|
38
|
+
4) Write/modify TSX circuit code
|
|
39
|
+
- Keep circuits as a default-exported function that returns JSX.
|
|
40
|
+
- Use layout props intentionally:
|
|
41
|
+
- PCB: `pcbX`, `pcbY`, `pcbRotation`, `layer`
|
|
42
|
+
- Schematic: `schX`, `schY`, `schRotation`, `schOrientation`
|
|
43
|
+
- On large projects (5+ components), use `<schematicsection />` to group components by function (e.g. "Power", "MCU", "IO"). This is one of the most important things for schematic readability. Assign each component a `schSectionName` and manually position all members of a section in close proximity using `schX`/`schY`.
|
|
44
|
+
- Use `<trace />` for connectivity; prefer net connections (`net.GND`, `net.VCC`, etc.) for power/ground.
|
|
45
|
+
|
|
46
|
+
5) Build and iterate
|
|
47
|
+
- Run `tsci check netlist` before `tsci check schematic-placement`, `tsci check placement`, and `tsci build` to catch connectivity issues early.
|
|
48
|
+
- Use `tsci check schematic-placement` to validate schematic-side placement before checking PCB placement.
|
|
49
|
+
- Do not finalize unless both `tsci check schematic-placement` and `tsci check placement` pass with no actionable placement violations; if violations exist, fix layout and rerun until clean.
|
|
50
|
+
- Use `tsci check trace-length` to check for long straight line distances (before routing) or long routes (after routing)
|
|
51
|
+
- Run `tsci build --pcb-png [file]` to inspect placement before checking routing.
|
|
52
|
+
- Run `tsci check routing-difficulty` after placement to identify potential areas of congestion.
|
|
53
|
+
- Run `tsci build` to compile and validate the circuit.
|
|
54
|
+
- DRC (Design Rule Check) errors can often be ignored during development—focus on getting the circuit correct first.
|
|
55
|
+
- If routing struggles, reduce density, use `<group />` for sub-layouts, or change autorouter settings.
|
|
56
|
+
- Use `tsci dev` only when you need interactive visual feedback (not typical for AI-driven iteration).
|
|
57
|
+
|
|
58
|
+
6) Validate and export
|
|
59
|
+
- Run `tsci check netlist` before `tsci check schematic-placement`, `tsci check placement`, and `tsci build` when preparing to share/publish.
|
|
60
|
+
- Run `tsci build` (and optionally `tsci snapshot`) before sharing/publishing.
|
|
61
|
+
- Use `tsci export` for SVG/netlist/DSN/3D/library outputs.
|
|
62
|
+
- For manufacturing, obtain fabrication outputs (Gerbers/BOM/PnP) from the export UI after `tsci dev`.
|
|
63
|
+
|
|
64
|
+
## Safety and non-goals
|
|
65
|
+
|
|
66
|
+
- Treat electrical safety, regulatory compliance, and manufacturability as user-owned responsibilities.
|
|
67
|
+
- Do not publish (`tsci push`) or place orders unless the user explicitly requests it.
|
|
68
|
+
|
|
69
|
+
## Local references bundled with this Skill
|
|
70
|
+
|
|
71
|
+
- CLI primer: `CLI.md`
|
|
72
|
+
- Syntax primer: `SYNTAX.md`
|
|
73
|
+
- Workflow patterns: `WORKFLOW.md`
|
|
74
|
+
- Pre-export checklist: `CHECKLIST.md`
|
|
75
|
+
- Ready-to-copy templates: `templates/`
|
|
76
|
+
- Helper scripts: `scripts/`
|
|
77
|
+
|
|
78
|
+
## Builtin Elements
|
|
79
|
+
|
|
80
|
+
- [`<analogsimulation />`](./elements/analogsimulation.md)
|
|
81
|
+
- [`<battery />`](./elements/battery.md)
|
|
82
|
+
- [`<board />`](./elements/board.md)
|
|
83
|
+
- [`<breakout />`](./elements/breakout.md)
|
|
84
|
+
- [`<breakoutpoint />`](./elements/breakoutpoint.md)
|
|
85
|
+
- [`<cadassembly />`](./elements/cadassembly.md)
|
|
86
|
+
- [`<cadmodel />`](./elements/cadmodel.md)
|
|
87
|
+
- [`<capacitor />`](./elements/capacitor.md)
|
|
88
|
+
- [`<chip />`](./elements/chip.md)
|
|
89
|
+
- [`<connector />`](./elements/connector.md)
|
|
90
|
+
- [`<constraint />`](./elements/constraint.md)
|
|
91
|
+
- [`<copperpour />`](./elements/copperpour.md)
|
|
92
|
+
- [`<coppertext />`](./elements/coppertext.md)
|
|
93
|
+
- [`<courtyardcircle />`](./elements/courtyardcircle.md)
|
|
94
|
+
- [`<courtyardoutline />`](./elements/courtyardoutline.md)
|
|
95
|
+
- [`<courtyardpill />`](./elements/courtyardpill.md)
|
|
96
|
+
- [`<courtyardrect />`](./elements/courtyardrect.md)
|
|
97
|
+
- [`<crystal />`](./elements/crystal.md)
|
|
98
|
+
- [`<currentsource />`](./elements/currentsource.md)
|
|
99
|
+
- [`<cutout />`](./elements/cutout.md)
|
|
100
|
+
- [`<diode />`](./elements/diode.md)
|
|
101
|
+
- [`<fabricationnotedimension />`](./elements/fabricationnotedimension.md)
|
|
102
|
+
- [`<fabricationnotepath />`](./elements/fabricationnotepath.md)
|
|
103
|
+
- [`<fabricationnoterect />`](./elements/fabricationnoterect.md)
|
|
104
|
+
- [`<fabricationnotetext />`](./elements/fabricationnotetext.md)
|
|
105
|
+
- [`<fiducial />`](./elements/fiducial.md)
|
|
106
|
+
- [`<footprint />`](./elements/footprint.md)
|
|
107
|
+
- [`<fuse />`](./elements/fuse.md)
|
|
108
|
+
- [`<group />`](./elements/group.md)
|
|
109
|
+
- [`<hole />`](./elements/hole.md)
|
|
110
|
+
- [`<inductor />`](./elements/inductor.md)
|
|
111
|
+
- [`<jumper />`](./elements/jumper.md)
|
|
112
|
+
- [`<led />`](./elements/led.md)
|
|
113
|
+
- [`<mosfet />`](./elements/mosfet.md)
|
|
114
|
+
- [`<mountedboard />`](./elements/mountedboard.md)
|
|
115
|
+
- [`<net />`](./elements/net.md)
|
|
116
|
+
- [`<netalias />`](./elements/netalias.md)
|
|
117
|
+
- [`<netlabel />`](./elements/netlabel.md)
|
|
118
|
+
- [`<opamp />`](./elements/opamp.md)
|
|
119
|
+
- [`<panel />`](./elements/panel.md)
|
|
120
|
+
- [`<pcbkeepout />`](./elements/pcbkeepout.md)
|
|
121
|
+
- [`<pcbnotedimension />`](./elements/pcbnotedimension.md)
|
|
122
|
+
- [`<pcbnoteline />`](./elements/pcbnoteline.md)
|
|
123
|
+
- [`<pcbnotepath />`](./elements/pcbnotepath.md)
|
|
124
|
+
- [`<pcbnoterect />`](./elements/pcbnoterect.md)
|
|
125
|
+
- [`<pcbnotetext />`](./elements/pcbnotetext.md)
|
|
126
|
+
- [`<pcbtrace />`](./elements/pcbtrace.md)
|
|
127
|
+
- [`<pinheader />`](./elements/pinheader.md)
|
|
128
|
+
- [`<pinout />`](./elements/pinout.md)
|
|
129
|
+
- [`<platedhole />`](./elements/platedhole.md)
|
|
130
|
+
- [`<port />`](./elements/port.md)
|
|
131
|
+
- [`<potentiometer />`](./elements/potentiometer.md)
|
|
132
|
+
- [`<pushbutton />`](./elements/pushbutton.md)
|
|
133
|
+
- [`<resistor />`](./elements/resistor.md)
|
|
134
|
+
- [`<resonator />`](./elements/resonator.md)
|
|
135
|
+
- [`<schematicarc />`](./elements/schematicarc.md)
|
|
136
|
+
- [`<schematicbox />`](./elements/schematicbox.md)
|
|
137
|
+
- [`<schematiccell />`](./elements/schematiccell.md)
|
|
138
|
+
- [`<schematiccircle />`](./elements/schematiccircle.md)
|
|
139
|
+
- [`<schematicline />`](./elements/schematicline.md)
|
|
140
|
+
- [`<schematicpath />`](./elements/schematicpath.md)
|
|
141
|
+
- [`<schematicrect />`](./elements/schematicrect.md)
|
|
142
|
+
- [`<schematicrow />`](./elements/schematicrow.md)
|
|
143
|
+
- [`<schematicsection />`](./elements/schematicsection.md)
|
|
144
|
+
- [`<schematictable />`](./elements/schematictable.md)
|
|
145
|
+
- [`<schematictext />`](./elements/schematictext.md)
|
|
146
|
+
- [`<silkscreencircle />`](./elements/silkscreencircle.md)
|
|
147
|
+
- [`<silkscreenline />`](./elements/silkscreenline.md)
|
|
148
|
+
- [`<silkscreenpath />`](./elements/silkscreenpath.md)
|
|
149
|
+
- [`<silkscreenrect />`](./elements/silkscreenrect.md)
|
|
150
|
+
- [`<silkscreentext />`](./elements/silkscreentext.md)
|
|
151
|
+
- [`<smtpad />`](./elements/smtpad.md)
|
|
152
|
+
- [`<solderjumper />`](./elements/solderjumper.md)
|
|
153
|
+
- [`<subcircuit />`](./elements/subcircuit.md)
|
|
154
|
+
- [`<subpanel />`](./elements/subpanel.md)
|
|
155
|
+
- [`<switch />`](./elements/switch.md)
|
|
156
|
+
- [`<symbol />`](./elements/symbol.md)
|
|
157
|
+
- [`<testpoint />`](./elements/testpoint.md)
|
|
158
|
+
- [`<trace />`](./elements/trace.md)
|
|
159
|
+
- [`<tracehint />`](./elements/tracehint.md)
|
|
160
|
+
- [`<transistor />`](./elements/transistor.md)
|
|
161
|
+
- [`<via />`](./elements/via.md)
|
|
162
|
+
- [`<voltageprobe />`](./elements/voltageprobe.md)
|
|
163
|
+
- [`<voltagesource />`](./elements/voltagesource.md)
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# tscircuit syntax primer
|
|
2
|
+
|
|
3
|
+
## 1) Root element
|
|
4
|
+
|
|
5
|
+
A circuit is typically a default export that returns a `<board />` or a form-factor board component from `@tscircuit/common`.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import React from "react"
|
|
11
|
+
|
|
12
|
+
export default () => (
|
|
13
|
+
<board width="10mm" height="10mm" layers={2}>
|
|
14
|
+
<resistor name="R1" resistance="1k" footprint="0402" />
|
|
15
|
+
</board>
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## 2) Layout properties
|
|
21
|
+
|
|
22
|
+
You can place nearly any element with:
|
|
23
|
+
- `pcbX`, `pcbY` (PCB position)
|
|
24
|
+
- `pcbRotation`
|
|
25
|
+
- `layer` (e.g., `"bottom"`)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
For schematics:
|
|
29
|
+
- `schX`, `schY`
|
|
30
|
+
- `schRotation`
|
|
31
|
+
- `schOrientation`
|
|
32
|
+
|
|
33
|
+
Units
|
|
34
|
+
- Numbers are interpreted as mm.
|
|
35
|
+
- Strings can include units (e.g., `"0.1in"`, `"2.54mm"`).
|
|
36
|
+
|
|
37
|
+
## 3) Pin labels with `pinLabels`
|
|
38
|
+
|
|
39
|
+
Use `pinLabels` to map physical pin numbers to meaningful names. This is essential for chips and ICs.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<chip
|
|
43
|
+
name="U1"
|
|
44
|
+
footprint="qfp32"
|
|
45
|
+
pinLabels={{
|
|
46
|
+
pin1: ["GP0", "SPI0_RX", "I2C0_SDA", "UART0_TX"],
|
|
47
|
+
pin2: ["GP1", "SPI0_CS", "I2C0_SCL", "UART0_RX"],
|
|
48
|
+
pin3: "GND",
|
|
49
|
+
// ...
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
With multi-alias, any of the names can be used in traces:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<trace from="U1.GP0" to="U2.SDA" />
|
|
58
|
+
<trace from="U1.SPI0_RX" to="U3.MISO" />
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 4) Pin attributes with `pinAttributes`
|
|
62
|
+
|
|
63
|
+
Use `pinAttributes` to add semantic metadata to pins. This enables DRC checks, schematic arrows, and board-level pinout exposure.
|
|
64
|
+
|
|
65
|
+
Example using a 555 timer (NE555):
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<chip
|
|
69
|
+
name="U1"
|
|
70
|
+
footprint="dip8"
|
|
71
|
+
pinLabels={{
|
|
72
|
+
pin1: "GND",
|
|
73
|
+
pin2: "TRIG",
|
|
74
|
+
pin3: "OUT",
|
|
75
|
+
pin4: "RESET",
|
|
76
|
+
pin5: "CTRL",
|
|
77
|
+
pin6: "THRES",
|
|
78
|
+
pin7: "DISCH",
|
|
79
|
+
pin8: "VCC",
|
|
80
|
+
}}
|
|
81
|
+
pinAttributes={{
|
|
82
|
+
VCC: { requiresPower: true },
|
|
83
|
+
RESET: { mustBeConnected: true },
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Available attributes:
|
|
89
|
+
|
|
90
|
+
| Attribute | Type | Description |
|
|
91
|
+
|-----------|------|-------------|
|
|
92
|
+
| `requiresPower` | boolean | Signal goes INTO the chip (shows input arrow on schematic) |
|
|
93
|
+
| `providesPower` | boolean | Signal comes OUT of the chip (shows output arrow on schematic) |
|
|
94
|
+
| `mustBeConnected` | boolean | DRC error if this pin is left floating |
|
|
95
|
+
| `includeInBoardPinout` | boolean | Expose this pin to the board-level pinout |
|
|
96
|
+
|
|
97
|
+
## 5) Type-safe chip components
|
|
98
|
+
|
|
99
|
+
For reusable chip components, define `pinLabels` as a const and use `ChipProps` for type safety:
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import type { ChipProps } from "tscircuit"
|
|
103
|
+
|
|
104
|
+
const pinLabels = {
|
|
105
|
+
pin1: "VCC",
|
|
106
|
+
pin2: "GND",
|
|
107
|
+
pin3: ["SDA", "I2C_DATA"],
|
|
108
|
+
pin4: ["SCL", "I2C_CLK"],
|
|
109
|
+
} as const
|
|
110
|
+
|
|
111
|
+
export const MyChip = (props: ChipProps<typeof pinLabels>) => (
|
|
112
|
+
<chip
|
|
113
|
+
{...props}
|
|
114
|
+
pinLabels={pinLabels}
|
|
115
|
+
footprint="soic4"
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 6) Use `<connector />` for USB connectors
|
|
121
|
+
|
|
122
|
+
Use `<connector />` for all USB connector footprints (USB-C, Micro-USB, Mini-USB, and USB-A/B variants). This gives the design checker better semantic information for connector-related DRC.
|
|
123
|
+
|
|
124
|
+
If a `<chip />` is currently modeling a USB receptacle, plug, or jack, consider refactoring it to `<connector />` so additional USB-specific DRC checks can apply.
|
|
125
|
+
|
|
126
|
+
For a USB-C connector component, prefer the built-in standard:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<connector name="USBC" standard="usb_c" />
|
|
130
|
+
|
|
131
|
+
<trace from="USBC.VBUS1" to="net.VBUS" />
|
|
132
|
+
<trace from="USBC.VBUS2" to="net.VBUS" />
|
|
133
|
+
<trace from="USBC.DP1" to="net.USB_DP" />
|
|
134
|
+
<trace from="USBC.DP2" to="net.USB_DP" />
|
|
135
|
+
<trace from="USBC.DM1" to="net.USB_DM" />
|
|
136
|
+
<trace from="USBC.DM2" to="net.USB_DM" />
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
No JLC import is required for this default USB-C connector usage.
|
|
140
|
+
|
|
141
|
+
## 7) Connectivity with `<trace />`
|
|
142
|
+
|
|
143
|
+
Connect pins with port selectors:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
<trace from="R1.pin1" to="C1.pin1" />
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Connect to named nets. Net names must start with a letter or underscore and can only contain letters, numbers and underscores.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<trace from="U1.pin1" to="net.GND" />
|
|
153
|
+
<trace from="U1.pin8" to="net.VCC" />
|
|
154
|
+
<trace from="U1.pin8" to="net.V3_3" />
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Pin labels (in `pinLabels`) can contain letters, numbers, and underscores. Unlike net names, pin labels **can** start with a number (e.g., `"3V3"` is valid).
|
|
158
|
+
|
|
159
|
+
Useful trace props (optional)
|
|
160
|
+
- `width` / `thickness`
|
|
161
|
+
- `minLength` / `maxLength`
|
|
162
|
+
|
|
163
|
+
## 8) Grouping for PCB layout
|
|
164
|
+
|
|
165
|
+
Use `<group />` like a container to move/layout parts together.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
<board width="20mm" height="20mm">
|
|
169
|
+
<group pcbX={5} pcbY={5}>
|
|
170
|
+
<resistor name="R1" resistance="1k" footprint="0402" pcbX={2.5} pcbY={2.5} />
|
|
171
|
+
<resistor name="R2" resistance="1k" footprint="0402" pcbX={2.5} pcbY={0} />
|
|
172
|
+
<resistor name="R3" resistance="1k" footprint="0402" pcbX={2.5} pcbY={-2.5} />
|
|
173
|
+
</group>
|
|
174
|
+
</board>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## 9) Schematic pin arrangement
|
|
178
|
+
|
|
179
|
+
Control how pins appear on the schematic symbol with `schPinArrangement`:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
<chip
|
|
183
|
+
name="U1"
|
|
184
|
+
footprint="soic16"
|
|
185
|
+
pinLabels={{
|
|
186
|
+
pin1: "VCC1",
|
|
187
|
+
pin2: "IN1",
|
|
188
|
+
pin3: "IN2",
|
|
189
|
+
pin4: "IN3",
|
|
190
|
+
pin5: "IN4",
|
|
191
|
+
pin6: "GND1",
|
|
192
|
+
pin7: "GND2",
|
|
193
|
+
pin8: "VCC2",
|
|
194
|
+
pin9: "OUT1",
|
|
195
|
+
pin10: "OUT2",
|
|
196
|
+
pin11: "OUT3",
|
|
197
|
+
pin12: "OUT4",
|
|
198
|
+
}}
|
|
199
|
+
schPinArrangement={{
|
|
200
|
+
topSide: { pins: ["VCC1", "VCC2"], direction: "left-to-right" },
|
|
201
|
+
bottomSide: { pins: ["GND1", "GND2"], direction: "left-to-right" },
|
|
202
|
+
leftSide: { pins: ["IN1", "IN2", "IN3", "IN4"], direction: "top-to-bottom" },
|
|
203
|
+
rightSide: { pins: ["OUT1", "OUT2", "OUT3", "OUT4"], direction: "top-to-bottom" },
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Available sides: `leftSide`, `rightSide`, `topSide`, `bottomSide`
|
|
209
|
+
- Left/right sides use `direction: "top-to-bottom"` or `"bottom-to-top"`
|
|
210
|
+
- Top/bottom sides use `direction: "left-to-right"` or `"right-to-left"`
|
|
211
|
+
|
|
212
|
+
## 10) Manufacturing helpers
|
|
213
|
+
|
|
214
|
+
For turnkey assembly you will often want:
|
|
215
|
+
- `supplierPartNumbers` (pin a specific supplier SKU/part number)
|
|
216
|
+
- `doNotPlace` (exclude from automated placement)
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<capacitor
|
|
222
|
+
name="C1"
|
|
223
|
+
capacitance="100nF"
|
|
224
|
+
footprint="0402"
|
|
225
|
+
supplierPartNumbers={{ jlcpcb: "C14663" }}
|
|
226
|
+
/>
|
|
227
|
+
|
|
228
|
+
<resistor name="R1" resistance="10k" footprint="0402" doNotPlace />
|
|
229
|
+
```
|