Skip to content
Back to skills

Structurizr

ASecurity

Author, evolve, and validate C4 model architecture documentation as Structurizr DSL (workspace.dsl). Use this skill whenever the user mentions Structurizr, C4, architecture diagrams, system context / container / component diagrams, deployment or dynamic diagrams, system landscape, documenting how a system or its microservices are structured, or asks to create or edit a .dsl workspace — even if they never say the word "Structurizr". Also use it when linking existing ADRs (architecture decision...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 24, 2026
developmentrustjavanodeexpressdockerkubernetesawsapidatabasedocumentation

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add cassiobotaro/skills --skill structurizr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structurizr?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Structurizr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cassiobotaro-structurizr/badge)](https://www.skillsdirectory.com/skills/cassiobotaro-structurizr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: structurizr
license: MIT
description: >
  Author, evolve, and validate C4 model architecture documentation as Structurizr DSL
  (workspace.dsl). Use this skill whenever the user mentions Structurizr, C4, architecture
  diagrams, system context / container / component diagrams, deployment or dynamic diagrams,
  system landscape, documenting how a system or its microservices are structured, or asks to
  create or edit a .dsl workspace — even if they never say the word "Structurizr". Also use it
  when linking existing ADRs (architecture decision records, e.g. in doc/adr) into the
  architecture documentation or C4 views. Do NOT use it for cloud-infrastructure pictures
  drawn from real vendor service icons (e.g. an AWS diagram with EC2/RDS/S3 boxes), or for
  sequence or behavior-over-time diagrams (that belongs to a Mermaid sequence diagram).
---

# Structurizr / C4 architecture documentation

This skill produces or edits a `workspace.dsl` file (Structurizr DSL, the C4 model) at the
root of the user's repository, validates it, and links ADRs when the repository has them.

## Check the scope first

Three neighboring requests look like C4 work and are not; say so in a sentence and hand
them on instead of opening a `workspace.dsl`: a cloud-infrastructure picture drawn from
vendor service icons (C4 models the abstractions the team owns, not a vendor catalog in
its own iconography — that is a diagramming tool's job); a sequence or behavior-over-time
diagram (C4 views are static structure; ordered interaction is the `mermaid-sequence`
skill's shape); and writing the decision content of an ADR (the `adr` skill when it is installed, the team's
decision log tooling such as adr-tools otherwise — this skill only *links* the existing
log into the views, step 5).

## The contract

These rules exist because a workspace.dsl is *documentation other people will trust*. A
fabricated technology choice or an invented relationship is worse than a gap — the gap gets
asked about, the fabrication gets believed.

1. **Never invent architecture.** Do not assign technologies, create elements, or draw
   relationships the user (or the code you inspected) did not establish. When something is
   missing or ambiguous, ask. It is fine to choose cosmetic defaults yourself (colors, layout
   direction, view keys) — those carry no architectural claims.

2. **Classify before you model.** The most common C4 mistake is putting something at the
   wrong abstraction level (a system drawn as a container, a deployment concern drawn on a
   container view). When you are not sure whether something is a software system, a
   container, a component, or a deployment concept, read
   `references/c4-classification.md` — it has litmus tests and a ready-made question bank.
   Ask the user the 2–4 questions that actually decide the case (ownership, deploy unit,
   runs-or-stores) instead of guessing. Don't ask what you can verify yourself in the repo.

3. **Modern syntax only** (Structurizr DSL v6+). Never emit these removed or deprecated
   keywords:

   | Never write | Write instead |
   |---|---|
   | `enterprise { }` (removed) | `group "Name" { }` |
   | `!extend`, `!ref` (deprecated) | `!element` / `!relationship` (and `!elements` / `!relationships`) |
   | `branding { }` (removed in v6) | themes |
   | `dashed true` / `dashed false` in styles (removed) | `style solid`, `style dashed`, or `style dotted` |
   | `location` on person/system (removed) | `group` + tags |

   House style, not a language rule: write one `theme <name-or-url>` line per theme. The
   plural `themes a b` is still valid DSL — leave it alone when editing a file that uses it.

4. **Minimal diffs when editing.** Preserve existing identifiers, naming style, ordering,
   styles, and view keys; add what was asked and nothing else. Renaming elements or view keys
   silently destroys the diagram layout the user arranged in the UI (layout is stored in
   `workspace.json`, keyed to the model). A decision the user announces is not a request
   to redraw: when they say a technology will change and ask for something else, leave the
   model as it is and ask whether it should show the change now or once it happens.

5. **Never hand-edit `workspace.json`.** It is generated by Structurizr from `workspace.dsl`
   and additionally holds manual diagram layout. The DSL file is the only source you touch.

## Workflow

### 1. Discover the current state

- Look for `workspace.dsl` at the repo root (the expected location); also glob `**/*.dsl`
  in case the project keeps it elsewhere — if so, edit it where it lives.
- Look for ADR directories: `docs/adr`, `docs/adrs`, `docs/decisions`, `adr/`,
  `docs/architecture/decisions`. Peek at one file to identify the format (see step 5).
- Skim the repo (compose files, deploy manifests, service directories, READMEs) to ground
  your understanding — but remember rule 1: code tells you what exists, the user tells you
  what it means.

### 2. Understand and classify the system

Build a mental model: who uses it (people), what the system(s) are, what runs inside them
(containers), what is external. Apply the litmus tests from
`references/c4-classification.md`. The recurring traps, condensed:

- **Container** = something that must be *running* for the system to work, or a *data
  store* — an API, SPA, mobile app, worker, cron job, serverless function, database,
  queue, blob store. NOT a Docker container per se, NOT a library/JAR/module.
- **Software system vs container** for a service is decided by *ownership*: one team owns
  it and sees its internals → container(s) inside that team's system; another team owns it
  or it's third-party SaaS → separate (external) software system.
- **Microservices** owned by one team: each service = a `group` of containers (typically
  API + database schema). Owned by different teams: promote each to a software system.
- **Queues/topics** are containers (the queues themselves, not the broker) — or just a
  "via" label on the relationship when that detail isn't worth a box.
- **API gateways, load balancers, firewalls** are deployment concepts: model them as
  `infrastructureNode` in a deployment environment, never as containers on a container view.
  Same for runtimes — Docker, Kubernetes, Fargate, Lambda's service — they nest as
  deployment nodes; only the code running on them is a container.
- **Hardware and devices** (cameras, robots, PLCs, sensors) the software talks to are
  neither software systems nor people: a custom `element` archetype
  (`modeling-patterns.md` §5). Don't let "it's a closed box" turn a camera into a
  `softwareSystem`.

If after this any element is still ambiguous, stop and ask. Present your proposed
classification of the *clear* parts so the user only has to resolve the open points.

### 3. Choose the views

Read `references/diagrams.md` when in doubt. Defaults that follow C4's own recommendations:

- **System context + container views: always** (for a system-scoped workspace).
- **System landscape**: when the user describes multiple systems of an organization.
  Use a landscape-scoped workspace (no containers) — see step 4.
- **Deployment views**: one per environment, when the user describes infrastructure.
- **Dynamic views**: sparingly — only for flows the user asked for or that are genuinely
  non-obvious. Every step must be backed by a relationship that exists in the model.
- **Component views**: only on request or clear value; **code-level**: effectively never
  (IDEs generate it on demand).

Create only what was asked for plus the always-recommended pair. More diagrams ≠ better
documentation; each one is a maintenance liability.

### 4. Write the DSL

Always read `references/dsl-reference.md` (core syntax) before writing DSL. Then read
ONLY the pattern file the task actually needs — every file you read costs tokens on every
invocation, and most tasks need none of them:

- Deployment environments, gateways/load balancers, Docker/K8s/EKS/Fargate/App Runner,
  serverless functions, multi-environment → `references/deployment-patterns.md`
- Microservices, queues/topics, landscape/multiple systems, hardware/devices, splitting
  the model across files → `references/modeling-patterns.md`
- Archetypes, workspace extension (`!element`), filtered/custom/image views,
  perspectives, scripts/plugins, or an include/exclude expression or style property
  beyond the condensed set in `dsl-reference.md` → `references/dsl-advanced.md`

House conventions, in one breath: `!identifiers hierarchical`; every element gets a
description and every container a technology; relationship labels are specific and
directional ("Publishes click events to", never "Uses") and inter-process ones carry a
protocol; encode kinds with tags plus `styles` (`Database` → cylinder, `Queue` → pipe,
`External` → grey) instead of ad-hoc colors; stable descriptive view keys
(`"SystemContext"`, `"Containers"`, `"Deployment-Live"`) because renaming a key orphans
saved layout; `autoLayout` on every view; `configuration { scope softwaresystem }` for a
single-system workspace, `scope landscape` for a landscape one. Element names and
descriptions follow the language the user used; DSL keywords are always English.

`references/dsl-reference.md` §15 carries the full skeleton to copy when you start a
workspace from scratch.

### 5. Link ADRs

If the repo has ADRs (step 1), attach them with `!adrs` at the right scope — workspace
level for the repository's decision log, also when the workspace models a single system;
inside a `softwareSystem`/`container` block only when that element keeps a log of its
own, apart from the repository's. Detect the format:

- Files like `0001-record-architecture-decisions.md`, sections `## Status` / `## Context` /
  `## Decision` / `## Consequences` → adr-tools format (the default):
  `!adrs docs/adr`
- MADR layout (`docs/decisions/`, frontmatter with `status:`/`date:`, "Context and Problem
  Statement") → `!adrs docs/decisions madr`
- log4brains → `!adrs <path> log4brains`

The path is relative to the DSL file. Every Markdown file in it is imported, so when the
folder also holds a `README.md`, an index, or a template (`nnnn-template.md`, `0000-*`),
use the block form and exclude them: `!adrs docs/adr { exclude "README.md" "nnnn-.*" }`.
Don't create ADRs the user didn't ask for; if there are none, simply don't emit `!adrs`.

### 6. Validate — always, before declaring done

The validator is the `structurizr/structurizr` Docker image — the same one that serves
the preview UI in step 8 and the exports in `references/export.md`. Nothing else is needed: no MCP server, no local
Java install. Run it from the directory that holds the DSL file:

```
docker run --rm -u $(id -u):$(id -g) \
    -v "$PWD":/usr/local/structurizr \
    -e STRUCTURIZR_THEMES=/usr/local/structurizr-themes \
    structurizr/structurizr validate -workspace workspace.dsl
```

(`-u` keeps any file the container writes owned by the user instead of root; the
`STRUCTURIZR_THEMES` variable lets bundled theme names like `amazon-web-services-2025.07`
resolve offline.) Fix every reported error and re-run until it exits clean. If the DSL
lives somewhere other than the repo root, mount that directory instead.

Once it parses, run the same command with `inspect` in place of `validate`: it applies
the built-in model rules (missing descriptions, elements on no view, disconnected
elements, no workspace scope) and prints one line per finding. Treat those findings as
input to the self-review below — fix what the user's material supports, and report the
rest rather than inventing descriptions to silence them. A finding never moves what an
earlier step placed: with `!adrs` at workspace scope, `inspect` still reports the software
system as missing decisions, and the directive stays where step 5 put it.

If Docker is not available in this session (the binary is missing, the daemon isn't
running, or the image can't be pulled), don't try to install it or find another route.
Deliver the file anyway and say plainly, in the final response, that the DSL was **not
validated** in this environment — then hand the user the `validate` command above so
they can run it themselves. Never imply the file was validated when it wasn't, and never
report validation output you didn't get.

Common parse errors: referencing an element before it is defined (the DSL has no forward
references — define first, or use `this` inside the element's own block), an opening `{`
not on the same line as its statement, a flat-identifier name collision (use
`!identifiers hierarchical`), dynamic-view steps whose relationship doesn't exist in
the model, and — the classic deployment-model error — referencing an element nested in
deployment nodes by a partial path: with hierarchical identifiers you must bind an
identifier to every ancestor `deploymentNode` and use the full dotted path
(`aws.region.alb`, never bare `alb`).

### 7. Self-review

Check the DSL against this list and fix what fails — the diagrams must read for someone
who wasn't in the room:

- every element has a description; every container a technology;
- every relationship label is specific and reads correctly along the arrow; inter-process
  ones carry a protocol;
- kinds are encoded with tags + `styles`, so the rendered legend covers them and no
  meaning lives in color alone;
- view keys are stable and descriptive; `configuration { scope … }` matches the workspace
  type; every dynamic-view step is backed by a model relationship;
- no removed or deprecated keyword (contract 3); `!adrs` present when the repo has ADRs;
- acronyms in names and descriptions are ones the audience knows.

### 8. Hand off

Tell the user how to see the result. The image is `structurizr/structurizr` (current,
consolidated) — never suggest `structurizr/lite`, it is deprecated.

The preview UI at `http://localhost:8080` live-reloads on DSL changes and saves manual
layout into `workspace.json`:

```
docker run --rm -it -p 8080:8080 -u $(id -u):$(id -g) \
    -v "$PWD":/usr/local/structurizr \
    -e STRUCTURIZR_AUTOREFRESHINTERVAL=2000 \
    -e STRUCTURIZR_AUTOSAVEINTERVAL=5000 \
    -e STRUCTURIZR_THEMES=/usr/local/structurizr-themes \
    structurizr/structurizr local
```

(the two interval variables make the UI pick up DSL edits every 2 s and persist manual
layout every 5 s, so the user doesn't lose an arrangement between edits)

When the user asks for exported diagrams (PlantUML, Mermaid, JSON, a static site, PNG,
SVG), or another skill needs a rendered image, read `references/export.md` for the
commands. Don't write them from memory: PNG and SVG need a different variant of the image.

If the user has their own wrappers/aliases around these images, respect those instead.

## Reference files

Read only what the task needs — each file read is a per-invocation token cost.

| File | Read it when |
|---|---|
| `references/dsl-reference.md` | Always, before writing any DSL — core signatures for elements, relationships, views, styles, deployment, `!adrs`, themes, configuration. |
| `references/c4-classification.md` | Anything is ambiguous: system vs container, microservices ownership, queues, serverless, shared libs. Includes the clarifying-question bank. |
| `references/diagrams.md` | Choosing which diagrams to create, when step 3 leaves doubt: the seven view types, when each earns its place, and C4's notation rules. |
| `references/deployment-patterns.md` | Deployment work: `-/>` rerouting, Docker/K8s/EKS/Fargate/App Runner nesting, serverless (Lambda + local emulator), multi-environment, deployment groups. |
| `references/modeling-patterns.md` | Microservices, messaging, landscape/system catalog, hardware/devices as custom elements, monorepo composition. |
| `references/export.md` | The user asks for exported diagrams (PlantUML, Mermaid, JSON, static site, PNG, SVG), or another skill needs a rendered image. |
| `references/dsl-advanced.md` | Rare: archetypes, workspace extension, filtered/custom/image views, perspectives, scripts/plugins; plus the full include/exclude expression grammar and style property list. |

## Attribution

The C4 guidance in this skill is derived from the C4 model by Simon Brown
([c4model.com](https://c4model.com), licensed
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)) and from the Structurizr
documentation ([docs.structurizr.com](https://docs.structurizr.com), MIT License), both
condensed and adapted. Structurizr tooling (DSL, CLI) is Apache-2.0. See `NOTICE.md`.

Files in this skill

  • NOTICE.md1.4 KB
  • SKILL.md15.7 KB
  • references/c4-classification.md8.3 KB
  • references/deployment-patterns.md8.9 KB
  • references/diagrams.md5.3 KB
  • references/dsl-advanced.md8.8 KB
  • references/dsl-reference.md16 KB
  • references/export.md2 KB
  • references/modeling-patterns.md4.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.