jrjsmrtn/c4-skills/structurizr-dsl

Claude Code and agent skill by jrjsmrtn/c4-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Structurizr DSL syntax reference and patterns for writing C4 architecture models. Use when writing or editing workspace.dsl files, looking up DSL syntax, implementing specific patterns, or troubleshooting DSL errors.

Install

npx vskill@latest install jrjsmrtn/c4-skills/structurizr-dsl

SKILL.md

The same SKILL.md was published earlier as jrjsmrtn/c4-skills/structurizr-dsl.

Structurizr DSL

Comprehensive reference for the Structurizr DSL — the text-based language for defining C4 architecture models.

When to Use

  • Writing a new workspace.dsl from scratch
  • Adding elements, relationships, or views to an existing model
  • Looking up syntax for a specific DSL construct
  • Implementing patterns (deployment, groups, themes, expressions)
  • Troubleshooting parse errors or unexpected behavior

Syntax Fundamentals

  • Lines are processed sequentially — no forward references
  • Keywords are case-insensitive (softwareSystem = softwaresystem)
  • Double quotes are optional for single-word values without spaces
  • Opening { must be on the same line as the statement
  • Closing } must be on its own line
  • Comments: // or # (single-line), /* ... */ (multi-line)
  • Line continuation: \ at end of line
  • Identifier characters: a-zA-Z_0-9
Constants and Variables
dsl
!const SYSTEM_NAME "My System" # immutable
!var VERSION "1.0" # redefinable
# Reference: ${SYSTEM_NAME}, ${VERSION}

Workspace Structure

dsl
workspace [name] [description] {
!identifiers hierarchical # recommended for non-trivial models
!impliedRelationships true # default: auto-creates parent relationships
model {
# people, systems, relationships
}
views {
# diagram definitions, styles, themes
}
configuration {
# scope, visibility, users
}
}

Model Elements

Person
dsl
<id> = person <name> [description] [tags]
# or with block:
<id> = person <name> [description] [tags] {
description "..."
tags "Tag1" "Tag2"
url "https://..."
properties { key value }
-> <target> [description] [technology] [tags]
}

Default tags: Element, Person

Software System
dsl
<id> = softwareSystem <name> [description] [tags] {
!docs <path> # attach markdown documentation
!adrs <path> # attach ADRs
group <name> { ... }
<id> = container <name> [description] [technology] [tags] { ... }
-> <target> [description] [technology] [tags]
}

Default tags: Element, Software System

Container
dsl
<id> = container <name> [description] [technology] [tags] {
!docs <path>
!adrs <path>
group <name> { ... }
<id> = component <name> [description] [technology] [tags] { ... }
-> <target> [description] [technology] [tags]
}

Default tags: Element, Container

Component
dsl
<id> = component <name> [description] [technology] [tags] {
description "..."
technology "..."
tags "..."
-> <target> [description] [technology] [tags]
}

Default tags: Element, Component

Group
dsl
group <name> {
# elements of the same type
}

Style groups with the Group:Name tag. For nested groups:

dsl
model {
properties {
"structurizr.groupSeparator" "/"
}
group "Organization" {
group "Department" {
system = softwareSystem "System"
}
}
}

Relationships

dsl
# Explicit
<source> -> <destination> [description] [technology] [tags]
# Within element block (implicit source = this)
-> <destination> [description] [technology] [tags]
# With properties
<source> -> <destination> [description] [technology] [tags] {
tags "Async"
url "https://..."
properties { key value }
}
# Remove a relationship
<source> -/> <destination>

Default tags: Relationship

Uniqueness

Relationships between the same source and destination must have unique descriptions. This is the only way the DSL distinguishes multiple relationships between the same pair.

Identifiers

Flat (default)

All identifiers are globally scoped. Every identifier must be unique across the entire workspace.

Hierarchical (recommended)
dsl
!identifiers hierarchical

Identifiers are scoped to their parent. Reference as parent.child:

dsl
system = softwareSystem "System" {
api = container "API"
db = container "Database"
}
# Reference: system.api, system.db

Views

System Landscape
dsl
systemLandscape [key] [description] {
include *
autoLayout [tb|bt|lr|rl] [rankSep] [nodeSep]
title "Title"
description "..."
}
System Context
dsl
systemContext <systemId> [key] [description] {
include *
autoLayout
title "System Context for X"
}
Container View
dsl
container <systemId> [key] [description] {
include *
autoLayout
title "Containers for X"
}
Component View
dsl
component <containerId> [key] [description] {
include *
autoLayout
title "Components of X"
}
Dynamic View
dsl
dynamic <scope> [key] [description] {
# scope: * (people/systems), systemId (+ containers), containerId (+ components)
<source> -> <destination> [description] [technology]
<source> -> <destination> [description] [technology]
autoLayout
title "Feature Y Flow"
}

Interactions are automatically numbered in order. To set explicit ordering:

dsl
dynamic <scope> [key] [description] {
1: user -> system.api "submits order" "HTTPS"
2: system.api -> system.db "persists order" "SQL"
3: system.api -> system.queue "publishes event" "AMQP"
}
Deployment View
dsl
deployment <systemId|*> <environment> [key] [description] {
include *
autoLayout
title "Production Deployment"
}
Filtered View
dsl
filtered <baseViewKey> <include|exclude> <tags> [key] [description]

Creates a view on top of another, filtering elements by tags. The base view is hidden when a filtered view exists.

Image View
dsl
image <scope> [key] {
plantuml <file|url>
mermaid <file|url>
image <file|url>
title "Title"
}
AutoLayout
dsl
autoLayout [direction] [rankSeparation] [nodeSeparation]
# direction: tb (default), bt, lr, rl
# default separations: 300px each
Include/Exclude with Expressions
Element Expressions
dsl
include element.type==Container
include element.tag==Database
include element.tag!=External
include element.parent==<id>
include element.technology==PostgreSQL
include ->system.api-> # elements connected to system.api (both directions)
include ->system.api # elements that depend on system.api (afferent)
include system.api-> # elements system.api depends on (efferent)

Combine with && (AND) and || (OR):

dsl
include element.type==Container && element.tag!=External
Relationship Expressions
dsl
include * -> * # all relationships between included elements
include user -> * # all relationships from user
include * -> system.db # all relationships to database
include relationship.tag==Async
include relationship==system.api->system.db
Reluctant Wildcard
dsl
include *? # like * but excludes orphaned elements

Styles

Element Styles
dsl
styles {
element <tag> {
shape <shape> # see shapes below
icon <file|url>
width <int>
height <int>
background <#rrggbb>
color <#rrggbb> # text color (alias: colour)
stroke <#rrggbb> # border color
strokeWidth <1-10>
fontSize <int>
border <solid|dashed|dotted>
opacity <0-100>
metadata <true|false> # show/hide metadata line
description <true|false> # show/hide description
}
}

Shapes: Box, RoundedBox, Circle, Ellipse, Hexagon, Diamond, Cylinder, Pipe, Person, Robot, Folder, WebBrowser, Window, Terminal, MobileDevicePortrait, MobileDeviceLandscape, Component

Relationship Styles
dsl
styles {
relationship <tag> {
thickness <int>
color <#rrggbb>
style <solid|dashed|dotted>
routing <Direct|Orthogonal|Curved>
fontSize <int>
width <int>
position <0-100> # label position along line
opacity <0-100>
}
}
Styling All Elements/Relationships

Use the default tags:

dsl
styles {
element "Element" { ... } # applies to ALL elements
relationship "Relationship" { ... } # applies to ALL relationships
}
Light/Dark Mode
dsl
styles {
light {
element "Person" { background #08427B; color #ffffff }
}
dark {
element "Person" { background #1a6bc4; color #ffffff }
}
}
Standard Style Recipe
dsl
styles {
element "Person" {
shape Person
background #08427B
color #ffffff
}
element "Software System" {
background #1168BD
color #ffffff
}
element "External" {
background #999999
color #ffffff
}
element "Container" {
background #438DD5
color #ffffff
}
element "Component" {
background #85BBF0
color #000000
}
element "Database" {
shape Cylinder
}
element "Web" {
shape WebBrowser
}
element "Queue" {
shape Pipe
}
relationship "Relationship" {
routing Orthogonal
}
relationship "Async" {
style dashed
}
}

Themes

dsl
views {
theme default # Structurizr default theme
# or multiple:
themes default "https://..." "file.json"
}

Built-in cloud themes:

  • amazon-web-services-2020.04.30
  • microsoft-azure-2021.01.26
  • google-cloud-platform
  • kubernetes

Custom styles override theme defaults.

Directives

!include
dsl
!include <file> # inline a DSL fragment
!include <directory> # include all .dsl files in directory (alphabetically)
!include <url> # include from HTTPS URL

Content is literally inlined into the parent document. Relative paths resolve from the parent file's directory and must stay within the same directory or a subdirectory — ../ paths are not allowed.

Key behaviors:

  • Directory includes are recursive — subdirectories are processed too
  • Alphabetical ordering — files sorted with Arrays.sort, so use numeric prefixes for ordering control
  • Hidden files skipped — .DS_Store and dotfiles are ignored
  • No deduplication — the same file included from multiple places is inlined multiple times

Duplicate identifier restriction: if an included fragment defines an identifier that the including file also defines, Structurizr errors. There is no merge or override — plan fragment boundaries carefully.

!docs and !adrs
dsl
workspace "System" "Description" {
!adrs docs/adr # attach ADRs at workspace level
!docs docs/architecture # attach documentation at workspace level
}

Can also be scoped to a softwareSystem or container:

dsl
softwareSystem "System" {
!docs docs/system-docs
!adrs docs/adr
}

Path restriction: same as !include — paths must be within or below the DSL file's directory. Use a symlink (architecture/docs -> ../docs) if workspace.dsl is in a subdirectory.

!docs authoring conventions

Do not point `!docs` at Diátaxis directories (explanation/, howto/, etc.). Structurizr silently strips h1 headings — it auto-generates h1 from the element name. Diátaxis docs use h1 as their title, so those titles would vanish. Use a dedicated docs/architecture/ directory for Structurizr-specific documentation, separate from Diátaxis content.

Files in the !docs directory are imported alphabetically by filename — use numeric prefixes for ordering:

docs/architecture/
├── 01-context.md
├── 02-containers.md
├── 03-deployment.md
└── images/
└── overview.png

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/jrjsmrtn/c4-skills/structurizr-dsl/badge)](https://verified-skill.com/skills/jrjsmrtn/c4-skills/structurizr-dsl)

Something wrong with this skill or its page? Tell us.