System diagram — drawing how a system is built
The person looking at the diagram may not be a programmer: a manager, an accountant, an employee. So every word in the diagram is in plain business language.
Language
Write all text in the diagram in the language the user writes in; if it is unclear, use English. Keep the whole diagram in that one language and one script, do not mix scripts within one output. Product and program names (Telegram, Postgres, Excel) stay as they are, but get a plain meaning next to them ("Front door — Caddy").
The fixed words of the page (buttons, legend, footer) are in English by default. For any other language, add a "lang" code and a "labels" object with the translations to the JSON (see below) — otherwise an Uzbek or Spanish diagram would have English buttons.
Workflow
1. Take the facts from the source
If the diagram is about the user's own system, do not guess: read the project's README.md, its code and scripts. Limits, times and conditions (for example "stops above 20%") come from the code. Do not put what you do not know into the diagram — say in the reply "I could not check this".
2. Answer one question
A diagram answers one question: "how are the sites built?", "how does data reach the accounting program?", "where does a customer order go?". Two questions — two diagrams. Usually 6–14 boxes are enough; if there are more, group and merge them and write on a card which ones were merged.
3. Write the data file (JSON)
If the user does not name a place: the data file goes to diagrams/source/<name>.json, the finished diagram to diagrams/<Name>.html (relative to the current folder). The example is examples/shop-order.json — take its structure from there, not its facts.
{
"title": "Short name: what it shows",
"summary": "The main conclusion in one sentence",
"date": "DD.MM.YYYY",
"file": "png-name",
"signature": "optional: company or project name (footer and PNG)",
"nodes": [{"id": "latin_id", "name": "Short name", "short": "2–4 words", "type": "site", "col": 0, "row": 0,
"badge": "optional tag", "details": ["lines shown when the box is clicked"]}],
"groups": [{"name": "Our server", "members": ["id1", "id2"]}],
"links": [{"from": "id1", "to": "id2", "label": "1–3 words", "type": "main"}],
"steps": [{"text": "What happens — one sentence", "nodes": ["id1", "id2"]}],
"cards": [{"title": "…", "color": "blue", "lines": ["…"]}]
}
- Box types (
type):person(employee, customer, manager),site(website, app),server(program, robot, bot),data(database, Excel, file),guard(check, permission, gate),decision(yes/no choice),external(bank, Telegram, accounting software — a system that is not ours),message(report, notification). - Line types:
main— the main path (red, animated; have only one main path);normal— ordinary (the default when no type is given);error— error, rejection or stop path;later— scheduled or later work (every night, a queue). - Card colours:
red,purple,green,yellow,blue,gray. - Placement is a grid:
col(left to right, from 0) androw(top to bottom). The reading direction is left to right: the start on the left, the result on the right. One box per cell.- Keep the main path in one row or as a staircase.
- Put a database or a side item in the column next to, or under, the box it connects to — the line stays straight.
- If there is another box between two boxes in one column, the line cuts through it — move the box to another column.
- Put error paths on a separate lower row.
- A line usually finds its own route. Only when needed (for example, to route a return line around the bottom) give
"fromSide"and"toSide"— both together, eachright,left,toporbottom. - The gap between columns is 80 px by default and between rows 74 px; it widens by itself to fit the labels. If it is too tight or too loose, set
"gapX"/"gapY"(px) at the top level. - A line label is 1–3 words; a longer explanation goes into the box's
detailsor onto a card. A box'sshortnote must not exceed 2 lines, and itsnamemust fit the box (about 25 characters) — words in some languages are long, so shorten them. steps— for the "Step by step" button: 3–6 steps, one sentence each. A process diagram must have them.- Cards (2–4): important conditions, limits, "what is not touched", parts not shown, that did not fit into the diagram.
signatureis optional: without it the footer says "Internal document" (or itslabelstranslation), and the PNG shows only the date.
Another language. Add "lang" (for example "uz", "es") and "labels" with any of these keys translated (missing keys stay in English, an unknown key is reported as a warning):
"lang": "uz",
"labels": {
"kicker": "System diagram", "signature": "Internal document",
"steps": "▶ Step by step", "motionOff": "Stop motion", "motionOn": "Start motion",
"smaller": "Zoom out", "bigger": "Zoom in", "fit": "Fit", "image": "Save image", "dark": "Dark", "light": "Light",
"prev": "← Previous", "next": "Next →", "close": "Close",
"hint": "Click a box to see details about it. Drag the diagram with the mouse to move it.",
"incoming": "Comes in", "outgoing": "Goes out",
"person": "Person", "site": "Website / app", "server": "Program / server", "data": "Data / file",
"guard": "Guard / check", "decision": "Decision", "external": "External system", "message": "Message / report",
"main": "Main path", "normal": "Normal link", "error": "Error / stop path", "later": "Later or queued work"
}
(The values above are the English defaults — write the translations in their place.)
4. Build and check
The script is in this skill folder's scripts/:
python "<skill folder>/scripts/build.py" "<source.json>" "<Result.html>" --images
Requires: Python 3.10+, the playwright package and Google Chrome (without Chrome, once: python -m playwright install chromium). The script puts the data into the template, opens it in a browser and checks: id and type errors, wrong columns/rows, unknown label keys, a line crossing a box, lines on top of each other or crossing, a label under a line, overlapping labels, a name too long for its box, a foreign box falling inside a group, page errors, sideways scrolling on a computer (1440 px) and on a phone (390 px). If there are warnings (exit code 2), fix the layout and build again. Then open the saved image with Read and look at it (the script prints the folder: system-diagram-check/<Result>-light.png in the temporary folder): are the lines tangled, is the text readable? If needed, look at -dark.png and -phone.png too. These images stay in the temporary folder, not in the diagram folder.
Do not change the template (assets/template.html) for each diagram — only the JSON is written. If you find a bug in the template itself, fix it and rebuild the example to check.
5. Reply
Short, in the user's language:
- the link to the diagram (full path) and one sentence — the main conclusion;
- what is not shown or was merged, and what you could not check;
- open the diagram: on Windows
Start-Process "<Result.html>", on macOSopen, on Linuxxdg-open.
Privacy
The diagram may be sent to a manager or a group, so it must not contain: passwords, keys, tokens, server IP addresses (they sometimes hide inside a site address — do not write site addresses), internal folder paths on the server, the hosting provider's name, internet addresses of external systems, port numbers, customers' phone numbers. Use plain names instead: "our server", "accounting software (in the cloud)". If the inner structure of a table or database is needed, warn in the reply: "do not post this in an open group".
What the diagram can do (to tell the user)
Click a box to see details on the right, plus where it gets input from and where it sends output. "Step by step" lights up the process stage by stage. There is zoom, dragging with the mouse, PNG export, a light/dark theme and printing. The file opens without internet and has no external libraries.