punkfab/circuit-skills/tree/main/claude/circuit-viewer
circuit-viewer:Claude Code mod
punkfab/circuit-skills の Claude Code プラグイン。DRC マーカー付きの配線済み KiCad PCB プロジェクトを表示するライブペイン、/board コマンド、open_board・check_board・get_netlist ツールを追加します。
この mod について
Claude Code 内の回路ビューアーです。会話の横のペインに、circuit-skills パイプラインが構築する PCB プロジェクトを表示し、基板の変更中もライブで更新します。モデルが呼び出すツールも備えています。独自のジオメトリから配線済み KiCad 基板(表/裏銅箔、パッド、ビア、穴、外形、DRC マーカー)を描画し、ゲート判定、配線メトリクス、ルーターの進行状況、ホットキー(n 次の問題、z ズーム、s 表/裏/両面、c ゲート実行、r 再読み込み)を表示します。基板、ルール、設計、ルーターの進行状況を 2 秒ごとに stat してライブ状態を保ちます。コマンドとツールは /board <path>、/board check、open_board、check_board、get_netlist です。プラグイン marketplace(punkfab/circuit-skills)からインストールするか、プラグインディレクトリを読み込みます。netlist には Node.js 18+、KiCad 9+、Python 3、tscircuit が必要です。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add punkfab/circuit-skills claude plugin install circuit-viewer
原文 / README
circuit-viewer: the Claude Code mod
The circuit viewer inside Claude Code: a pane beside the conversation that shows a PCB project the way
the circuit-skills pipeline builds it, kept live while the board changes, plus tools the model calls.
It is the Claude counterpart of the Codex plugin in ../../plugin/circuit-skills,
built on the same backend (../../mcp).
What you get
- A pane with the routed KiCad board drawn from its own geometry: front and back copper, pads, vias,
holes, the outline, and every blocking DRC marker (open nets in orange with a line between the two ends,
shorts in red). In the terminal it is a colour picture made of half-block cells (any terminal); in the
desktop app and the editor, an SVG.
- The gates' verdict, routing metrics (track, vias, and how much plane/pour-net copper is travelling as
track), and the router's progress when a
route_dsn.pyrun is writing it. - Buttons (hotkeys while the pane has focus): n next issue (selects it in white and names it), z zoom to it, s front / back / both, c run the gates, r reload.
- Live: it stats the board, its rules, the design and the router's progress file every two seconds and redraws on a save (re-running the gates if they had run). A toast says so.
- The gates' verdict, routing metrics (track, vias, and how much plane/pour-net copper is travelling as
track), and the router's progress when a
/board <path>opens a project (folder,.kicad_pcbor.circuit.tsx);/board checkruns the gates;/boardreopens the pane.- Tools for the model:
open_board,check_board,get_netlist(asmcp__circuit-viewer__<name>), the same verdicts the Codex plugin and the pipeline use.
Install
Needs Node.js 18+, KiCad 9+ (kicad-cli on PATH), Python 3 (the gates), and the netlist needs tscircuit
installed in the project (npm install there). Nothing to build.
From the plugin marketplace (terminal or the desktop app's Code tab):
/plugin marketplace add punkfab/circuit-skills
/plugin install circuit-viewer@circuit-skills
In the desktop app's plugin browser, add punkfab/circuit-skills as a marketplace, then install
circuit-viewer from it. A local checkout works as a marketplace too: add its folder path instead.
Or load it straight from a checkout:
# one session
claude --plugin-dir /path/to/circuit-skills/claude/circuit-viewer
# every session: in ~/.claude/settings.json
# "env": { "CLAUDE_CODE_PLUGIN_DIRS": "/path/to/circuit-skills/claude/circuit-viewer" }
Then /board ~/my-project/pcb, or ask Claude to open a board.
The skills themselves (pcb-layout and the rest) are separate: link them into ~/.claude/skills/ as before.
How it works
The mod runs in Claude Code's plugin environment (no Node, no files of its own), so the work is done by the
viewer's CLI (../../mcp/src/cli.ts): one 31 kB bundle, embedded here as
hooks/cli-source.ts and run with node --input-type=module - with the source on stdin, so the mod needs
no install path. It carries pcb-layout's gate scripts and unpacks them to the temp folder when no checkout
is nearby.
| File | |
|---|---|
| hooks/register.tsx | the hooks: pane, /board, tools, live refresh |
| hooks/picture.ts | the board as Raster cells and as SVG, from the geometry |
| hooks/cli-source.ts | generated by mcp/build.mjs; do not edit |
| types/index.d.ts | the mod's $.state contract |
After changing anything in mcp/src, run npm run build in mcp/ to regenerate cli-source.ts
(npm test fails if it is stale). claude plugin validate claude/circuit-viewer checks the mod.