SkilVaultSign inStart free

Catalogue / squinch

squinch

Apache-2.0SignedAuthor architecture diagrams as code with the Squinch DSL. Use this whenever the user wants an architecture or system diagram — creating one from prose, editing or reviewing a .squinch file, drawing cloud infrastructure (AWS, Azure, Kubernetes, hybrid estates), documenting services for a README or a…
---
name: squinch
description: Author architecture diagrams as code with the Squinch DSL. Use this whenever the user wants an architecture or system diagram — creating one from prose, editing or reviewing a .squinch file, drawing cloud infrastructure (AWS, Azure, Kubernetes, hybrid estates), documenting services for a README or a design review, or any picture of systems, services and the connections between them — even when they never say "squinch". Write the .squinch model, validate it with `squinch check`, render it with `squinch render` (SVG in both themes plus the interactive HTML by default; PNG only when asked), and fix what you see with the layout cookbook.
compatibility: Requires Node.js 22+ and the squinch CLI on PATH, or npx squinch with no install
---

Squinch — architecture diagrams as code

Squinch renders .squinch files into deterministic SVG diagrams. You write the *model* (systems, components, connections); the engine lays it out. When the auto-layout isn't what you want, you steer it with relative hints — there are no pixel coordinates anywhere in the language.

The loop

Work like a compiler user, not an artist:

squinch check diagram.squinch --format json   # parse + lint; machine-readable
squinch render diagram.squinch -o out.svg     # deterministic SVG; theme: the view's, else dark
squinch render diagram.squinch --view NAME --theme light -o out.svg   # themes: light | dark
squinch render diagram.squinch --sync         # every view × both themes, next to the source
squinch render diagram.squinch -o out.html    # one interactive file: every view, both themes
squinch render diagram.squinch -o out.png --scale 2   # PNG, only when asked (--width also works)
squinch icons search "<term>, <term>, …"      # find icon ids — batch every unknown in one call
squinch diff --format json                    # what changed in the architecture

If squinch is not on PATH, prefix every command with npx — npx squinch check … — or install it once with npm i -g squinch.

What to hand over

Unless the user names a format or a theme, a finished diagram is all of:

squinch render diagrams/ --sync              # <name>.<view>.light.svg + .dark.svg per view
squinch render diagrams/ -o diagram.html     # every view, both palettes, click-to-zoom, presentation mode
  • Both themes, always. Dark is designed, not inverted, and the reader's

environment picks — never choose one for them. For a README or a docs site that should follow the reader's colour scheme, --adaptive -o x.svg folds the pair into one SVG behind prefers-color-scheme.

  • The HTML is the thing to open. It is one self-contained file with every

view and a theme switch, and it needs no server — point the user at it first. A project with several views is unreadable as a pile of SVGs.

  • PNG is the exception, not the default: render one only when the user

asks for an image, slides, or a surface that cannot show SVG. A PNG you render to check your own work is a different thing (quality bar 3) and stays out of the hand-over.

  • Every render carries the tool version that drew it (data-squinch on the

root <svg>), and render --check re-renders and compares, so committed SVGs can gate CI. For a throwaway diagram that lives nowhere, two explicit --theme renders plus the HTML are the lighter recipe.

  • Write the files; leave committing to the user. Don't commit, push or

make a branch unless they ask — they will want to look first.

Then end your reply with three to five bullets, one or two plain sentences each, the way you would say it to a colleague — and nothing before them that says the same thing:

  • Open diagram.html — it has the landscape and orders views, light and dark.
  • I guessed that the services run on Lambda and that Postgres means RDS; the

request named neither.

  • I looked at both views. The one rough spot is the Kafka wire running round

the right edge; moving it made the services row harder to read, so I left it.

  • If this is more than you need, I can take out the load generator and the

tracing collector, or show less detail by grouping the services into three areas.

The first three are never skipped: where to open it; what you guessed — every product, cloud or runtime the request did not name — or "Nothing guessed" when that is true; and what you saw when you looked, or that you could not look. The last — an offer to cut it down, naming your own most peripheral boxes, not a category — ends every hand-over of an open-ended request or a big system, and is left off a small diagram that drew what was asked. One more bullet may say how you grouped a big system, or a warning you kept. Don't describe the components or the layout: the diagram shows them.

  1. If the system is big — a whole repo, a platform — decide its *areas* before

you write a node, because no layout hint rescues everything on one page: see "When the system is big".

  1. Write the model first, with no `layout` block at all — most diagrams

never need one. Your edges already say what the tiers are, and the engine ranks from them: a node sits below everything that points at it. Render it and look. Add hints only to fix something you can see is wrong, one at a time, naming only the nodes you actually care about. Icon ids outside the AWS basics — anything azure/, gcp/, k8s/, logos/ or sys/ — are looked up before the first check, never written from memory: open references/icons.md, which lists them per pack, or run squinch icons search with every unknown in one call. An id guessed from the word you would say — a sys/ or azure/ name that reads right and does not exist — is the most common way a first check fails.

  1. check after every edit. Diagnostics tell you the location, the problem, and

usually the fix (did you mean ...?). Trust them. When one is not self-explanatory, open references/cookbook.md — symptom → fix, keyed on the diagnostic's own words.

  1. Exit code 0 and no diagnostics at all = clean. Errors block the render;

warnings do not, which is exactly why they matter — a warning means the file is valid but probably not the diagram you were asked for. Fix warnings before you stop.

  1. A stderr line starting update: (a newer squinch is on npm) or skill:

(this SKILL.md was installed by a different squinch) — or the update / skill fields in check --format json — is information, not a diagnostic: exit 0 with no diagnostics is still clean. Mention it to the user once and carry on. Never upgrade squinch or re-run squinch skill unasked: an upgrade can change render bytes, and that is the user's call.

Quality bar before you call it done

  1. squinch check exits 0 with no diagnostics.
  2. Every view you declared is rendered in both --theme light and

--theme dark, plus the interactive .html — and all of it is handed over, not just checked (see "What to hand over").

  1. Look at the picture, not the markup. SVG source cannot show you a

detour. Rasterise each view beside the source and open the image — squinch render diagram.squinch --view NAME -o NAME.check.png — then delete the .check.png files when you are done. Keep them inside your working directory: a path like /tmp is often one you may not read. One theme is enough, both share one layout. Tiers read top-to-bottom (or left-to-right), no edge takes a baffling detour, async flows (~>) are dashed, related things sit together. If you could not view the image, say so in the hand-over and make no claim about how the layout looks.

  1. Labels are short noun phrases. A subtitle: of a few words says what a

leaf runs on or who owns it; anything longer goes in description, never the label.

  1. Model semantics honestly: request/response is ->; anything that queues,

buffers or fans out is ~>. If the prose says stream, queue, topic, event, publishes, emits, feeds, notifies or subscribes — Kinesis, Kafka, SQS, SNS, EventBridge, Service Bus — that edge is ~>, and a pipeline drawn entirely with -> is almost always wrong.

  1. Every actor the prose names is in the diagram. People are easy to drop:

"customers browse", "developers push", "an analyst queries" each name a person, and a stack diagram that draws only the technology has left out who uses it. Re-read the request and check each noun appears — a human is a person, not a box and not omitted.

  1. Nothing is in the diagram that the request does not support. A reader

takes every box as a fact, so a CDN, WAF, cache or queue that nothing in the request implies is a guess presented as truth — leave it out. The same goes for glue: an API or worker you put between two things the request names, and a product you picked where it named only a kind ("Postgres" is not "RDS"). A link: is the same: use a URL the request or the code gives you, never one you composed. When the picture cannot be drawn without filling a gap, draw the plainest reading and say what you guessed in the hand-over.

Language

// comments are // only (# belongs to tags)
pack aws                              // icon packs this file draws from (aws |
pack azure                            //  azure | gcp | logos | k8s). Optional — any
                                      //  installed pack resolves without it — but
                                      //  declaring documents intent and catches a
                                      //  misspelled pack name at check time.

person customer "Customer"            // human actor. This form is top-level
                                      // only — inside a system write it as
                                      // `who = person "Operator"`. Either
                                      // takes a block: `{ description: "…" }`
gw = aws/api-gateway "Edge Gateway"   // components may sit at the top level too —
                                      // that's how things stay individually
                                      // visible at landscape altitude (see
                                      // "Grouping vs. nesting" under Views)

system shop "Order Service" {         // systems/containers nest arbitrarily
  description: "Checkout and orders"  // optional; shows on the collapsed card
  icon: aws/api-gateway               // the card's own mark; without it the
                                      // first child's icon stands in
  glyph: sys/code                     // kind mark, in a chip at the card's
                                      // top right; a bad ref is a check error
  domain: "orders"                    // optional owner/team tag on the card's
                                      // shelf, beside the child icons
  tags: #core                         // tags inherit to everything inside

  api    = aws/api-gateway "API Gateway"        // id = pack/icon "Label"
  create = aws/lambda      "Create Handler" {
    description: "Validates and persists"
    subtitle: "Lambda · Node 20"      // a few words under the label, always
                                      // drawn: runtime, owner, region
    link: "https://runbooks.acme.dev/create"  // makes the title a hyperlink, in
                                      // quotes, http(s) only, leaves only: a
                                      // card's click zooms. Only a URL you were
                                      // given (quality bar 7)
    tags: #pci
  }
  db     = aws/dynamodb    "Orders Table" datastore #pci
  // a tag can sit in kind position like that, or in the block — same thing:
  idx    = aws/opensearch  "Search Index" datastore {
    tags: #pci                        // kind and attr block go in either order
  }
  wh     = sys/database    "SQL Warehouse" datastore {

Preview shortened. The full SKILL.md is in the pack.