c4-diagram
Generate C4 architecture diagrams from system notes
от 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
Find the System note matching the name argument:
- Search for
System - <name>.mdin the vault root - If not found, try graph query:
node .claude/scripts/graph-query.js --search "<name>" --type System
- Search for
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 connectionsc4.internalRelationships- Container-to-container connectionsc4.description- System descriptionc4.boundary- Whether system is internal or external
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:
- Actors (leftmost / topmost)
- Presentation layer (web apps, UIs)
- API layer (gateways, routers)
- Service layer (business logic)
- Data layer (databases, caches)
- External systems (rightmost / bottommost
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл c4-diagram?
Generate C4 architecture diagrams from system notes
Как установить скилл c4-diagram?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл c4-diagram запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…