From c4-architecture
Generates C4 models and Structurizr DSL workspaces from codebases for system context, container, component, and deployment diagrams; renders as images.
How this skill is triggered — by the user, by Claude, or both
Slash command
/c4-architecture:c4-architectureThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate C4 architecture models using the Structurizr DSL and optionally render them as images.
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 viewsnpx claudepluginhub bitsmuggler/c4-skillCreate C4 context, container, component, and code diagrams. Visualize architecture at different abstraction levels. Use when communicating system structure to diverse audiences.
Generates C4 model architecture diagrams and documentation using Mermaid syntax for system context, containers, components, and code levels.
Maps system architecture by reading codebase, identifying services and connections, and outputting C4-level Mermaid diagrams with descriptions. Use for architecture overviews or system diagrams.