wire-lang
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWire Lang Authoring Skill
Wire Lang 创作技能
Use this skill to help people author Wire Lang source. Wire Lang is a textual
language for describing electronic schematics and rendering them as readable SVG
diagrams.
本技能用于帮助用户编写Wire Lang源码。Wire Lang是一种文本语言,用于描述电子原理图并将其渲染为易读的SVG图表。
First Move For Authoring
创作第一步
- Identify the circuit the user wants to describe.
- Choose component instances and stable instance IDs.
- Connect terminals through named nets or statements.
connect - Add title, description, annotations, and render hints only when useful.
- Check the source with when the CLI is available.
wire check
Read the focused reference files as needed:
- for the authoring concept graph.
references/concept-map.md - for syntax and statement shapes.
references/source-format.md - for standard components, terminals, and properties.
references/component-library.md - for source-writing conventions.
references/style-guide.md - for good and bad examples.
references/examples.md - when a user asks for simulation, PCB layout, breadboard layout, BOMs, custom symbols, or browser/editor integrations.
references/boundaries.md
- 明确用户想要描述的电路。
- 选择组件实例及稳定的实例ID。
- 通过命名网络或语句连接端子。
connect - 仅在必要时添加标题、描述、注释和渲染提示。
- 当CLI可用时,使用检查源码。
wire check
按需阅读以下针对性参考文件:
- :创作概念图。
references/concept-map.md - :语法与语句结构。
references/source-format.md - :标准组件、端子及属性。
references/component-library.md - :源码编写规范。
references/style-guide.md - :正反示例。
references/examples.md - :当用户询问仿真、PCB布局、面包板布局、物料清单(BOM)、自定义符号或浏览器/编辑器集成时查阅。
references/boundaries.md
Validate And Render
验证与渲染
Use the CLI instead of hand-validating whenever the user's environment
can run it:
wirebash
npm i -D wire-lang
npx wire check path/to/circuit.wire
npx wire render path/to/circuit.wire --out path/to/circuit.svg
npx wire watch path/to/circuit.wire --out path/to/circuit.svgFor a one-off run without adding a package to the project, invoke the
binary from the package:
wirewire-langbash
npx -p wire-lang wire check path/to/circuit.wire
npx -p wire-lang wire render path/to/circuit.wire --out path/to/circuit.svg- Use as the real implementation of checking the source against MVP syntax and the component library.
wire check - Use as the canonical author-to-SVG artifact step.
wire render <file>.wire --out <file>.svg - Use while iterating.
wire watch <file>.wire --out <file>.svg - Add to
--json,wire check, orwire renderwhen machine-readable diagnostics are useful.wire watch - Markdown does not auto-render fenced blocks in the MVP. The intended documentation workflow is: author
wire-> run.wire-> link or embed the generatedwire render..svg - Do not claim that source was checked or rendered unless the command actually ran. If the CLI is unavailable, say the source is not tool-validated and give the exact command to run.
只要用户环境可运行 CLI,就使用它而非手动验证:
wirebash
npm i -D wire-lang
npx wire check path/to/circuit.wire
npx wire render path/to/circuit.wire --out path/to/circuit.svg
npx wire watch path/to/circuit.wire --out path/to/circuit.svg若不想向项目添加依赖包,可直接从包调用二进制文件进行一次性运行:
wire-langwirebash
npx -p wire-lang wire check path/to/circuit.wire
npx -p wire-lang wire render path/to/circuit.wire --out path/to/circuit.svg- 使用作为验证源码是否符合MVP语法及组件库的标准方式。
wire check - 使用作为从源码生成SVG文件的标准步骤。
wire render <file>.wire --out <file>.svg - 迭代开发时使用。
wire watch <file>.wire --out <file>.svg - 当需要机器可读的诊断信息时,为、
wire check或wire render添加wire watch参数。--json - MVP版本中,Markdown不会自动渲染 fenced 代码块。标准文档流程为:编写
wire文件 -> 运行.wire-> 链接或嵌入生成的wire render文件。.svg - 除非实际运行了命令,否则不要声称源码已被检查或渲染。若CLI不可用,需说明源码未经过工具验证,并给出具体的运行命令。
Authoring Rules
创作规则
- Start every MVP source with .
schematic - Use source to describe logical schematics, not breadboards, PCB layouts, physical routing, or simulations.
.wire - Declare component instances with .
component ID Type ... - Use canonical component names and terminal names from the standard library.
- Use named nets for important or reused electrical nodes such as ,
VCC,5V,3V3,GND, orSDA.SCL - Use for simple anonymous connections.
connect - Treat power nets as normal nets; they do not create hidden connections.
- Use for visible explanatory text. Use
annotationonly for source comments.// - Use render hints for layout guidance, not electrical meaning.
- Do not invent unsupported syntax. If Wire Lang cannot express the user's request in the MVP, say so and offer the closest valid source.
- 所有MVP版本的源码都必须以开头。
schematic - 使用源码描述逻辑原理图,而非面包板、PCB布局、物理布线或仿真内容。
.wire - 使用声明组件实例。
component ID Type ... - 使用标准库中的规范组件名称和端子名称。
- 为重要或复用的电气节点使用命名网络,如、
VCC、5V、3V3、GND或SDA。SCL - 使用进行简单的匿名连接。
connect - 将电源网络视为普通网络;它们不会创建隐式连接。
- 使用添加可见的解释性文本。仅使用
annotation作为源码注释。// - 使用渲染提示指导布局,而非承载电气含义。
- 不要自创不支持的语法。若Wire Lang的MVP版本无法表达用户的需求,需明确说明并提供最接近的有效源码。
Default Output
默认输出
When asked to create Wire Lang source, return a complete block:
.wirewire
schematic
title "..."
description "..."
component ...
net ...
connect ...After the block, include a short note only for important assumptions, such as
component choices or unsupported requested behavior.
When the user asks for an image or SVG artifact, include the
command to produce it. If you ran the command successfully, include the output
path; otherwise, state that rendering has not been tool-verified.
wire render当被要求创建Wire Lang源码时,返回完整的代码块:
.wirewire
schematic
title "..."
description "..."
component ...
net ...
connect ...代码块之后,仅在存在重要假设时添加简短说明,例如组件选择或不支持的请求行为。
当用户要求提供图片或SVG文件时,需包含生成该文件的命令。若已成功运行命令,需注明输出路径;否则,说明渲染未经过工具验证。
wire renderCommon Corrections
常见修正
- "Draw a wire from X to Y" usually means create a statement or named
connect; do not encode visual paths.net - "Show this note in the diagram" means use , not
annotation.// - "Ground everything" still requires explicit net connections.
GND - "Make this vertical" is a render hint, not a component property.
- "Arduino board" is outside the MVP standard library; model it as a local module-style component if needed.
- "Chip with numbered pins" is the type:
IC. Connect pins by name.pins=[1:VCC@left, 2:GND@left, 3:OUT@right] - "Leave this pin unused / N.C." is a statement, not a floating net.
no-connect TERMINAL - "Mark the 3V3 rail" can use a ; it is a visual flag, not a hidden global net.
PowerFlag name=3V3 - Crossings without a junction are left simply overlapping by default; "draw a
hop where lines cross" is .
render crossings=hop
- “在X和Y之间画一根线”通常意味着创建语句或命名
connect;不要编码视觉路径。net - “在图表中显示此注释”意味着使用,而非
annotation。// - “将所有部件接地”仍需显式连接网络。
GND - “使其垂直”是渲染提示,而非组件属性。
- “Arduino开发板”不在MVP标准库中;必要时可将其建模为本地模块式组件。
- “带引脚编号的芯片”属于类型:
IC。通过引脚名称进行连接。pins=[1:VCC@left, 2:GND@left,3:OUT@right] - “此引脚留空/不连接”需使用语句,而非悬空网络。
no-connect TERMINAL - “标记3V3电源轨”可使用;这是一个视觉标记,而非隐式全局网络。
PowerFlag name=3V3 - 默认情况下,无交叉点的线路仅简单重叠;“在线路交叉处绘制跳点”需使用。
render crossings=hop
Keep This Skill Current
保持技能更新
When the Wire Lang syntax, examples, standard component library, or MVP authoring
rules change, update this skill and the focused reference files.
Before finishing an authoring response, check:
- The source starts with .
schematic - Component types and terminal names exist in the standard library or in a local component definition.
- Power nets are explicitly connected.
- Visible explanatory text uses , not
annotation.// - Render hints do not carry electrical meaning.
- Unsupported requests are called out with the closest valid MVP expression.
当Wire Lang的语法、示例、标准组件库或MVP创作规则发生变化时,需更新本技能及针对性参考文件。
完成创作响应前,请检查:
- 源码以开头。
schematic - 组件类型和端子名称存在于标准库或本地组件定义中。
- 电源网络已显式连接。
- 可见的解释性文本使用,而非
annotation。// - 渲染提示未承载电气含义。
- 已明确指出不支持的请求,并提供最接近的MVP有效表达。