From c4-architecture
Generates C4 models and Structurizr DSL workspaces from codebases for system context, container, component, and deployment diagrams; renders as images.
npx claudepluginhub bitsmuggler/c4-skillThis skill uses the workspace's default tool permissions.
Generate C4 architecture models using the Structurizr DSL and optionally render them as images.
Generates C4 model Mermaid diagrams for architecture documentation at context, container, component, deployment, and dynamic levels from codebase analysis.
Generates C4 model architecture diagrams and documentation using Mermaid syntax for system context, containers, components, and code levels.
Interactively co-builds C4 model architecture diagrams (Context, Container, Component, Code) via dialogue. Supports greenfield design, retro-documenting code/prose, review, and updates. Outputs Mermaid C4 + Markdown by default.
Share bugs, ideas, or general feedback.
Generate C4 architecture models using the Structurizr DSL and optionally render them as images.
Analyse the codebase to identify architectural elements:
Configuration & Build Files
package.json, pom.xml, build.gradle, go.mod, Cargo.toml, requirements.txtdocker-compose.yml, Dockerfile, kubernetes/*.yml.env, configuration files, infrastructure-as-codeIdentify Elements
Map Relationships
Write a workspace.dsl file following the Structurizr DSL syntax.
For the full DSL language reference, read: references/structurizr-dsl-reference.md
For a working example, read: examples/example-workspace.dsl
Structure the workspace as follows:
workspace "[System Name]" "[Brief description]" {
model {
// 1. Define people (actors)
// 2. Define software systems
// - Nest containers inside the primary system
// - Nest components inside containers (if needed)
// 3. Define relationships between elements
}
views {
// 4. Create views at each required C4 level
// 5. Apply styling via themes or element/relationship styles
}
}
Naming Conventions:
webApp, apiGateway, userDb"Web Application", "API Gateway""Spring Boot REST API", "PostgreSQL 15"Relationship Guidelines:
user -> webApp "Browses products using" "HTTPS""REST/JSON", "JDBC", "AMQP"Generate appropriate views based on the level of detail needed:
systemLandscape)systemContext)container)component)deployment)Always use autoLayout unless the user provides explicit layout preferences.
Use tags and styles to make diagrams readable:
styles {
element "Person" {
shape Person
background #08427B
color #ffffff
}
element "Software System" {
background #1168BD
color #ffffff
}
element "Container" {
background #438DD5
color #ffffff
}
element "Component" {
background #85BBF0
color #000000
}
element "Database" {
shape Cylinder
}
element "External" {
background #999999
color #ffffff
}
}
All export and rendering is done via Docker. Requires Docker to be installed and running.
Export DSL to C4-PlantUML:
mkdir -p ./diagrams
docker run --rm -v $PWD:/usr/local/structurizr structurizr/structurizr \
export -workspace /usr/local/structurizr/workspace.dsl -format plantuml/c4plantuml -output /usr/local/structurizr/diagrams
Render PlantUML to PNG:
docker run --rm -v $PWD/diagrams:/data plantuml/plantuml -tpng /data/*.puml
Render PlantUML to SVG:
docker run --rm -v $PWD/diagrams:/data plantuml/plantuml -tsvg /data/*.puml
Other supported export formats: plantuml, mermaid, json.
Prerequisite: Docker (docker pull structurizr/structurizr && docker pull plantuml/plantuml)
Before presenting the workspace to the user, verify:
autoLayout is applied to all views