c4-model
C4 Model: Design-to-Code Sync Hub
The C4 model is a hierarchical approach to describing software architecture. This skill set focuses on Design-to-Code Sync: ensuring your diagrams reflect actual code reality and your code follows intended design.
🎯 Stakeholder Mapping
| Level | Name | Audience | Focus |
|---|---|---|---|
| L1 | System Context | Executives, PMs, Users, Devs | Business value, User Journeys, Scope |
| L2 | Container | Architects, Developers, Ops | Tech Stack, Deployable units, API boundaries |
| L3 | Component | Developers, Architects | Internal logic, Layering, Code structure |
| L4 | Code | Developers | Implementation details, ERDs, Class diagrams |
🚫 Architectural Anti-Patterns (The "Don'ts")
- The "Spaghetti" Diagram: Drawing more than 20 elements in one diagram. Solution: Break into multiple views.
- Tech Leakage in L1: Mentioning "React" or "PostgreSQL" in System Context. Solution: Focus on the "What", not "How".
- Missing Descriptions: Boxes with only names. Solution: Every box needs a one-sentence responsibility description.
- Ambiguous Arrows: Labels like "Uses", "Sends", "Connects". Solution: Use action verbs like "Authenticates user via", "Publishes order event to".
- Phantom Containers: Modeling a shared library as a container. Solution: Libraries are components (L3), not containers (L2) unless they run independently.
🚀 Specialized Workflows
- Context Level: Use
c4-level1-contextto map business scope and user journeys. - Container Level: Use
c4-level2-containerto define the tech stack and infrastructure (Docker/K8s). - Component Level: Use
c4-level3-componentto bridge the gap between design and folder structure. - Code Level: Use
c4-level4-codefor complex data models or critical logic.
🔍 Smart Synthesis (Design-to-Code)
When documenting an existing project, always scan the codebase first:
- Check
package.json,pom.xml,go.modto identify Containers (L2). - Scan folder structures (e.g.,
src/services,internal/) to identify Components (L3). - Look for
Dockerfileordocker-compose.ymlto verify Deployment mapping.
More from kinhluan/skills
scheduling-algorithms
Job scheduling algorithms for parallel and distributed systems
5ddd-core
Professional Strategic Domain-Driven Design (DDD) Hub. Use this skill for Event Storming, identifying Subdomains, defining Bounded Contexts, and mapping Domain Models to the heart of your architecture.
4ddd-tactical
Tactical Domain-Driven Design (DDD) with Scoring Rubric. Use this skill when designing internal domain models or performing architectural reviews to ensure domain logic is isolated and rich.
4ddd-patterns
Advanced Domain-Driven Design (DDD) Integration Patterns. Use this skill for implementing CQRS, Event Sourcing, the Outbox Pattern, and Anti-Corruption Layers (ACL) in distributed systems.
4c4-level4-code
Specialized in Code diagrams (Level 4) of the C4 model. Use this skill when the user needs to describe the internal implementation of a component using UML class diagrams or database ER diagrams.
4c4-level2-container
Specialized in Container diagrams (Level 2) with Infrastructure mapping. Use this skill when the user requests decomposing systems into separately deployable units, identifying the tech stack, and mapping infrastructure components (Docker, K8s).
4