c4-architecture

Generate C4 model architecture diagrams in Mermaid syntax from codebase analysis.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/lfuuu/claude-rules --skill c4-architecture-lfuuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: c4-architecture
Source: https://github.com/lfuuu/claude-rules/tree/main/global-skills/c4-architecture
Command: npx skills add https://github.com/lfuuu/claude-rules --skill c4-architecture-lfuuu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing software architecture documentation is time-consuming, and teams struggle to produce consistent, audience-appropriate diagrams. This Skill automates the creation of C4 model diagrams (Context, Container, Component, Deployment, Dynamic) in Mermaid syntax, so architecture documentation stays accurate and readable. ## Core Features & Use Cases - Multi-level C4 diagram generation: Produces System Context, Container, Component, Deployment, and Dynamic diagrams with correct Mermaid C4 syntax, element types, boundaries, and relationships. - Audience-aware scoping: Selects the right abstraction level based on the target audience (executives, product managers, architects, developers, DevOps) and enforces best practices like unidirectional arrows, technology labels, and the 20-element limit. - Reference guides for advanced cases: Includes a full Mermaid C4 syntax reference, a catalog of common anti-patterns (e.g., modeling shared libraries as containers, single message-bus diagrams), and advanced patterns for microservices, event-driven systems, CQRS, and multi-region deployments. - Use Case: Ask it to document a microservices e-commerce platform, and it produces a Context diagram plus a Container diagram showing services, databases, and individual Kafka topics, written to docs/architecture/. ## Quick Start Ask the assistant to create C4 architecture diagrams for your system, for example: generate a system context and container diagram for my application and save them under docs/architecture.

Frequently Asked Questions about c4-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a C4 architecture diagram in Mermaid?

Start the diagram with a type declaration like C4Context or C4Container, then define elements using Person, System, Container, or Component with alias, label, technology, and description. Connect them with Rel statements labeled with action verbs and protocols.

What is the difference between C4 Context, Container, and Component diagrams?

Context diagrams show the system with users and external systems for all audiences. Container diagrams show deployable applications, databases, and services for technical staff. Component diagrams show internal modules inside one container and are only needed when they add value.

Does Mermaid support all PlantUML C4 features?

No. Mermaid C4 does not support sprites, tags, links, legends, custom shapes, dashed lines, or layout directives. Use UpdateLayoutConfig and UpdateRelStyle with offset parameters to control layout and fix overlapping labels instead.

How should microservices be modeled in C4 diagrams?

Model microservices as containers when one team owns them, or promote each to a software system when different teams own them. For event-driven systems, show individual Kafka topics or queues as separate containers rather than one central message bus block.

What are common mistakes when drawing C4 diagrams?

Frequent mistakes include confusing deployable containers with internal components, modeling shared libraries as containers, using bidirectional arrows, omitting technology labels, and putting infrastructure details in container diagrams instead of deployment diagrams.