Command Palette

Search for a command to run...

Назад к скиллам
скилл № 21694

c4-diagram

Generate C4 architecture diagrams from system notes

БесплатноБез исполняемых скриптов
DavidROliverBAот DavidROliverBA★ 53 звезды на GitHub

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

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

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

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

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

/c4-diagram Skill

Generate C4 architecture diagrams (Mermaid, flowchart, or PlantUML) from System note frontmatter data.

When to Use This Skill

Use /c4-diagram when you need to generate C4 architecture diagrams from the structured c4: data stored in System note frontmatter. Supports three output formats: native Mermaid C4 (default), flowchart LR with C4 styling (more layout control), and PlantUML with directional hints (best for complex diagrams). This complements the /diagram skill (which generates Python diagrams PNGs) by producing text-based diagrams that are Git-friendly and render inline in Obsidian.

Usage

/c4-diagram <system-name> [level] [format]

Arguments

Argument Required Description
system-name Yes Name of the System note (e.g., Data Platform, MRO System, Cloud Platform)
level No context (L1, default), container (L2), or both
format No mermaid (default), flowchart, or plantuml

Format Options

Format Syntax Used Best For
mermaid C4Context/C4Container native Clean Obsidian rendering, ≤10 elements (default)
flowchart flowchart LR with classDef C4 More layout control via declaration order
plantuml C4-PlantUML with directional hints >15 elements, persistent crossings, formal docs

When to choose each format:

Scenario Choose Reason
Quick inline diagram in Obsidian mermaid Native rendering, fast iteration
Need layout control, <15 elements flowchart Declaration order gives more influence over Dagre
Complex layouts with persistent crossings plantuml Directional hints (Rel_Down, Lay_Right) fix crossings
>15 elements plantuml Layout control prevents chaos at scale
Formal documentation, PDF export plantuml Better export quality, automatic legend
CI/CD or Structurizr pipeline plantuml Stable server-side rendering

Examples

/c4-diagram DataPlatform
/c4-diagram MROSystem container
/c4-diagram CloudPlatform both
/c4-diagram DataPlatform container flowchart
/c4-diagram MROSystem both plantuml

Instructions

Phase 1: Read System Data

  1. Find the System note matching the name argument:

    • Search for System - <name>.md in the vault root
    • If not found, try graph query: node .claude/scripts/graph-query.js --search "<name>" --type System
  2. Read the note and extract the c4: frontmatter section. Required fields:

    • c4.actors - People/roles (for Context diagram)
    • c4.containers - Internal services (for Container diagram)
    • c4.externalRelationships - External system connections
    • c4.internalRelationships - Container-to-container connections
    • c4.description - System description
    • c4.boundary - Whether system is internal or external
  3. If c4: data is missing or empty, inform the user:

    This system note has no c4: data. Add C4 architecture data to the frontmatter first. See the System template for the schema.

Phase 2: Generate Mermaid C4

Generate the Mermaid code following these best practices:

General Rules

  • Maximum 10 elements per diagram (actors + systems + containers)
  • Descriptions under 40 characters - truncate if needed
  • Use directional relationships - Rel_D (down) for primary flow, Rel_R (right) for secondary
  • Order: Persons → System Boundary → External Systems → Relationships → Config
  • Always include UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1") at the end
  • Alias naming: Use camelCase without spaces (e.g., dataEngineer, erpSystem)
  • Strip wiki-link syntax from target names (e.g., System - Data Platform → Data Platform)

Layout Science

Declaration order is the most important factor for readable diagrams. The Dagre/Sugiyama layout algorithm positions elements based on where they appear in the code — declare elements in your intended reading order.

Tier-based ordering — declare elements in this order:

  1. Actors (leftmost / topmost)
  2. Presentation layer (web apps, UIs)
  3. API layer (gateways, routers)
  4. Service layer (business logic)
  5. Data layer (databases, caches)
  6. External systems (rightmost / bottommost
Полный SKILL.md на GitHub

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

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

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

FAQ

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

Generate C4 architecture diagrams from system notes

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

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

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

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

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

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