jrjsmrtn/c4-skills/c4-model

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.

Create and evolve C4 architecture models with proper abstractions, diagram types, and notation. Use when adding elements to a C4 model, choosing diagram types, modeling relationships, or making architecture modeling decisions.

Install

npx vskill@latest install jrjsmrtn/c4-skills/c4-model

SKILL.md

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

C4 Model

Create and evolve C4 architecture models with correct abstractions, diagram types, and notation.

When to Use

  • Adding new elements (people, systems, containers, components) to a C4 model
  • Deciding which diagram type to create for a given audience or purpose
  • Modeling relationships between elements
  • Evolving an existing model as the system grows
  • Choosing the right level of abstraction for a diagram

Required Inputs

  • An existing C4 model (a Structurizr workspace.dsl, conventionally under architecture/), or the intent to start one.
  • The system or scope being modeled and its intended audience (business, technical staff, or developers) — this drives diagram-type selection.

C4 Abstractions

The C4 model defines four levels of abstraction. Each has a precise meaning — do not conflate them.

Level 1: Software System
  • The highest level. Delivers value to its users (human or not).
  • Typically owned by a single team, deployed together, lives in one repo.
  • Is NOT: a product domain, bounded context, business capability, or team structure.
Level 2: Container
  • A separately running process or data store required for the system to work.
  • A runtime boundary — not a code-organization unit.
  • Examples: server-side web app, SPA (client-side), mobile app, database, message queue, serverless function, shell script, file/blob storage.
  • NOT containers: JARs, DLLs, assemblies, libraries, modules — these are code-level constructs.
  • NOT Docker containers — the name is coincidental.
  • A single-page app is TWO containers: the server delivering the static files, and the client-side app running in the browser.
  • Cloud services you own (S3 buckets, RDS instances) are containers, not external systems.
Level 3: Component
  • A grouping of related functionality behind a well-defined interface, within a single container.
  • All components share the same process space — they are NOT separately deployable.
  • Language-dependent: classes (OOP), modules (JS/Elixir), grouped functions (FP), files in a directory (C).
  • NOT the same as packages, namespaces, or folder structures.
  • Focus on architecturally significant groupings. Exclude utility classes and data models initially.
Level 4: Code
  • Classes, interfaces, functions, database tables.
  • Almost always generated from code, never maintained manually.

Diagram Types

Core Diagrams (the "4 Cs")
DiagramScopeShowsAudienceRecommended?
System ContextOne software systemSystem + users + external systemsEveryoneYes, always
ContainerOne software systemContainers inside the systemTechnical staffYes, always
ComponentOne containerComponents inside the containerDevelopersOnly if valuable
CodeOne componentClasses/modules/tablesDevelopersNo, generate if needed
Supporting Diagrams
DiagramScopeShowsWhen to Use
System LandscapeEnterprise/orgAll systems and their connectionsLarge organizations, enterprise views
DynamicFeature/use caseRuntime interactions with numbered sequenceComplex interaction flows, specific scenarios
DeploymentOne+ systems in one environmentInfrastructure, nodes, deployed instancesInfrastructure documentation, ops audience
Diagram Selection Guide

"Who is the audience?"

  • Everyone (including business) → System Context or System Landscape
  • Technical staff → Container or Deployment
  • Developers → Component (sparingly) or Dynamic

"What question does the diagram answer?"

  • "What does the system do and who uses it?" → System Context
  • "What are the main technical building blocks?" → Container
  • "How is container X structured internally?" → Component
  • "How does feature Y work at runtime?" → Dynamic
  • "Where does it run?" → Deployment
  • "What systems exist across the organization?" → System Landscape

Notation Rules

Every C4 diagram must follow these rules:

Required Elements
  • Title: Every diagram has a title stating its type and scope
  • Legend/key: Every diagram has a key explaining the notation
  • Element types: Every element explicitly states its type (Person, Software System, Container, Component)
  • Descriptions: Short descriptions (1-2 sentences) conveying key responsibilities
Technology Labels
  • All containers must specify their technology (e.g., "Python/FastAPI", "PostgreSQL 16")
  • All components must specify their technology (e.g., "Elixir GenServer", "React Component")
  • Inter-container relationships must include protocol/technology (e.g., "JSON/HTTPS", "JDBC", "gRPC")
Relationship Lines
  • Unidirectional only
  • Every line labeled with intent matching the direction
  • Avoid vague labels: "Uses" is almost always wrong
  • Good: "sends customer update events to", "reads credentials from", "queries"
  • Bad: "Uses", "Connects to", "Interacts with"
Visual Consistency
  • Colors must be consistent within and across diagrams
  • Consider B&W printing and color blindness
  • Acronyms must be understandable to the audience or explained in the legend

Workflow: Adding Elements to a Model

Step 1: Identify the Abstraction Level

Before adding anything, determine what you're modeling:

  • Is it a separately running process? → Container
  • Is it a logical grouping within a process? → Component
  • Is it an external system you don't own? → Software System (external)
  • Is it a user or role? → Person
Step 2: Define the Element

For each new element, determine:

  1. Name: Clear, unambiguous (unique within scope)
  2. Description: 1-2 sentences on its responsibility
  3. Technology: What it's built with (containers and components)
  4. Tags: For styling (e.g., "Database", "Web", "External")
Step 3: Define Relationships

For each relationship:

  1. Direction: Source → Destination (who initiates?)
  2. Description: What is the intent? (not "uses" — be specific)
  3. Technology: Protocol or mechanism (for inter-container)
Step 4: Create or Update Views
  • Add the element to relevant views using include
  • Decide if a new view is needed
  • Validate with structurizr/structurizr

Common Modeling Decisions

When to Split a Container

Split when:

  • Parts deploy independently
  • Parts scale independently
  • Parts use different technology stacks
  • Parts have different availability requirements

Do NOT split when:

  • It's just different modules in the same process
  • You want to show internal structure (use components instead)
When to Add Components

Add components when:

  • The container's internal structure is architecturally significant
  • You need to show how responsibilities are distributed
  • There are important interfaces between internal parts

Skip components when:

  • The container is simple enough to understand from its description
  • Components would just mirror the folder structure
  • The diagram would have too many elements to be useful
When to Model External Systems

Model as external software system when:

  • You don't own or control it
  • It's operated by a different team/organization
  • You interact with it through a defined API/protocol

Model as a container within your system when:

  • You deploy and manage it (even if it's third-party software like PostgreSQL)
  • It's part of your system's infrastructure

Erlang/Elixir/OTP Modeling Guide

The BEAM runtime has unique characteristics that affect C4 modeling decisions.

Mapping OTP Concepts to C4 Abstractions
OTP ConceptC4 AbstractionRationale
OTP ReleaseContainerA release is a standalone, deployable BEAM instance
OTP ApplicationComponentAn application runs within a release, not separately
Umbrella app (single release)Component per appAll apps share one BEAM VM, one deployment unit
Umbrella app (separate releases)Container per releaseEach release is a separate runtime boundary
GenServer / AgentCodeImplementation detail, not architecturally significant
Supervisor treeCodeInternal structure of an OTP application
Phoenix EndpointComponentThe HTTP/WebSocket entry point within the release
Phoenix LiveViewComponent or ContainerContainer if it's a separately served SPA; component if part of the Phoenix app
Ecto RepoComponentData access layer within the release
ObanComponent or ContainerComponent if embedded in the release; container if deployed as a separate worker release
BroadwayComponentA data pipeline within the release
Ash DomainComponentA domain boundary grouping related resources
Ash ResourceCodeAn individual resource within an Ash domain
Phoenix PubSubCodeInternal messaging mechanism, not a separate container
Erlang DistributionRelationship technologyCommunication between BEAM nodes, label on deployment relationships
Mnesia / ETSCode or ContainerETS is in-process (code); Mnesia across nodes could be modeled as a data store container if architecturally significant
Nerves firmwareContainerA deployed runtime on embedded hardware
Key Modeling Decisions for OTP

GenServers are NOT containers. A GenServer is a process within the BEAM VM. It doesn't have its own deployment boundary. It's a code-level construct — analogous to a class instance in OOP. Only model a GenServer as a component if it represents an architecturally significant subsystem (e.g., a connection pool, a rate limiter, a state machine for a core domain concept).

Supervisor trees are NOT components. They're an implementation mechanism for fault tolerance. The C4 component level should model functional groupings ("Authentication", "Order Processing"), not supervision hierarchies.

One release = one container. Even if a release contains multiple OTP applications, it's one container in C4 because it deploys as a single unit. Use components to show the internal applications if that structure matters.

LiveView can go either way. If Phoenix serves LiveView from the same endpoint, LiveView is a component within the Phoenix container. If you want to emphasize that LiveView provides a distinct real-time UI separate from traditional request/response, you can model it as a separate container — the key question is whether your audience needs to see them as separate building blocks.

Oban workers: embedded or separate? If Oban runs within your main Phoenix release (the common case), it's a component. If you deploy a separate release specifically for background job processing (e.g., a worker-only release), it's a separate container.

Ash domains are components, not containers. An Ash domain groups related resources and defines their API. It runs within the same BEAM process as everything else — it's a logical boundary, not a runtime one. Model each Ash domain as a component. Individual Ash resources are code-level constructs (like classes) and shouldn't appear in C4 diagrams. When using Ash, domains replace Phoenix contexts as the natural component grouping.

Ash and data access. With Ash, the application talks to the database through Ash's data layer, not directly through Ecto queries. The relationship from your container to the database should still say "reads from and writes to" with technology "Ash/Ecto/TCP" or simply "Ecto/TCP" — Ash wraps Ecto but the wire protocol is the same.

Container-Level Patterns for Elixir Systems

Typical Phoenix application:

  • Phoenix Application (container) — "Web application and REST API" / "Elixir/Phoenix"
  • Database (container) — "Primary data store" / "PostgreSQL 16"
  • Cache (container, if separate) — "Session and cache store" / "Redis"

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

Security

  • Security scanPassed, 95 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/c4-model/badge)](https://verified-skill.com/skills/jrjsmrtn/c4-skills/c4-model)

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