circuit-diagram-generator

Circuit diagram generator (CircuiTikZ): generates rigorous CircuiTikZ circuit code from textual descriptions or reference images and can compile to PDF/SVG. Use when users request drawing circuits, replicating diagrams, or creating circuit figures for exams or papers.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "circuit-diagram-generator" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-8174f82e9d0bafe43fa0a33dd35726c8a023831e30887516fad1648e87c16c60. Verify the upstream source and version against https://skillhub.cn/skills/user_ce094de0/circuit-diagram-generator before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Circuit diagram generator (CircuiTikZ): generates rigorous CircuiTikZ circuit code from textual descriptions or reference images and can compile to PDF/SVG. Use when users request drawing circuits, replicating diagrams, or creating circuit figures for exams or papers.

0 Downloads

Introduction source: third_party · user_ce094de0 · 1.0.2 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: circuit-diagram-generator
description: 根据文字描述或参考图片生成严谨的 CircuiTikZ 电路图代码,并可编译为 PDF/SVG。用户要求画电路图、复刻电路图、制作试卷或论文电路插图时调用。

电路图生成器(CircuiTikZ)

使用 LaTeX 与 CircuiTikZ 生成可编辑、可复现的矢量电路图。默认采用中国教材常见的欧式矩形电阻,并优先保证拓扑、标注、方向和极性准确。

触发方式

用户出现以下意图时调用:

  • “画一个 RC / RLC / 桥式 / 运放电路图”
  • “把这张电路图复刻成 LaTeX / CircuiTikZ”
  • “生成适合试卷、论文、讲义的矢量电路图”
  • “修正这段 CircuiTikZ 代码的连线、极性或排版”

即使用户未明确提到 LaTeX,只要目标是规范、可打印的电路图,也应调用本 Skill。

能力边界

适合

  • 集总参数电路:电阻、电容、电感、独立源、受控源、开关、二极管、晶体管、运放、变压器等。
  • 串并联、桥式、滤波器、放大器和教材/试卷常见电路。
  • 从清晰图片复刻拓扑与版式。
  • 输出完整 .tex 源码;本机具备 LaTeX 时进一步生成 PDF,可选生成 SVG。

不适合或需说明

  • PCB 走线、芯片封装、Gerber、面包板实物接线图:应改用 KiCad、Fritzing 等工具。
  • 图片模糊、元件被遮挡或连线交叉处无法判断是否相连:不得猜测,先指出歧义并向用户确认。
  • 射频微带、复杂 IC 内部结构或厂商专用符号:CircuiTikZ 可能无原生符号,应说明需自定义 TikZ 图形。
  • 当前环境没有 LaTeX 编译器:仍须提供完整源码,但不得声称已生成 PDF/SVG。

强制准确性规则

  1. 先拓扑、后排版:先列出节点和支路,再确定坐标;不得仅凭外观拼接线段。
  2. 连接点明确:电气连接使用 node[circ] 或连续路径;仅交叉不连接时避免圆点,并使用绕线或跳线表达。
  3. 方向一致:逐项核对电流箭头、源方向、电压正负极和参考方向。
  4. 标注忠实:保留用户给出的元件编号、数值、上下标、端口名和单位,不擅自改写。
  5. 默认欧式电阻:使用 \usepackage[european]{circuitikz};只有用户明确要求美式锯齿电阻时才切换。
  6. 不伪造结果:只有实际编译成功后才报告 PDF/SVG 已生成。

标准工作流

1. 分析输入

文字输入:提取元件、端点、串并联关系、控制关系、方向和标签。

图片输入:依次识别:

  1. 外部端口与公共节点;
  2. 每条支路及元件顺序;
  3. 交叉点是否连接;
  4. 电流箭头、电压极性和控制量;
  5. 原图大致布局与对称关系。

复杂电路先在内部形成“节点—支路表”,例如:

支路 起点 元件 终点
1 A 电阻 $R_1$ B
2 B 电容 $C$ GND

存在关键歧义时先询问,不要盲目出图。

2. 生成代码

平台可能不允许 Skill 包携带 .tex 文件,因此模板必须直接从下方代码块复制到运行时输出,不依赖外部模板资源。

\documentclass[border=8pt]{standalone}
\usepackage[european]{circuitikz}
\usepackage{amsmath}
% 标签包含中文时取消下一行注释,并优先使用 xelatex 编译:
% \usepackage[UTF8]{ctex}

\begin{document}
\begin{circuitikz}[american voltages, american currents]
  % 在此绘制电路
\end{circuitikz}
\end{document}

生成时遵守:

  • 坐标优先使用整齐的整数或半整数网格。
  • 主回路优先使用连续 \draw 路径,减少视觉上相接但电气上断开的风险。
  • 标签使用数学模式,如 l=$R_1$、v^>=$u_C$、i>^=$i$。
  • 地使用 node[ground]{},端口可使用 ocirc,实连接点使用 circ。
  • 复杂图拆成少量语义清晰的绘制语句,不为一次性图形创建无必要的宏。

3. 自检

输出前逐项核对:

  • 元件数量、类型和标签是否完整;
  • 每个元件两端连接的节点是否正确;
  • 并联支路是否共享同一对节点;
  • 交叉线是否错误地产生或遗漏连接点;
  • 箭头、正负极、受控源控制量是否与输入一致;
  • 是否存在未闭合路径、重叠标签或过短导线。

4. 编译与交付

将源码保存到用户指定位置;未指定时使用有意义的文件名,如 rc_lowpass.tex。可运行:

python scripts/compile_circuit.py <电路图.tex> --svg
  • 脚本自动选择可用编译器;中文标签优先 xelatex。
  • --svg 仅在安装 pdf2svg 时转换。
  • 本 Skill 不访问网络,因此不存在网络重试需求。
  • 编译失败时,根据脚本诊断修改源码后重新编译,不能只返回原始日志。

输出格式

默认交付顺序:

  1. 一句话说明拓扑与采用的符号规范;
  2. 完整、可独立编译的 LaTeX 源码;
  3. 若实际执行编译,列出生成文件路径和编译器;
  4. 若未编译成功,给出明确原因和可操作修复建议。

用户只要求代码时,不强制执行编译。用户要求成图或可打印文件时,应在环境允许的情况下编译验证。

渐进示例

最小串联 RC

\draw (0,0)
  to[V, l=$U_s$] (0,3)
  to[R, l=$R$] (3,3)
  to[C, l=$C$] (3,0)
  -- (0,0);

带节点与接地的 RC 低通

\draw (0,0) node[ground]{} to[V, l=$U_s$] (0,3)
      to[R, l=$R$] (3,3) node[circ, label=above:$u_o$]{};
\draw (3,3) to[C, l=$C$] (3,0) node[ground]{};

完整语法、复杂拓扑和故障排查见 references/reference.md。可运行示例见 scripts/example.py。

Current listing version

1.0.2

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 解决电路图绘制、复刻、论文插图等明确工程与教学需求
  • 覆盖集总参数电路、运放、桥式等高频场景
  • 提供完整 LaTeX 源码与编译交付闭环
Trigger Precision90/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层 frontmatter 中 description 为空,实质描述内容位于 skill_body 内部

    Recommendation: 将 description 内容移至顶层 frontmatter,保持结构规范

Highlights

  • 触发词覆盖画电路图、复刻、试卷插图等典型场景
  • 边界清晰,变体覆盖合理
Structure and Standards95/100

Highlights

  • Phase 划分清晰:分析输入、生成代码、自检、编译交付
  • 含端到端示例与渐进示例
  • frontmatter 完整,文档结构规范
Execution Reliability90/100

Highlights

  • 工具来源明确(LaTeX + CircuiTikZ)
  • 覆盖主要异常:图片模糊、交叉点歧义、无 LaTeX 环境
  • 编译失败有明确修复建议,不可逆操作有确认机制
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.