c4-documentation
C4 model architecture visualization and documentation
What this skill does
# C4 Documentation Skill
Create architecture documentation using the C4 model's four levels of abstraction.
## MANDATORY: Documentation-First Approach
Before creating C4 documentation:
1. **Invoke `docs-management` skill** for C4 patterns
2. **Verify C4 model syntax** via MCP servers (context7 for Structurizr/Mermaid)
3. **Base guidance on c4model.com official documentation**
## C4 Model Overview
```text
C4 Model - Four Levels of Abstraction:
Level 1: System Context
┌─────────────────────────────────────────────────────────────────────────────┐
│ Shows the system in context with users and external systems │
│ Audience: Everyone (technical and non-technical) │
└─────────────────────────────────────────────────────────────────────────────┘
↓
Level 2: Container
┌─────────────────────────────────────────────────────────────────────────────┐
│ Shows high-level technology choices and responsibilities │
│ Audience: Technical people (inside and outside the team) │
└─────────────────────────────────────────────────────────────────────────────┘
↓
Level 3: Component
┌─────────────────────────────────────────────────────────────────────────────┐
│ Shows components within a container │
│ Audience: Software architects and developers │
└─────────────────────────────────────────────────────────────────────────────┘
↓
Level 4: Code (Optional)
┌─────────────────────────────────────────────────────────────────────────────┐
│ Shows classes, interfaces, and implementation details │
│ Audience: Developers (often auto-generated) │
└─────────────────────────────────────────────────────────────────────────────┘
```
## Level 1: System Context Diagram
### Purpose
Shows the software system in the context of:
- Who uses it (people)
- What other systems it interacts with
### Mermaid Syntax
```mermaid
C4Context
title System Context Diagram for [System Name]
Person(customer, "Customer", "A customer who uses our platform")
Person(admin, "Administrator", "System administrator")
System(system, "System Name", "Allows customers to do X and Y")
System_Ext(email, "Email System", "Sends transactional emails")
System_Ext(payment, "Payment Gateway", "Processes payments")
System_Ext(analytics, "Analytics Platform", "Tracks user behavior")
Rel(customer, system, "Uses", "HTTPS")
Rel(admin, system, "Manages", "HTTPS")
Rel(system, email, "Sends emails using", "SMTP")
Rel(system, payment, "Processes payments via", "HTTPS/REST")
Rel(system, analytics, "Sends events to", "HTTPS")
```
### PlantUML/Structurizr DSL
```plantuml
@startuml
!include <C4/C4_Context>
title System Context Diagram for [System Name]
Person(customer, "Customer", "A customer who uses our platform")
Person(admin, "Administrator", "System administrator")
System(system, "System Name", "Allows customers to do X and Y")
System_Ext(email, "Email System", "Sends transactional emails")
System_Ext(payment, "Payment Gateway", "Processes payments")
Rel(customer, system, "Uses", "HTTPS")
Rel(admin, system, "Manages", "HTTPS")
Rel(system, email, "Sends emails using", "SMTP")
Rel(system, payment, "Processes payments via", "HTTPS")
@enduml
```
## Level 2: Container Diagram
### Purpose
Shows the high-level shape of the software architecture:
- Applications, data stores, microservices
- How they communicate
- Technology choices
### Mermaid Syntax
```mermaid
C4Container
title Container Diagram for [System Name]
Person(customer, "Customer", "End user")
System_Boundary(system, "System Name") {
Container(web, "Web Application", "Blazor", "Delivers the UI")
Container(api, "API Gateway", "Kong", "Routes and secures APIs")
Container(order, "Order Service", ".NET 10", "Handles order processing")
Container(inventory, "Inventory Service", ".NET 10", "Manages stock")
ContainerDb(db, "Database", "PostgreSQL", "Stores orders and inventory")
ContainerQueue(queue, "Message Broker", "Kafka", "Async messaging")
}
Rel(customer, web, "Uses", "HTTPS")
Rel(web, api, "Makes API calls", "HTTPS/JSON")
Rel(api, order, "Routes to", "gRPC")
Rel(api, inventory, "Routes to", "gRPC")
Rel(order, db, "Reads/Writes", "TCP")
Rel(inventory, db, "Reads/Writes", "TCP")
Rel(order, queue, "Publishes events", "Kafka protocol")
Rel(inventory, queue, "Subscribes to events", "Kafka protocol")
```
### Container Types
| Type | Usage | Example |
|------|-------|---------|
| `Container` | Application/service | API, web app, microservice |
| `ContainerDb` | Database | PostgreSQL, MongoDB, Redis |
| `ContainerQueue` | Message queue | Kafka, RabbitMQ, SQS |
| `Container_Ext` | External container | Third-party API hosted elsewhere |
## Level 3: Component Diagram
### Purpose
Shows the internal structure of a container:
- Major components and their responsibilities
- Interactions between components
- Technology implementation
### Mermaid Syntax
```mermaid
C4Component
title Component Diagram for Order Service
Container_Boundary(order, "Order Service") {
Component(api, "API Controller", ".NET", "Handles HTTP requests")
Component(handler, "Command Handlers", "MediatR", "Processes commands")
Component(domain, "Domain Model", "C#", "Business logic and rules")
Component(repo, "Repository", "EF Core", "Data access abstraction")
Component(events, "Event Publisher", "MassTransit", "Publishes domain events")
}
ContainerDb(db, "Database", "PostgreSQL", "Stores order data")
ContainerQueue(queue, "Message Broker", "Kafka", "Event transport")
Rel(api, handler, "Dispatches to")
Rel(handler, domain, "Uses")
Rel(handler, repo, "Uses")
Rel(handler, events, "Publishes via")
Rel(repo, db, "Reads/Writes")
Rel(events, queue, "Publishes to")
```
## Level 4: Code Diagram
### Purpose
Shows implementation details (usually auto-generated):
- Class diagrams
- Entity relationships
- Interface definitions
### When to Use
- Complex domain models
- Framework documentation
- Public API documentation
```mermaid
classDiagram
class Order {
+Guid Id
+Guid CustomerId
+OrderStatus Status
+IReadOnlyList~LineItem~ Items
+Money Total
+AddItem(Product, int)
+Submit()
+Cancel()
}
class LineItem {
+Guid ProductId
+string ProductName
+int Quantity
+Money UnitPrice
+Money Total
}
class OrderStatus {
<<enumeration>>
Draft
Submitted
Confirmed
Shipped
Delivered
Cancelled
}
Order "1" *-- "*" LineItem
Order --> OrderStatus
```
## Supplementary Diagrams
### Deployment Diagram
```mermaid
C4Deployment
title Deployment Diagram for Production
Deployment_Node(azure, "Azure Cloud", "Cloud Platform") {
Deployment_Node(region, "East US", "Azure Region") {
Deployment_Node(aks, "AKS Cluster", "Kubernetes 1.28") {
Deployment_Node(ns, "production namespace") {
Container(api, "API Pods", "3 replicas")
Container(worker, "Worker Pods", "2 replicas")
}
}
Deployment_Node(data, "Data Services") {
ContainerDb(db, "Azure PostgreSQL", "Flexible Server")
ContainerDb(redis, "Azure Redis", "Premium tier")
}
}
}
Rel(api, db, "Connects to", "TCP/5432")
Rel(api, redis, "Caches with", "TCP/6379")
```
### Dynamic Diagram (Sequence)
```mermaid
sequenceDiagram
participant U as User
participant W aRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.