Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

c4-modeling

БесплатноБез исполняемых скриптовНе проверен

C4 model (Context, Container, Component, Code) diagram patterns with Mermaid syntax for architecture documentation

Hack23от Hack23★ 15 звёзд на GitHub

Об этом скилле

C4 Model Skill

Purpose

This skill provides guidance on creating C4 (Context, Container, Component, Code) model diagrams using Mermaid syntax for architecture documentation. C4 models provide a hierarchical way to visualize software architecture at different levels of abstraction, following Simon Brown's C4 model methodology.

Rules

C4 Model Levels

The C4 model consists of four levels of abstraction:

  1. Level 1: System Context - Shows how the system fits into its environment
  2. Level 2: Container - Shows the high-level technology choices and communication between containers
  3. Level 3: Component - Shows how containers are decomposed into components
  4. Level 4: Code - Shows implementation details (optional, often better shown in IDEs)

When to Use Each Level

System Context Diagram - MUST USE:

  • When documenting a new system
  • To show system boundaries
  • To identify users and external dependencies
  • In architecture decision records
  • In system documentation home page

Container Diagram - MUST USE:

  • For all systems with multiple deployable units
  • To show technology stack
  • To document inter-container communication
  • For security architecture (trust boundaries)
  • In deployment documentation

Component Diagram - SHOULD USE:

  • For complex containers with many components
  • When explaining internal structure
  • For onboarding new developers
  • For technical debt analysis

Code Diagram - RARELY USE:

  • Only for explaining specific complex patterns
  • Better suited for IDE visualization
  • Consider UML class diagrams instead

Documentation Requirements

MUST:

  • Create both CURRENT and FUTURE state diagrams (ARCHITECTURE.md and FUTURE_ARCHITECTURE.md)
  • Include title, description, and key for each diagram
  • Use consistent notation across diagrams
  • Document relationships between elements
  • Include technologies used
  • Version diagrams when architecture changes
  • Keep diagrams up-to-date with code changes

MUST NOT:

  • Create overly detailed diagrams (focus on key elements)
  • Mix different abstraction levels in same diagram
  • Omit technology choices from Container diagrams
  • Use ambiguous relationship labels

Mermaid Syntax for C4 Diagrams

Mermaid supports C4 diagrams through the C4Context, C4Container, and C4Component directives.

Examples

Example 1: System Context Diagram

C4Context
    title System Context Diagram for Hack23 CIA Platform

    Person(user, "Political Analyst", "A user analyzing political data")
    Person(admin, "Administrator", "Manages the system")
    
    System(cia, "Citizen Intelligence Agency", "Provides political data analysis and visualization")
    
    System_Ext(riksdagen, "Riksdagen API", "Swedish Parliament open data")
    System_Ext(worldbank, "World Bank API", "Global economic indicators")
    System_Ext(github, "GitHub API", "Politician activity tracking")
    System_Ext(auth, "OAuth Provider", "Authentication service")
    
    Rel(user, cia, "Uses", "HTTPS")
    Rel(admin, cia, "Administers", "HTTPS")
    Rel(cia, riksdagen, "Fetches data from", "HTTPS/REST")
    Rel(cia, worldbank, "Fetches data from", "HTTPS/REST")
    Rel(cia, github, "Tracks activity via", "HTTPS/REST")
    Rel(cia, auth, "Authenticates via", "OAuth 2.0")
    
    UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")

Example 2: Container Diagram

C4Container
    title Container Diagram for Hack23 CIA Platform

    Person(user, "Political Analyst", "Analyzes political data")
    
    System_Boundary(cia, "Citizen Intelligence Agency") {
        Container(web, "Web Application", "React, JavaScript", "Provides political analysis UI")
        Container(api, "API Application", "Spring Boot, Java", "Provides data via REST API")
        Container(worker, "Background Worker", "Java", "Processes data updates")
        ContainerDb(db, "Database", "PostgreSQL", "Stores political data, analytics")
        ContainerDb(cache, "Cache", "Redis", "Caches frequently accessed data")
        Container(search, "Search Engine", "Elasticsearch", "Full-text search")
    }
    
    System_Ext(riksdagen, "Riksdagen API", "Parliament data")
    System_Ext(cdn, "CloudFront CDN", "Static content delivery")
    System_Ext(auth, "Auth0", "Authentication")
    
    Rel(user, web, "Uses", "HTTPS")
    Rel(user, cdn, "Loads static assets", "HTTPS")
    Rel(web, api, "Makes API calls", "HTTPS/REST")
    Rel(web, auth, "Authenticates", "OAuth 2.0")
    Rel(api, db, "Reads/Writes", "JDBC/SSL")
    Rel(api, cache, "Reads/Writes", "Redis Protocol")
    Rel(api, search, "Queries", "HTTPS/REST")
    Rel(worker, riksdagen, "Fetches data", "HTTPS/REST")
    Rel(worker, db, "Writes", "JDBC/SSL")
    
    UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")

Example 3: Component Diagram

C4Component
    title Component Diagram for CIA API Application

    Container(web, "Web Application", "React", "UI for political
Полный SKILL.md на GitHub

Установить c4-modeling в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл c4-modeling?

C4 model (Context, Container, Component, Code) diagram patterns with Mermaid syntax for architecture documentation

Как установить скилл c4-modeling?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл c4-modeling запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить c4-modeling с