draw-schemdraw-circuit
Installation
SKILL.md
Draw a Schemdraw Circuit
Create both a maintainable Python source file and a rendered circuit image. Interpret the user's prose yourself; do not build a generic natural-language parser.
Workflow
- Consolidate the user's initial request and all later revisions into one current canonical prompt. Include every active requirement and remove superseded wording.
- Parse that canonical prompt into a circuit specification: components and unique reference designators, values, named nets, source polarity/type, junctions, crossings, inputs, outputs, grounds, and explicit or implied topology.
- Resolve only harmless presentation details yourself. If an electrical ambiguity materially changes topology, state the assumption in the Python docstring; ask only when no defensible interpretation exists.
- Read references/schemdraw-patterns.md for the required program contract, layout rules, and topology patterns.
- Check the installed API before guessing an unfamiliar element: use Python introspection or the official Schemdraw docs. Never silently substitute an electrically different symbol.
- Write a custom, high-quality Python program next to the requested output. Put the canonical prompt in the required top module docstring. Give components meaningful variable names and comments describing circuit sections. Keep topology visible in the program.
- Whenever the user changes the circuit or its presentation, update the
Prompt:block before changing code or rerendering. Never preserve a stale original prompt as provenance; it must describe the latest intended result. - Compile and execute the program. Render the requested image, defaulting to SVG. Also render a PNG preview from the same program for visual inspection when the primary output is SVG.
- Run
scripts/validate_diagram.py --source circuit_name.pyon every rendered file. Treat warnings as prompts for inspection, not automatic success. - Inspect the PNG with the local image-viewing tool. Compare the image against the canonical prompt and the verification checklist below. Revise and rerender until it passes.
- When a textbook chapter is in scope, place the verified image into the correct chapter section using the chapter integration rules below.
- Return links to the final image and Python source. Briefly disclose any topology assumptions and identify the chapter placement when applicable.