@vpxa/aikit 0.1.73 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -1
- package/packages/cli/dist/index.js +2 -2
- package/packages/cli/dist/{init-D_OGLUN1.js → init-CuRXmyD9.js} +4 -4
- package/packages/cli/dist/scaffold-WMQ2uQ48.js +2 -0
- package/packages/cli/dist/{templates-DJ7EC5vw.js → templates-ArdAVWoY.js} +13 -3
- package/packages/cli/dist/user-vbJwa7x2.js +5 -0
- package/packages/dashboard/dist/assets/index-C6D-PCp0.js.map +1 -1
- package/packages/flows/dist/index.d.ts +29 -0
- package/packages/flows/dist/index.js +1 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/{server-B9Mx1aK-.js → server-CVhVH5cT.js} +127 -127
- package/packages/tools/dist/index.d.ts +19 -1
- package/packages/tools/dist/index.js +39 -39
- package/scaffold/dist/adapters/claude-code.mjs +4 -0
- package/scaffold/dist/adapters/copilot.mjs +75 -0
- package/scaffold/dist/adapters/flows.mjs +1 -0
- package/scaffold/dist/adapters/skills.mjs +1 -0
- package/scaffold/dist/compiled/flows-data.mjs +1429 -0
- package/scaffold/dist/compiled/skills-data.mjs +9951 -0
- package/scaffold/dist/definitions/agents.mjs +9 -0
- package/scaffold/{definitions → dist/definitions}/bodies.mjs +6 -229
- package/scaffold/dist/definitions/exclusions.mjs +1 -0
- package/scaffold/dist/definitions/hooks.mjs +1 -0
- package/scaffold/dist/definitions/models.mjs +1 -0
- package/scaffold/dist/definitions/plugins.mjs +1 -0
- package/scaffold/{definitions → dist/definitions}/prompts.mjs +9 -149
- package/scaffold/{definitions → dist/definitions}/protocols.mjs +9 -37
- package/scaffold/dist/definitions/tools.mjs +1 -0
- package/packages/cli/dist/scaffold-CJwkHf-q.js +0 -2
- package/packages/cli/dist/user-BEmVW8Tp.js +0 -5
- package/scaffold/adapters/claude-code.mjs +0 -73
- package/scaffold/adapters/copilot.mjs +0 -292
- package/scaffold/definitions/agents.mjs +0 -266
- package/scaffold/definitions/hooks.mjs +0 -43
- package/scaffold/definitions/models.mjs +0 -84
- package/scaffold/definitions/plugins.mjs +0 -147
- package/scaffold/definitions/tools.mjs +0 -250
- package/scaffold/flows/_epilogue/steps/docs-sync/README.md +0 -120
- package/scaffold/flows/aikit-advanced/README.md +0 -70
- package/scaffold/flows/aikit-advanced/flow.json +0 -69
- package/scaffold/flows/aikit-advanced/steps/design/README.md +0 -178
- package/scaffold/flows/aikit-advanced/steps/execute/README.md +0 -145
- package/scaffold/flows/aikit-advanced/steps/plan/README.md +0 -122
- package/scaffold/flows/aikit-advanced/steps/spec/README.md +0 -121
- package/scaffold/flows/aikit-advanced/steps/task/README.md +0 -119
- package/scaffold/flows/aikit-advanced/steps/verify/README.md +0 -145
- package/scaffold/flows/aikit-basic/README.md +0 -51
- package/scaffold/flows/aikit-basic/flow.json +0 -45
- package/scaffold/flows/aikit-basic/steps/assess/README.md +0 -109
- package/scaffold/flows/aikit-basic/steps/design/README.md +0 -116
- package/scaffold/flows/aikit-basic/steps/implement/README.md +0 -131
- package/scaffold/flows/aikit-basic/steps/verify/README.md +0 -123
- package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +0 -132
- package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +0 -132
- package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +0 -112
- package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +0 -112
- package/scaffold/general/agents/Debugger.agent.md +0 -412
- package/scaffold/general/agents/Documenter.agent.md +0 -468
- package/scaffold/general/agents/Explorer.agent.md +0 -76
- package/scaffold/general/agents/Frontend.agent.md +0 -440
- package/scaffold/general/agents/Implementer.agent.md +0 -425
- package/scaffold/general/agents/Orchestrator.agent.md +0 -452
- package/scaffold/general/agents/Planner.agent.md +0 -481
- package/scaffold/general/agents/README.md +0 -57
- package/scaffold/general/agents/Refactor.agent.md +0 -435
- package/scaffold/general/agents/Researcher-Alpha.agent.md +0 -151
- package/scaffold/general/agents/Researcher-Beta.agent.md +0 -152
- package/scaffold/general/agents/Researcher-Delta.agent.md +0 -153
- package/scaffold/general/agents/Researcher-Gamma.agent.md +0 -152
- package/scaffold/general/agents/Security.agent.md +0 -433
- package/scaffold/general/agents/_shared/architect-reviewer-base.md +0 -104
- package/scaffold/general/agents/_shared/code-agent-base.md +0 -366
- package/scaffold/general/agents/_shared/code-reviewer-base.md +0 -87
- package/scaffold/general/agents/_shared/decision-protocol.md +0 -27
- package/scaffold/general/agents/_shared/forge-protocol.md +0 -90
- package/scaffold/general/agents/_shared/researcher-base.md +0 -114
- package/scaffold/general/agents/templates/adr-template.md +0 -28
- package/scaffold/general/agents/templates/execution-state.md +0 -26
- package/scaffold/general/prompts/aikit-ask.prompt.md +0 -13
- package/scaffold/general/prompts/aikit-debug.prompt.md +0 -15
- package/scaffold/general/prompts/aikit-design.prompt.md +0 -15
- package/scaffold/general/prompts/aikit-flow-add.prompt.md +0 -84
- package/scaffold/general/prompts/aikit-flow-create.prompt.md +0 -80
- package/scaffold/general/prompts/aikit-flow-manage.prompt.md +0 -24
- package/scaffold/general/prompts/aikit-implement.prompt.md +0 -17
- package/scaffold/general/prompts/aikit-plan.prompt.md +0 -15
- package/scaffold/general/prompts/aikit-review.prompt.md +0 -24
- package/scaffold/general/skills/adr-skill/SKILL.md +0 -335
- package/scaffold/general/skills/adr-skill/assets/templates/adr-madr.md +0 -89
- package/scaffold/general/skills/adr-skill/assets/templates/adr-readme.md +0 -20
- package/scaffold/general/skills/adr-skill/assets/templates/adr-simple.md +0 -46
- package/scaffold/general/skills/adr-skill/references/adr-conventions.md +0 -95
- package/scaffold/general/skills/adr-skill/references/examples.md +0 -193
- package/scaffold/general/skills/adr-skill/references/review-checklist.md +0 -77
- package/scaffold/general/skills/adr-skill/references/template-variants.md +0 -52
- package/scaffold/general/skills/adr-skill/scripts/bootstrap_adr.js +0 -259
- package/scaffold/general/skills/adr-skill/scripts/new_adr.js +0 -391
- package/scaffold/general/skills/adr-skill/scripts/set_adr_status.js +0 -169
- package/scaffold/general/skills/aikit/SKILL.md +0 -754
- package/scaffold/general/skills/brainstorming/SKILL.md +0 -265
- package/scaffold/general/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/scaffold/general/skills/c4-architecture/SKILL.md +0 -389
- package/scaffold/general/skills/c4-architecture/references/advanced-patterns.md +0 -552
- package/scaffold/general/skills/c4-architecture/references/c4-syntax.md +0 -510
- package/scaffold/general/skills/c4-architecture/references/common-mistakes.md +0 -437
- package/scaffold/general/skills/c4-architecture/references/html-design-system.md +0 -337
- package/scaffold/general/skills/c4-architecture/references/html-template.html +0 -627
- package/scaffold/general/skills/docs/SKILL.md +0 -553
- package/scaffold/general/skills/docs/references/diataxis-anti-patterns.md +0 -147
- package/scaffold/general/skills/docs/references/diataxis-compass.md +0 -123
- package/scaffold/general/skills/docs/references/diataxis-quadrants.md +0 -192
- package/scaffold/general/skills/docs/references/diataxis-quality.md +0 -76
- package/scaffold/general/skills/docs/references/diataxis-templates.md +0 -120
- package/scaffold/general/skills/docs/references/flow-artifacts-guide.md +0 -70
- package/scaffold/general/skills/docs/references/project-knowledge-gotchas.md +0 -32
- package/scaffold/general/skills/docs/references/project-knowledge-templates.md +0 -281
- package/scaffold/general/skills/docs/references/project-knowledge-workflow.md +0 -80
- package/scaffold/general/skills/frontend-design/SKILL.md +0 -237
- package/scaffold/general/skills/lesson-learned/SKILL.md +0 -113
- package/scaffold/general/skills/lesson-learned/references/anti-patterns.md +0 -55
- package/scaffold/general/skills/lesson-learned/references/se-principles.md +0 -109
- package/scaffold/general/skills/multi-agents-development/SKILL.md +0 -448
- package/scaffold/general/skills/multi-agents-development/architecture-review-prompt.md +0 -81
- package/scaffold/general/skills/multi-agents-development/code-quality-review-prompt.md +0 -91
- package/scaffold/general/skills/multi-agents-development/implementer-prompt.md +0 -93
- package/scaffold/general/skills/multi-agents-development/parallel-dispatch-example.md +0 -167
- package/scaffold/general/skills/multi-agents-development/spec-review-prompt.md +0 -81
- package/scaffold/general/skills/present/SKILL.md +0 -616
- package/scaffold/general/skills/react/SKILL.md +0 -309
- package/scaffold/general/skills/repo-access/SKILL.md +0 -178
- package/scaffold/general/skills/repo-access/references/error-patterns.md +0 -116
- package/scaffold/general/skills/repo-access/references/platform-matrix.md +0 -142
- package/scaffold/general/skills/requirements-clarity/SKILL.md +0 -333
- package/scaffold/general/skills/session-handoff/SKILL.md +0 -199
- package/scaffold/general/skills/session-handoff/references/handoff-template.md +0 -139
- package/scaffold/general/skills/session-handoff/references/resume-checklist.md +0 -80
- package/scaffold/general/skills/session-handoff/scripts/check_staleness.js +0 -269
- package/scaffold/general/skills/session-handoff/scripts/create_handoff.js +0 -299
- package/scaffold/general/skills/session-handoff/scripts/list_handoffs.js +0 -113
- package/scaffold/general/skills/session-handoff/scripts/validate_handoff.js +0 -241
- package/scaffold/general/skills/typescript/SKILL.md +0 -405
- package/scaffold/generate.mjs +0 -82
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: c4-architecture
|
|
3
|
-
description: "Generate architecture documentation using C4 model diagrams. Supports two output formats: Mermaid (md) for documentation and HTML/SVG for presentations. Use when asked to create architecture diagrams, document system architecture, visualize software structure, create C4 diagrams, or generate context/container/component/deployment diagrams."
|
|
4
|
-
metadata:
|
|
5
|
-
category: cross-cutting
|
|
6
|
-
domain: general
|
|
7
|
-
applicability: on-demand
|
|
8
|
-
inputs: [codebase, architecture]
|
|
9
|
-
outputs: [diagrams]
|
|
10
|
-
relatedSkills: [adr-skill]
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# C4 Architecture Documentation
|
|
14
|
-
|
|
15
|
-
Generate software architecture documentation using C4 model diagrams in Mermaid syntax.
|
|
16
|
-
|
|
17
|
-
## Workflow
|
|
18
|
-
|
|
19
|
-
1. **Understand scope** - Determine which C4 level(s) are needed based on audience
|
|
20
|
-
2. **Analyze codebase** - Explore the system to identify components, containers, and relationships
|
|
21
|
-
3. **Generate diagrams** - Create Mermaid C4 diagrams at appropriate abstraction levels
|
|
22
|
-
> **Tip:** Use `present({ format: "html" })` to render diagrams as interactive visual output, rather than raw Mermaid code blocks. This provides a better viewing experience for stakeholders.
|
|
23
|
-
4. **Document** - Write diagrams to markdown files with explanatory context
|
|
24
|
-
|
|
25
|
-
## Format Selection
|
|
26
|
-
|
|
27
|
-
This skill supports two output formats. Choose based on the audience and delivery method:
|
|
28
|
-
|
|
29
|
-
> **Default rule:** When using the `present` tool to display architecture, **always use HTML/SVG format** (Method 2). It produces professional dark-themed diagrams with SVG icons, category colors, and summary cards. Use Mermaid only for saving to markdown docs or when the user explicitly requests it.
|
|
30
|
-
|
|
31
|
-
| Format | Output | Best For | Delivery |
|
|
32
|
-
|--------|--------|----------|----------|
|
|
33
|
-
| **Mermaid (md)** | `.md` files with Mermaid code blocks | Developer docs, GitHub rendering, version control | Save to `docs/architecture/*.md` |
|
|
34
|
-
| **HTML/SVG (html)** | Self-contained `.html` files | Stakeholder presentations, visual reviews, browser viewing | Save as `.html` or render via `present` tool |
|
|
35
|
-
|
|
36
|
-
### Format Decision Tree
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
What is the goal?
|
|
40
|
-
├── Save to docs / version control → Mermaid (md)
|
|
41
|
-
├── Present via `present` tool → HTML/SVG (html) ← DEFAULT for present
|
|
42
|
-
├── User says "Mermaid" or "markdown" → Mermaid (md)
|
|
43
|
-
└── User says "show", "visualize", "present" → HTML/SVG (html)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Present Tool Integration
|
|
47
|
-
|
|
48
|
-
Both formats work with the `present` tool:
|
|
49
|
-
|
|
50
|
-
**Mermaid format** - Use a `mermaid` content block:
|
|
51
|
-
```js
|
|
52
|
-
present({
|
|
53
|
-
format: "html", // or "browser"
|
|
54
|
-
title: "System Architecture",
|
|
55
|
-
content: [
|
|
56
|
-
{ type: "mermaid", title: "C4 Container Diagram", value: "C4Container\n title Container Diagram\n ..." }
|
|
57
|
-
]
|
|
58
|
-
})
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**HTML/SVG format** - Use a `markdown` block with the full HTML structure. Pair with `metrics` and `cards` blocks for a complete dashboard. See [references/html-design-system.md](references/html-design-system.md#present-tool-integration) for the full composition pattern.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
present({
|
|
65
|
-
format: "html", // or "browser" - both work
|
|
66
|
-
title: "System Architecture",
|
|
67
|
-
content: [
|
|
68
|
-
{ type: "metrics", title: "Overview", value: [{ label: "Services", value: "6" }, ...] },
|
|
69
|
-
{ type: "markdown", title: "Architecture Diagram", value: "<div class='arch-diagram'>...(inline SVG + CSS)...</div>" },
|
|
70
|
-
{ type: "cards", title: "Summary", value: [{ title: "Frontend", body: "React SPA" }, ...] }
|
|
71
|
-
]
|
|
72
|
-
})
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## C4 Diagram Levels
|
|
76
|
-
|
|
77
|
-
Select the appropriate level based on the documentation need:
|
|
78
|
-
|
|
79
|
-
| Level | Diagram Type | Audience | Shows | When to Create |
|
|
80
|
-
|-------|-------------|----------|-------|----------------|
|
|
81
|
-
| 1 | **C4Context** | Everyone | System + external actors | Always (required) |
|
|
82
|
-
| 2 | **C4Container** | Technical | Apps, databases, services | Always (required) |
|
|
83
|
-
| 3 | **C4Component** | Developers | Internal components | Only if adds value |
|
|
84
|
-
| 4 | **C4Deployment** | DevOps | Infrastructure nodes | For production systems |
|
|
85
|
-
| - | **C4Dynamic** | Technical | Request flows (numbered) | For complex workflows |
|
|
86
|
-
|
|
87
|
-
**Key Insight:** "Context + Container diagrams are sufficient for most software development teams." Only create Component/Code diagrams when they genuinely add value.
|
|
88
|
-
|
|
89
|
-
## Quick Start Examples
|
|
90
|
-
|
|
91
|
-
### System Context (Level 1)
|
|
92
|
-
```mermaid
|
|
93
|
-
C4Context
|
|
94
|
-
title System Context - Workout Tracker
|
|
95
|
-
|
|
96
|
-
Person(user, "User", "Tracks workouts and exercises")
|
|
97
|
-
System(app, "Workout Tracker", "Vue PWA for tracking strength and CrossFit workouts")
|
|
98
|
-
System_Ext(browser, "Web Browser", "Stores data in IndexedDB")
|
|
99
|
-
|
|
100
|
-
Rel(user, app, "Uses")
|
|
101
|
-
Rel(app, browser, "Persists data to", "IndexedDB")
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Container Diagram (Level 2)
|
|
105
|
-
```mermaid
|
|
106
|
-
C4Container
|
|
107
|
-
title Container Diagram - Workout Tracker
|
|
108
|
-
|
|
109
|
-
Person(user, "User", "Tracks workouts")
|
|
110
|
-
|
|
111
|
-
Container_Boundary(app, "Workout Tracker PWA") {
|
|
112
|
-
Container(spa, "SPA", "Vue 3, TypeScript", "Single-page application")
|
|
113
|
-
Container(pinia, "State Management", "Pinia", "Manages application state")
|
|
114
|
-
ContainerDb(indexeddb, "IndexedDB", "Dexie", "Local workout storage")
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
Rel(user, spa, "Uses")
|
|
118
|
-
Rel(spa, pinia, "Reads/writes state")
|
|
119
|
-
Rel(pinia, indexeddb, "Persists", "Dexie ORM")
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Component Diagram (Level 3)
|
|
123
|
-
```mermaid
|
|
124
|
-
C4Component
|
|
125
|
-
title Component Diagram - Workout Feature
|
|
126
|
-
|
|
127
|
-
Container(views, "Views", "Vue Router pages")
|
|
128
|
-
|
|
129
|
-
Container_Boundary(workout, "Workout Feature") {
|
|
130
|
-
Component(useWorkout, "useWorkout", "Composable", "Workout execution state")
|
|
131
|
-
Component(useTimer, "useTimer", "Composable", "Timer state machine")
|
|
132
|
-
Component(workoutRepo, "WorkoutRepository", "Dexie", "Workout persistence")
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
Rel(views, useWorkout, "Uses")
|
|
136
|
-
Rel(useWorkout, useTimer, "Controls")
|
|
137
|
-
Rel(useWorkout, workoutRepo, "Saves to")
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Dynamic Diagram (Request Flow)
|
|
141
|
-
```mermaid
|
|
142
|
-
C4Dynamic
|
|
143
|
-
title Dynamic Diagram - User Sign In Flow
|
|
144
|
-
|
|
145
|
-
ContainerDb(db, "Database", "PostgreSQL", "User credentials")
|
|
146
|
-
Container(spa, "Single-Page App", "React", "Banking UI")
|
|
147
|
-
|
|
148
|
-
Container_Boundary(api, "API Application") {
|
|
149
|
-
Component(signIn, "Sign In Controller", "Express", "Auth endpoint")
|
|
150
|
-
Component(security, "Security Service", "JWT", "Validates credentials")
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
Rel(spa, signIn, "1. Submit credentials", "JSON/HTTPS")
|
|
154
|
-
Rel(signIn, security, "2. Validate")
|
|
155
|
-
Rel(security, db, "3. Query user", "SQL")
|
|
156
|
-
|
|
157
|
-
UpdateRelStyle(spa, signIn, $textColor="blue", $offsetY="-30")
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Deployment Diagram
|
|
161
|
-
```mermaid
|
|
162
|
-
C4Deployment
|
|
163
|
-
title Deployment Diagram - Production
|
|
164
|
-
|
|
165
|
-
Deployment_Node(browser, "Customer Browser", "Chrome/Firefox") {
|
|
166
|
-
Container(spa, "SPA", "React", "Web application")
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
Deployment_Node(aws, "AWS Cloud", "us-east-1") {
|
|
170
|
-
Deployment_Node(ecs, "ECS Cluster", "Fargate") {
|
|
171
|
-
Container(api, "API Service", "Node.js", "REST API")
|
|
172
|
-
}
|
|
173
|
-
Deployment_Node(rds, "RDS", "db.r5.large") {
|
|
174
|
-
ContainerDb(db, "Database", "PostgreSQL", "Application data")
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
Rel(spa, api, "API calls", "HTTPS")
|
|
179
|
-
Rel(api, db, "Reads/writes", "JDBC")
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## HTML/SVG Format
|
|
183
|
-
|
|
184
|
-
For HTML/SVG output, use the design system and template from the references.
|
|
185
|
-
|
|
186
|
-
The component type registry, color palette, typography, and layout rules are defined in [references/html-design-system.md](references/html-design-system.md). This is the single source of truth - update colors, types, and icons there.
|
|
187
|
-
|
|
188
|
-
Copy and customize [references/html-template.html](references/html-template.html) for each diagram. The template is self-contained and opens directly in any browser.
|
|
189
|
-
|
|
190
|
-
### Component Categories
|
|
191
|
-
|
|
192
|
-
See the design system for the full sub-type registry and icon slots.
|
|
193
|
-
|
|
194
|
-
- Frontend - stroke `#22d3ee`
|
|
195
|
-
- Backend - stroke `#34d399`
|
|
196
|
-
- Data - stroke `#a78bfa`
|
|
197
|
-
- Infrastructure - stroke `#fbbf24`
|
|
198
|
-
- Messaging - stroke `#fb923c`
|
|
199
|
-
- Security - stroke `#fb7185`
|
|
200
|
-
- External - stroke `#94a3b8`
|
|
201
|
-
- Monitoring - stroke `#38bdf8`
|
|
202
|
-
|
|
203
|
-
### Minimal Component Box Example
|
|
204
|
-
|
|
205
|
-
Use the design system's inline SVG component pattern inside the HTML template's main `<svg>`:
|
|
206
|
-
|
|
207
|
-
```svg
|
|
208
|
-
<g class="node backend">
|
|
209
|
-
<rect x="280" y="210" width="190" height="60" rx="6" />
|
|
210
|
-
<text class="c4-tag" x="294" y="226"><<Container>></text>
|
|
211
|
-
<text class="node-title" x="294" y="243">API Service</text>
|
|
212
|
-
<text class="node-subtitle" x="294" y="257">Backend / HTTPS JSON</text>
|
|
213
|
-
</g>
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Element Syntax
|
|
217
|
-
|
|
218
|
-
### People and Systems
|
|
219
|
-
```
|
|
220
|
-
Person(alias, "Label", "Description")
|
|
221
|
-
Person_Ext(alias, "Label", "Description") # External person
|
|
222
|
-
System(alias, "Label", "Description")
|
|
223
|
-
System_Ext(alias, "Label", "Description") # External system
|
|
224
|
-
SystemDb(alias, "Label", "Description") # Database system
|
|
225
|
-
SystemQueue(alias, "Label", "Description") # Queue system
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Containers
|
|
229
|
-
```
|
|
230
|
-
Container(alias, "Label", "Technology", "Description")
|
|
231
|
-
Container_Ext(alias, "Label", "Technology", "Description")
|
|
232
|
-
ContainerDb(alias, "Label", "Technology", "Description")
|
|
233
|
-
ContainerQueue(alias, "Label", "Technology", "Description")
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Components
|
|
237
|
-
```
|
|
238
|
-
Component(alias, "Label", "Technology", "Description")
|
|
239
|
-
Component_Ext(alias, "Label", "Technology", "Description")
|
|
240
|
-
ComponentDb(alias, "Label", "Technology", "Description")
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### Boundaries
|
|
244
|
-
```
|
|
245
|
-
Enterprise_Boundary(alias, "Label") { ... }
|
|
246
|
-
System_Boundary(alias, "Label") { ... }
|
|
247
|
-
Container_Boundary(alias, "Label") { ... }
|
|
248
|
-
Boundary(alias, "Label", "type") { ... }
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Relationships
|
|
252
|
-
```
|
|
253
|
-
Rel(from, to, "Label")
|
|
254
|
-
Rel(from, to, "Label", "Technology")
|
|
255
|
-
BiRel(from, to, "Label") # Bidirectional
|
|
256
|
-
Rel_U(from, to, "Label") # Upward
|
|
257
|
-
Rel_D(from, to, "Label") # Downward
|
|
258
|
-
Rel_L(from, to, "Label") # Leftward
|
|
259
|
-
Rel_R(from, to, "Label") # Rightward
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Deployment Nodes
|
|
263
|
-
```
|
|
264
|
-
Deployment_Node(alias, "Label", "Type", "Description") { ... }
|
|
265
|
-
Node(alias, "Label", "Type", "Description") { ... } # Shorthand
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## Styling and Layout
|
|
269
|
-
|
|
270
|
-
### Layout Configuration
|
|
271
|
-
```
|
|
272
|
-
UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
|
|
273
|
-
```
|
|
274
|
-
- `$c4ShapeInRow` - Number of shapes per row (default: 4)
|
|
275
|
-
- `$c4BoundaryInRow` - Number of boundaries per row (default: 2)
|
|
276
|
-
|
|
277
|
-
### Element Styling
|
|
278
|
-
```
|
|
279
|
-
UpdateElementStyle(alias, $fontColor="red", $bgColor="grey", $borderColor="red")
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Relationship Styling
|
|
283
|
-
```
|
|
284
|
-
UpdateRelStyle(from, to, $textColor="blue", $lineColor="blue", $offsetX="5", $offsetY="-10")
|
|
285
|
-
```
|
|
286
|
-
Use `$offsetX` and `$offsetY` to fix overlapping relationship labels.
|
|
287
|
-
|
|
288
|
-
## Best Practices
|
|
289
|
-
|
|
290
|
-
### Essential Rules
|
|
291
|
-
|
|
292
|
-
1. **Every element must have**: Name, Type, Technology (where applicable), and Description
|
|
293
|
-
2. **Use unidirectional arrows only** - Bidirectional arrows create ambiguity
|
|
294
|
-
3. **Label arrows with action verbs** - "Sends email using", "Reads from", not just "uses"
|
|
295
|
-
4. **Include technology labels** - "JSON/HTTPS", "JDBC", "gRPC"
|
|
296
|
-
5. **Stay under 20 elements per diagram** - Split complex systems into multiple diagrams
|
|
297
|
-
|
|
298
|
-
### Clarity Guidelines
|
|
299
|
-
|
|
300
|
-
1. **Start at Level 1** - Context diagrams help frame the system scope
|
|
301
|
-
2. **One diagram per file** - Keep diagrams focused on a single abstraction level
|
|
302
|
-
3. **Meaningful aliases** - Use descriptive aliases (e.g., `orderService` not `s1`)
|
|
303
|
-
4. **Concise descriptions** - Keep descriptions under 50 characters when possible
|
|
304
|
-
5. **Always include a title** - "System Context diagram for [System Name]"
|
|
305
|
-
|
|
306
|
-
### What to Avoid
|
|
307
|
-
|
|
308
|
-
See [references/common-mistakes.md](references/common-mistakes.md) for detailed anti-patterns:
|
|
309
|
-
- Confusing containers (deployable) vs components (non-deployable)
|
|
310
|
-
- Modeling shared libraries as containers
|
|
311
|
-
- Showing message brokers as single containers instead of individual topics
|
|
312
|
-
- Adding undefined abstraction levels like "subcomponents"
|
|
313
|
-
- Removing type labels to "simplify" diagrams
|
|
314
|
-
|
|
315
|
-
## Microservices Guidelines
|
|
316
|
-
|
|
317
|
-
### Single Team Ownership
|
|
318
|
-
Model each microservice as a **container** (or container group):
|
|
319
|
-
```mermaid
|
|
320
|
-
C4Container
|
|
321
|
-
title Microservices - Single Team
|
|
322
|
-
|
|
323
|
-
System_Boundary(platform, "E-commerce Platform") {
|
|
324
|
-
Container(orderApi, "Order Service", "Spring Boot", "Order processing")
|
|
325
|
-
ContainerDb(orderDb, "Order DB", "PostgreSQL", "Order data")
|
|
326
|
-
Container(inventoryApi, "Inventory Service", "Node.js", "Stock management")
|
|
327
|
-
ContainerDb(inventoryDb, "Inventory DB", "MongoDB", "Stock data")
|
|
328
|
-
}
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Multi-Team Ownership
|
|
332
|
-
Promote microservices to **software systems** when owned by separate teams:
|
|
333
|
-
```mermaid
|
|
334
|
-
C4Context
|
|
335
|
-
title Microservices - Multi-Team
|
|
336
|
-
|
|
337
|
-
Person(customer, "Customer", "Places orders")
|
|
338
|
-
System(orderSystem, "Order System", "Team Alpha")
|
|
339
|
-
System(inventorySystem, "Inventory System", "Team Beta")
|
|
340
|
-
System(paymentSystem, "Payment System", "Team Gamma")
|
|
341
|
-
|
|
342
|
-
Rel(customer, orderSystem, "Places orders")
|
|
343
|
-
Rel(orderSystem, inventorySystem, "Checks stock")
|
|
344
|
-
Rel(orderSystem, paymentSystem, "Processes payment")
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### Event-Driven Architecture
|
|
348
|
-
Show individual topics/queues as containers, NOT a single "Kafka" box:
|
|
349
|
-
```mermaid
|
|
350
|
-
C4Container
|
|
351
|
-
title Event-Driven Architecture
|
|
352
|
-
|
|
353
|
-
Container(orderService, "Order Service", "Java", "Creates orders")
|
|
354
|
-
Container(stockService, "Stock Service", "Java", "Manages inventory")
|
|
355
|
-
ContainerQueue(orderTopic, "order.created", "Kafka", "Order events")
|
|
356
|
-
ContainerQueue(stockTopic, "stock.reserved", "Kafka", "Stock events")
|
|
357
|
-
|
|
358
|
-
Rel(orderService, orderTopic, "Publishes to")
|
|
359
|
-
Rel(stockService, orderTopic, "Subscribes to")
|
|
360
|
-
Rel(stockService, stockTopic, "Publishes to")
|
|
361
|
-
Rel(orderService, stockTopic, "Subscribes to")
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
## Output Location
|
|
365
|
-
|
|
366
|
-
Write architecture documentation to `docs/architecture/` with naming convention:
|
|
367
|
-
- `c4-context.md` - System context diagram
|
|
368
|
-
- `c4-containers.md` - Container diagram
|
|
369
|
-
- `c4-components-{feature}.md` - Component diagrams per feature
|
|
370
|
-
- `c4-deployment.md` - Deployment diagram
|
|
371
|
-
- `c4-dynamic-{flow}.md` - Dynamic diagrams for specific flows
|
|
372
|
-
|
|
373
|
-
## Audience-Appropriate Detail
|
|
374
|
-
|
|
375
|
-
| Audience | Recommended Diagrams |
|
|
376
|
-
|----------|---------------------|
|
|
377
|
-
| Executives | System Context only |
|
|
378
|
-
| Product Managers | Context + Container |
|
|
379
|
-
| Architects | Context + Container + key Components |
|
|
380
|
-
| Developers | All levels as needed |
|
|
381
|
-
| DevOps | Container + Deployment |
|
|
382
|
-
|
|
383
|
-
## References
|
|
384
|
-
|
|
385
|
-
- [references/c4-syntax.md](references/c4-syntax.md) - Complete Mermaid C4 syntax
|
|
386
|
-
- [references/common-mistakes.md](references/common-mistakes.md) - Anti-patterns to avoid
|
|
387
|
-
- [references/advanced-patterns.md](references/advanced-patterns.md) - Microservices, event-driven, deployment
|
|
388
|
-
- [references/html-design-system.md](references/html-design-system.md) - Centralized HTML/SVG design system (types, colors, icons, present integration)
|
|
389
|
-
- [references/html-template.html](references/html-template.html) - Self-contained HTML template for C4 diagrams
|