/spec-driven:mermaid-architecture runs instead · from spec-driven
Generates and updates Mermaid architecture diagrams, flowcharts, sequence, ER, class, and state diagrams stored in docs/architecture/. Useful for system design documentation and visualizing workflows.
This skill never runs in Claude Code
It ships in spec-driven at skills/, but /spec-driven:mermaid-architecture (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
Create structured, high-contrast, production-ready Mermaid architecture diagrams, workflows, and system design documentation. Native diagrams render directly in Markdown viewers (GitHub, GitLab, Obsidian, wikis) with optional image exports (PNG/SVG) generated via Mermaid CLI (mmdc / npx @mermaid-js/mermaid-cli).
docs/architecture/)All generated architecture diagrams, source .mmd files, exported images, and system design documents must be stored in docs/architecture/, consistent with the drawio-architecture convention:
docs/architecture/
├── system-architecture.md # Architecture documentation with embedded Mermaid blocks
├── <name>_<type>_<title>.mmd # Source Mermaid definitions
├── <name>_<type>_<title>.png # Optional exported raster image
└── <name>_<type>_<title>.svg # Optional exported vector image
Ensure the directory exists before saving:
mkdir -p docs/architecture
The user asks for an architecture diagram, system structure, component overview, C4 model, microservices topology, or data flow.
Documenting API interactions, service call sequences, authentication flows, or request lifecycles.
Visualizing workflows, state machines, business logic, ETL pipelines, or decision trees.
Mapping code to diagrams (Spring Boot, FastAPI, React, Node/Express, Python ETL, Java).
Creating or updating full design documents (System Design, Architecture, API Design, Database Schema).
In the Orchestrator pipeline (Phase 5): invoked via /architecture (the umbrella skill that owns docs/architecture/) to update or generate native Markdown Mermaid diagrams.
User asks or mentions this skill in English (e.g., "use /mermaid-architecture", "run mermaid-architecture", "generate mermaid diagram").
O usuário pede ou menciona esta skill em português (ex.: "use /mermaid-architecture", "execute mermaid-architecture", "gerar diagrama mermaid").
.drawio format → use /drawio-architecture.In the Orchestrator lifecycle (Phase 5 — Verification & QA Gate), the orchestrator calls /architecture, which routes work to the specialized engines:
/drawio-architecture updates the visual editable .drawio system diagram./mermaid-architecture runs immediately after to generate or update the native Mermaid architecture diagrams and embedded Markdown files in docs/architecture/./create-readme then references the generated diagrams in README.md.| Diagram Type | Best Used For | Guide to Load |
|---|---|---|
| Architecture / C4 | System context, containers, microservices, component boundaries | references/guides/diagrams/architecture-diagrams.md |
| Sequence | API interactions, auth flows, inter-service messaging, async events | references/guides/diagrams/sequence-diagrams.md |
| Activity / Flowchart | Business processes, approval pipelines, ETL stages, decision trees | references/guides/diagrams/activity-diagrams.md |
| Deployment / Cloud | Cloud infrastructure (AWS, Azure, GCP), Kubernetes, networking | references/guides/diagrams/deployment-diagrams.md |
| Class / ER / State | Data models, database schemas, lifecycle transitions | references/guides/wiki-ticket-and-github.md |
To prevent syntax errors from reaching documentation, follow the resilient validation cycle:
flowchart LR
A[1. Identify Diagram Type] --> B[2. Save .mmd to docs/architecture]
B --> C{3. Validate Syntax}
C -->|Valid| D[4. Embed in Markdown / Export]
C -->|Invalid| E[5. Search Troubleshooting]
E --> F[6. Apply Fix & Retry]
F --> C
classDef step fill:#90EE90,stroke:#333,color:darkgreen
classDef decision fill:#FFD700,stroke:#333,color:black
class A,B,D,E,F step
class C decision
Use the bundled resilient script to generate diagrams directly into docs/architecture/:
# Generate diagram with automatic syntax validation and image export
python3 skills/mermaid-architecture/scripts/resilient_diagram.py \
--code "flowchart TD; A[Client] --> B[API Gateway]" \
--output-dir docs/architecture \
--markdown-file system_architecture \
--diagram-num 1 \
--title "overview" \
--format png \
--json
If mmdc is not installed globally, the script automatically uses npx -y @mermaid-js/mermaid-cli.
All diagrams must ensure readable text on both light and dark backgrounds by always specifying color: in every classDef:
graph TB
classDef primary fill:#90EE90,stroke:#333,stroke-width:2px,color:darkgreen
classDef secondary fill:#87CEEB,stroke:#333,stroke-width:2px,color:darkblue
classDef database fill:#E6E6FA,stroke:#333,stroke-width:2px,color:darkblue
classDef error fill:#FFB6C1,stroke:#DC143C,stroke-width:2px,color:black
%% Rule: Every classDef MUST include color: property
Always incorporate Unicode symbols to increase visual scanning speed and clarity:
👤 User, 👨💼 Admin🌐 Load Balancer, 🌐 API Gateway, ☁️ Cloud⚙️ Service, ⚡ Worker, 🚀 Microservice[(💾 Database)], [(⚡ Redis Cache)], 📦 Object Storage📨 Event Bus, 📬 Message Queue, 📢 PubSub🔐 Auth Service, 🛡️ Firewall, 🔑 Secrets📊 Metrics, 📝 Logs, 🚨 AlertsWhen generating architecture from existing source code:
@RestController, @app.get, Express routes, Controllers).docker-compose.yml, Helm charts, Terraform, or cloud configs.architecture-diagrams.mdsequence-diagrams.mdactivity-diagrams.mdexamples/ (spring-boot, fastapi, react, node-webapp, python-etl, java-webapp).assets/)When full architecture or system documentation is required, populate the corresponding template and save to docs/architecture/:
| Document Type | Template Path | Target Output |
|---|---|---|
| Architecture Design | assets/architecture-design-template.md | docs/architecture/architecture-design.md |
| System Design | assets/system-design-template.md | docs/architecture/system-design.md |
| API Design | assets/api-design-template.md | docs/architecture/api-design.md |
| Database Design | assets/database-design-template.md | docs/architecture/database-design.md |
| Feature Design | assets/feature-design-template.md | docs/architecture/feature-<name>-design.md |
The skill includes standalone utilities in scripts/:
# Extract diagrams from markdown, validate, or convert
python3 skills/mermaid-architecture/scripts/extract_mermaid.py docs/architecture/system.md --validate
# Convert .mmd to PNG or SVG
python3 skills/mermaid-architecture/scripts/mermaid_to_image.py docs/architecture/overview.mmd docs/architecture/overview.png
# Full resilient generation with error diagnostics
python3 skills/mermaid-architecture/scripts/resilient_diagram.py --code "..." --title "service_map"
references/guides/diagrams/architecture-diagrams.md — C4 model, microservices, component architecturereferences/guides/diagrams/sequence-diagrams.md — API interactions, service callsreferences/guides/diagrams/activity-diagrams.md — Workflows and processesreferences/guides/diagrams/deployment-diagrams.md — Cloud, infrastructure, and deploymentreferences/guides/unicode-symbols/guide.md — Complete semantic symbol indexreferences/guides/troubleshooting.md — 28 common syntax error solutionsreferences/guides/resilient-workflow.md — Error recovery and validation protocolarchitecture — Umbrella skill that owns docs/architecture/ and routes diagram work to this enginedrawio-architecture — Companion skill for editable draw.io visual diagramsassets/api-design-template.md (opens in a new tab)assets/architecture-design-template.md (opens in a new tab)assets/database-design-template.md (opens in a new tab)assets/feature-design-template.md (opens in a new tab)assets/system-design-template.md (opens in a new tab)examples/fastapi/README.md (opens in a new tab)examples/java-webapp/README.md (opens in a new tab)examples/node-webapp/README.md (opens in a new tab)examples/python-etl/README.md (opens in a new tab)examples/react/README.md (opens in a new tab)examples/spring-boot/README.md (opens in a new tab)references/guides/code-to-diagram/README.md (opens in a new tab)references/guides/diagrams/activity-diagrams.md (opens in a new tab)references/guides/diagrams/architecture-diagrams.md (opens in a new tab)references/guides/diagrams/deployment-diagrams.md (opens in a new tab)references/guides/diagrams/sequence-diagrams.md (opens in a new tab)references/guides/resilient-workflow.md (opens in a new tab)references/guides/troubleshooting.md (opens in a new tab)references/guides/unicode-symbols/guide.md (opens in a new tab)references/guides/wiki-ticket-and-github.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mermaid, architecture-diagrams, system-design, documentation
27 skills in this plugin
/architectureSingle owner of everything under docs/architecture/ — ADRs, architecture and design documents, and architecture diagrams. Routes each deliverable to the right engine: /mermaid-architecture for Markdown-native diagrams, /drawio-architecture for editable .drawio diagrams, and the optional archify skill for interactive standalone HTML diagrams (used only when already installed in the environment; never installed at runtime). Use whenever architecture documentation, ADRs, or architecture diagrams must be created or updated./building-mcp-serversUse when building a new MCP server in TypeScript, Python, or C# that exposes tools to LLMs./code-review-and-qualityUse when reviewing code before it merges, whether written by an agent or a human./composio-mcpUse when the user asks to connect an AI agent to external apps via Composio, or when Composio CLI or MCP setup fails./create-agent-harnessUse when initializing or migrating an AI agent harness in a repository./create-issuesUse when turning approved plans, specs, PRDs, or Epics into trackable GitHub Issues.npx claudepluginhub afonsoft/skills --plugin spec-drivenOther plugins' skills for the same job