C4 Architecture Documentation Workflow
Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
[Extended thinking: This workflow implements a complete C4 architecture documentation process following the C4 model (Context, Container, Component, Code). It uses a bottom-up approach, starting from the deepest code directories and working upward, ensuring every code element is documented before synthesizing into higher-level abstractions. The workflow coordinates four specialized C4 agents (Code, Component, Container, Context) to create a complete architectural documentation set that serves both technical and non-technical stakeholders.]
Use this skill when
- Working on c4 architecture documentation workflow tasks or workflows
- Needing guidance, best practices, or checklists for c4 architecture documentation workflow
Do not use this skill when
- The task is unrelated to c4 architecture documentation workflow
- You need a different domain or tool outside this scope
Instructions
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
Overview
This workflow creates comprehensive C4 architecture documentation following the official C4 model by:
- Code Level: Analyzing every subdirectory bottom-up to create code-level documentation
- Component Level: Synthesizing code documentation into logical components within containers
- Container Level: Mapping components to deployment containers with API documentation (shows high-level technology choices)
- Context Level: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)
Note: According to the C4 model, you don't need to use all 4 levels of diagram - the system context and container diagrams are sufficient for most software development teams. This workflow generates all levels for completeness, but teams can choose which levels to use.
All documentation is written to a new C4-Documentation/ directory in the repository root.
Phase 1: Code-Level Documentation (Bottom-Up Analysis)
1.1 Discover All Subdirectories
- Use codebase search to identify all subdirectories in the repository
- Sort directories by depth (deepest first) for bottom-up processing
- Filter out common non-code directories (node_modules, .git, build, dist, etc.)
- Create list of directories to process
1.2 Process Each Directory (Bottom-Up)
For each directory, starting from the deepest:
Use Task tool with subagent_type="c4-architecture::c4-code"
Prompt: |
Analyze the code in directory: [directory_path]
Create comprehensive C4 Code-level documentation following this structure:
- Overview Section:
- Name: [Descriptive name for this code directory]
- Description: [Short description of what this code does]
- Location: [Link to actual directory path relative to repo root]
- Language: [Primary programming language(s) used]
- Purpose: [What this code accomplishes]
- Code Elements Section:
- Document all functions/methods with complete signatures:
- Function name, parameters (with types), return type
- Description of what each function does
- Location (file path and line numbers)
- Dependencies (what this function depends on)
- Document all classes/modules:
- Class name, description, location
- Methods and their signatures
- Dependencies
- Dependencies Section:
- Internal dependencies (other code in this repo)
- External dependencies (libraries, frameworks, services)
- Relationships Section:
- Optional Mermaid diagram if relationships are complex
Save the output as: C4-Documentation/c4-code-[directory-name].md
Use a sanitized directory name (replace / with -, remove special chars) for the filename.
Ensure the documentation includes:
- Complete function signatures with all parameters and types
- Links to actual source code locations
- All dependencies (internal and external)
- Clear, descriptive names and descriptions
Expected output: c4-code-.md file in C4-Documentation/
Context: All files in the directory and its subdirectories
Repeat for every subdirectory until all directories have corresponding c4-code-*.md files.
Phase 2: Component-Level Synthesis
2.1 Analyze All Code-Level Documentation
- Collect all c4-code-*.md files created in Phase 1
- Analyze code structure, dependencies, and relationships
- Identify logical component boundaries based on:
- Domain boundaries (related business functionality)
- Technical boundaries (shared frameworks, libraries)
- Organizational boundaries (team ownership, if evident)
2.2 Create Component Documentation
For each identified component:
Use Task tool with subagent_type="c4-architecture::c4-component"
Prompt: |
Synthesize the following C4 Code-level documentation files into a logical component:
Code files to analyze:
[List of c4-code-*.md file paths]
Create comprehensive C4 Component-level documentation following this structure:
- Overview Section:
- Name: [Component name - descriptive and meaningful]
- Description: [Short description of component purpose]
- Type: [Application, Service, Library, etc.]
- Technology: [Primary technologies used]
- Purpose Section:
- Detailed description of what this component does
- What problems it solves
- Its role in the system
- Software Features Section:
- List all software features provided by this component
- Each feature with a brief description
- Code Elements Section:
- List all c4-code-*.md files contained in this component
- Link to each file with a brief description
- Interfaces Section:
- Document all component interfaces:
- Interface name
- Protocol (REST, GraphQL, gRPC, Events, etc.)
- Description
- Operations (function signatures, endpoints, etc.)
- Dependencies Section:
- Components used (other components this depends on)
- External systems (databases, APIs, services)
- Component Diagram:
- Mermaid diagram showing this component and its relationships
Save the output as: C4-Documentation/c4-component-[component-name].md
Use a sanitized component name for the filename.
Expected output: c4-component-.md file for each component
Context: All relevant c4-code-*.md files for this component
2.3 Create Master Component Index
Use Task tool with subagent_type="c4-architecture::c4-component"
Prompt: |
Create a master component index that lists all components in the system.
Based on all c4-component-*.md files created, generate:
- System Components Section:
- List all components with:
- Component name
- Short description
- Link to component documentation
- Component Relationships Diagram:
- Mermaid diagram showing all components and their relationships
- Show dependencies between components
- Show external system dependencies
Save the output as: C4-Documentation/c4-component.md
Expected output: Master c4-component.md file
Context: All c4-component-*.md files
Phase 3: Container-Level Synthesis
3.1 Analyze Components and Deployment Definitions
- Review all c4-component-*.md files
- Search for deployment/infrastructure definitions:
- Dockerfiles
- Kubernetes manifests (deployments, services, etc.)
- Docker Compose files
- Terraform/CloudFormation configs
- Cloud service definitions (AWS Lambda, Azure Functions, etc.)
- CI/CD pipeline definitions
3.2 Map Components to Containers
Use Task tool with subagent_type="c4-architecture::c4-container"
Prompt: |
Synthesize components into containers based on deployment definitions.
Component documentation:
[List of all c4-component-*.md file paths]
Deployment definitions found:
[List of deployment config files: Dockerfiles, K8s manifests, etc.]
Create comprehensive C4 Container-level documentation following this structure:
- Containers Section (for each container):
- Name: [Container name]
- Description: [Short description of container purpose and deployment]
- Type: [Web Application, API, Database, Message Queue, etc.]
- Technology: [Primary technologies: Node.js, Python, PostgreSQL, etc.]
- Deployment: [Docker, Kubernetes, Cloud Service, etc.]
- Purpose Section (for each container):
- Detailed description of what this container does
- How it's deployed
- Its role in the system
- Components Section (for each container):
- List all components deployed in this container
- Link to component documentation
- Interfaces Section (for each container):
- Document all container APIs and interfaces:
- API/Interface name
- Protocol (REST, GraphQL, gRPC, Events, etc.)
- Description
- Link to OpenAPI/Swagger/API Spec file
- List of endpoints/operations
- API Specifications:
- For each container API, create an OpenAPI 3.1+ specification
- Save as: C4-Documentation/apis/[container-name]-api.yaml
- Include:
- All endpoints with methods (GET, POST, etc.)
- Request/response schemas
- Authentication requirements
- Error responses
- Dependencies Section (for each container):
- Containers used (other containers this depends on)
- External systems (databases, third-party APIs, etc.)
- Communication protocols
- Infrastructure Section (for each container):
- Link to deployment config (Dockerfile, K8s manifest, etc.)
- Scaling strategy
- Resource requirements (CPU, memory, storage)
- Container Diagram:
- Mermaid diagram showing all containers and their relationships
- Show communication protocols
- Show external system dependencies
Save the output as: C4-Documentation/c4-container.md
Expected output: c4-container.md with all containers and API specifications
Context: All component documentation and deployment definitions
Phase 4: Context-Level Documentation
4.1 Analyze System Documentation
- Review container and component documentation
- Search for system documentation:
- README files
- Architecture documentation
- Requirements documents
- Design documents
- Test files (to understand system behavior)
- API documentation
- User documentation
4.2 Create Context Documentation
Use Task tool with subagent_type="c4-architecture::c4-context"
Prompt: |
Create comprehensive C4 Context-level documentation for the system.
Container documentation: C4-Documentation/c4-container.md
Component documentation: C4-Documentation/c4-component.md
System documentation: [List of README, architecture docs, requirements, etc.]
Test files: [List of test files that show system behavior]
Create comprehensive C4 Context-level documentation following this structure:
- System Overview Section:
- Short Description: [One-sentence description of what the system does]
- Long Description: [Detailed description of system purpose, capabilities, problems solved]
- Personas Section:
- For each persona (human users and programmatic "users"):
- Persona name
- Type (Human User / Programmatic User / External System)
- Description (who they are, what they need)
- Goals (what they want to achieve)
- Key features used
- System Features Section:
- For each high-level feature:
- Feature name
- Description (what this feature does)
- Users (which personas use this feature)
- Link to user journey map
- User Journeys Section:
- For each key feature and persona:
- Journey name: [Feature Name] - [Persona Name] Journey
- Step-by-step journey:
- ...
- Include all system touchpoints
- For programmatic users (external systems, APIs):
- Integration journey with step-by-step process
- External Systems and Dependencies Section:
- For each external system:
- System name
- Type (Database, API, Service, Message Queue, etc.)
- Description (what it provides)
- Integration type (API, Events, File Transfer, etc.)
- Purpose (why the system depends on this)
- System Context Diagram:
- Mermaid C4Context diagram showing:
- The system (as a box in the center)
- All personas (users) around it
- All external systems around it
- Relationships and data flows
- Use C4Context notation for proper C4 diagram
- Related Documentation Section:
- Links to container documentation
- Links to component documentation
Save the output as: C4-Documentation/c4-context.md
Ensure the documentation is:
- Understandable by non-technical stakeholders
- Focuses on system purpose, users, and external relationships
- Includes comprehensive user journey maps
- Identifies all external systems and dependencies
Expected output: c4-context.md with complete system context
Context: All container, component, and system documentation
Configuration Options
target_directory: Root directory to analyze (default: current repository root)
exclude_patterns: Patterns to exclude (default: node_modules, .git, build, dist, etc.)
output_directory: Where to write C4 documentation (default: C4-Documentation/)
include_tests: Whether to analyze test files for context (default: true)
api_format: Format for API specs (default: openapi)
Success Criteria
- ✅ Every subdirectory has a corresponding c4-code-*.md file
- ✅ All code-level documentation includes complete function signatures
- ✅ Components are logically grouped with clear boundaries
- ✅ All components have interface documentation
- ✅ Master component index created with relationship diagram
- ✅ Containers map to actual deployment units
- ✅ All container APIs documented with OpenAPI/Swagger specs
- ✅ Container diagram shows deployment architecture
- ✅ System context includes all personas (human and programmatic)
- ✅ User journeys documented for all key features
- ✅ All external systems and dependencies identified
- ✅ Context diagram shows system, users, and external systems
- ✅ Documentation is organized in C4-Documentation/ directory
Output Structure
C4-Documentation/
├── c4-code-*.md # Code-level docs (one per directory)
├── c4-component-*.md # Component-level docs (one per component)
├── c4-component.md # Master component index
├── c4-container.md # Container-level docs
├── c4-context.md # Context-level docs
└── apis/ # API specifications
├── [container]-api.yaml # OpenAPI specs for each container
└── ...
Coordination Notes
- Bottom-up processing: Process directories from deepest to shallowest
- Incremental synthesis: Each level builds on the previous level's documentation
- Complete coverage: Every directory must have code-level documentation before synthesis
- Link consistency: All documentation files link to each other appropriately
- API documentation: Container APIs must have OpenAPI/Swagger specifications
- Stakeholder-friendly: Context documentation should be understandable by non-technical stakeholders
- Mermaid diagrams: Use proper C4 Mermaid notation for all diagrams
Example Usage
/c4-architecture:c4-architecture
This will:
- Walk through all subdirectories bottom-up
- Create c4-code-*.md for each directory
- Synthesize into components
- Map to containers with API docs
- Create system context with personas and journeys
All documentation written to: C4-Documentation/
1---2name: c4-architecture-c4-architecture3description: Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.4---5
6# C4 Architecture Documentation Workflow
7
8Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
9
10[Extended thinking: This workflow implements a complete C4 architecture documentation process following the C4 model (Context, Container, Component, Code). It uses a bottom-up approach, starting from the deepest code directories and working upward, ensuring every code element is documented before synthesizing into higher-level abstractions. The workflow coordinates four specialized C4 agents (Code, Component, Container, Context) to create a complete architectural documentation set that serves both technical and non-technical stakeholders.]
11
12## Use this skill when
13
14- Working on c4 architecture documentation workflow tasks or workflows
15- Needing guidance, best practices, or checklists for c4 architecture documentation workflow
16
17## Do not use this skill when
18
19- The task is unrelated to c4 architecture documentation workflow
20- You need a different domain or tool outside this scope
21
22## Instructions
23
24- Clarify goals, constraints, and required inputs.
25- Apply relevant best practices and validate outcomes.
26- Provide actionable steps and verification.
27
28## Overview
29
30This workflow creates comprehensive C4 architecture documentation following the [official C4 model](https://c4model.com/diagrams) by:
31
321. **Code Level**: Analyzing every subdirectory bottom-up to create code-level documentation
332. **Component Level**: Synthesizing code documentation into logical components within containers
343. **Container Level**: Mapping components to deployment containers with API documentation (shows high-level technology choices)
354. **Context Level**: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)
36
37**Note**: According to the [C4 model](https://c4model.com/diagrams), you don't need to use all 4 levels of diagram - the system context and container diagrams are sufficient for most software development teams. This workflow generates all levels for completeness, but teams can choose which levels to use.
38
39All documentation is written to a new `C4-Documentation/` directory in the repository root.
40
41## Phase 1: Code-Level Documentation (Bottom-Up Analysis)
42
43### 1.1 Discover All Subdirectories
44
45- Use codebase search to identify all subdirectories in the repository
46- Sort directories by depth (deepest first) for bottom-up processing
47- Filter out common non-code directories (node_modules, .git, build, dist, etc.)
48- Create list of directories to process
49
50### 1.2 Process Each Directory (Bottom-Up)
51
52For each directory, starting from the deepest:
53
54- Use Task tool with subagent_type="c4-architecture::c4-code"
55- Prompt: |
56 Analyze the code in directory: [directory_path]
57
58 Create comprehensive C4 Code-level documentation following this structure:
59 1. **Overview Section**:
60 - Name: [Descriptive name for this code directory]
61 - Description: [Short description of what this code does]
62 - Location: [Link to actual directory path relative to repo root]
63 - Language: [Primary programming language(s) used]
64 - Purpose: [What this code accomplishes]
65 2. **Code Elements Section**:
66 - Document all functions/methods with complete signatures:
67 - Function name, parameters (with types), return type
68 - Description of what each function does
69 - Location (file path and line numbers)
70 - Dependencies (what this function depends on)
71 - Document all classes/modules:
72 - Class name, description, location
73 - Methods and their signatures
74 - Dependencies
75 3. **Dependencies Section**:
76 - Internal dependencies (other code in this repo)
77 - External dependencies (libraries, frameworks, services)
78 4. **Relationships Section**:
79 - Optional Mermaid diagram if relationships are complex
80
81 Save the output as: C4-Documentation/c4-code-[directory-name].md
82 Use a sanitized directory name (replace / with -, remove special chars) for the filename.
83
84 Ensure the documentation includes:
85 - Complete function signatures with all parameters and types
86 - Links to actual source code locations
87 - All dependencies (internal and external)
88 - Clear, descriptive names and descriptions
89
90- Expected output: c4-code-<directory-name>.md file in C4-Documentation/
91- Context: All files in the directory and its subdirectories
92
93**Repeat for every subdirectory** until all directories have corresponding c4-code-\*.md files.
94
95## Phase 2: Component-Level Synthesis
96
97### 2.1 Analyze All Code-Level Documentation
98
99- Collect all c4-code-\*.md files created in Phase 1
100- Analyze code structure, dependencies, and relationships
101- Identify logical component boundaries based on:
102 - Domain boundaries (related business functionality)
103 - Technical boundaries (shared frameworks, libraries)
104 - Organizational boundaries (team ownership, if evident)
105
106### 2.2 Create Component Documentation
107
108For each identified component:
109
110- Use Task tool with subagent_type="c4-architecture::c4-component"
111- Prompt: |
112 Synthesize the following C4 Code-level documentation files into a logical component:
113
114 Code files to analyze:
115 [List of c4-code-*.md file paths]
116
117 Create comprehensive C4 Component-level documentation following this structure:
118 1. **Overview Section**:
119 - Name: [Component name - descriptive and meaningful]
120 - Description: [Short description of component purpose]
121 - Type: [Application, Service, Library, etc.]
122 - Technology: [Primary technologies used]
123 2. **Purpose Section**:
124 - Detailed description of what this component does
125 - What problems it solves
126 - Its role in the system
127 3. **Software Features Section**:
128 - List all software features provided by this component
129 - Each feature with a brief description
130 4. **Code Elements Section**:
131 - List all c4-code-\*.md files contained in this component
132 - Link to each file with a brief description
133 5. **Interfaces Section**:
134 - Document all component interfaces:
135 - Interface name
136 - Protocol (REST, GraphQL, gRPC, Events, etc.)
137 - Description
138 - Operations (function signatures, endpoints, etc.)
139 6. **Dependencies Section**:
140 - Components used (other components this depends on)
141 - External systems (databases, APIs, services)
142 7. **Component Diagram**:
143 - Mermaid diagram showing this component and its relationships
144
145 Save the output as: C4-Documentation/c4-component-[component-name].md
146 Use a sanitized component name for the filename.
147
148- Expected output: c4-component-<name>.md file for each component
149- Context: All relevant c4-code-\*.md files for this component
150
151### 2.3 Create Master Component Index
152
153- Use Task tool with subagent_type="c4-architecture::c4-component"
154- Prompt: |
155 Create a master component index that lists all components in the system.
156
157 Based on all c4-component-\*.md files created, generate:
158 1. **System Components Section**:
159 - List all components with:
160 - Component name
161 - Short description
162 - Link to component documentation
163 2. **Component Relationships Diagram**:
164 - Mermaid diagram showing all components and their relationships
165 - Show dependencies between components
166 - Show external system dependencies
167
168 Save the output as: C4-Documentation/c4-component.md
169
170- Expected output: Master c4-component.md file
171- Context: All c4-component-\*.md files
172
173## Phase 3: Container-Level Synthesis
174
175### 3.1 Analyze Components and Deployment Definitions
176
177- Review all c4-component-\*.md files
178- Search for deployment/infrastructure definitions:
179 - Dockerfiles
180 - Kubernetes manifests (deployments, services, etc.)
181 - Docker Compose files
182 - Terraform/CloudFormation configs
183 - Cloud service definitions (AWS Lambda, Azure Functions, etc.)
184 - CI/CD pipeline definitions
185
186### 3.2 Map Components to Containers
187
188- Use Task tool with subagent_type="c4-architecture::c4-container"
189- Prompt: |
190 Synthesize components into containers based on deployment definitions.
191
192 Component documentation:
193 [List of all c4-component-*.md file paths]
194
195 Deployment definitions found:
196 [List of deployment config files: Dockerfiles, K8s manifests, etc.]
197
198 Create comprehensive C4 Container-level documentation following this structure:
199 1. **Containers Section** (for each container):
200 - Name: [Container name]
201 - Description: [Short description of container purpose and deployment]
202 - Type: [Web Application, API, Database, Message Queue, etc.]
203 - Technology: [Primary technologies: Node.js, Python, PostgreSQL, etc.]
204 - Deployment: [Docker, Kubernetes, Cloud Service, etc.]
205 2. **Purpose Section** (for each container):
206 - Detailed description of what this container does
207 - How it's deployed
208 - Its role in the system
209 3. **Components Section** (for each container):
210 - List all components deployed in this container
211 - Link to component documentation
212 4. **Interfaces Section** (for each container):
213 - Document all container APIs and interfaces:
214 - API/Interface name
215 - Protocol (REST, GraphQL, gRPC, Events, etc.)
216 - Description
217 - Link to OpenAPI/Swagger/API Spec file
218 - List of endpoints/operations
219 5. **API Specifications**:
220 - For each container API, create an OpenAPI 3.1+ specification
221 - Save as: C4-Documentation/apis/[container-name]-api.yaml
222 - Include:
223 - All endpoints with methods (GET, POST, etc.)
224 - Request/response schemas
225 - Authentication requirements
226 - Error responses
227 6. **Dependencies Section** (for each container):
228 - Containers used (other containers this depends on)
229 - External systems (databases, third-party APIs, etc.)
230 - Communication protocols
231 7. **Infrastructure Section** (for each container):
232 - Link to deployment config (Dockerfile, K8s manifest, etc.)
233 - Scaling strategy
234 - Resource requirements (CPU, memory, storage)
235 8. **Container Diagram**:
236 - Mermaid diagram showing all containers and their relationships
237 - Show communication protocols
238 - Show external system dependencies
239
240 Save the output as: C4-Documentation/c4-container.md
241
242- Expected output: c4-container.md with all containers and API specifications
243- Context: All component documentation and deployment definitions
244
245## Phase 4: Context-Level Documentation
246
247### 4.1 Analyze System Documentation
248
249- Review container and component documentation
250- Search for system documentation:
251 - README files
252 - Architecture documentation
253 - Requirements documents
254 - Design documents
255 - Test files (to understand system behavior)
256 - API documentation
257 - User documentation
258
259### 4.2 Create Context Documentation
260
261- Use Task tool with subagent_type="c4-architecture::c4-context"
262- Prompt: |
263 Create comprehensive C4 Context-level documentation for the system.
264
265 Container documentation: C4-Documentation/c4-container.md
266 Component documentation: C4-Documentation/c4-component.md
267 System documentation: [List of README, architecture docs, requirements, etc.]
268 Test files: [List of test files that show system behavior]
269
270 Create comprehensive C4 Context-level documentation following this structure:
271 1. **System Overview Section**:
272 - Short Description: [One-sentence description of what the system does]
273 - Long Description: [Detailed description of system purpose, capabilities, problems solved]
274 2. **Personas Section**:
275 - For each persona (human users and programmatic "users"):
276 - Persona name
277 - Type (Human User / Programmatic User / External System)
278 - Description (who they are, what they need)
279 - Goals (what they want to achieve)
280 - Key features used
281 3. **System Features Section**:
282 - For each high-level feature:
283 - Feature name
284 - Description (what this feature does)
285 - Users (which personas use this feature)
286 - Link to user journey map
287 4. **User Journeys Section**:
288 - For each key feature and persona:
289 - Journey name: [Feature Name] - [Persona Name] Journey
290 - Step-by-step journey:
291 1. [Step 1]: [Description]
292 2. [Step 2]: [Description]
293 ...
294 - Include all system touchpoints
295 - For programmatic users (external systems, APIs):
296 - Integration journey with step-by-step process
297 5. **External Systems and Dependencies Section**:
298 - For each external system:
299 - System name
300 - Type (Database, API, Service, Message Queue, etc.)
301 - Description (what it provides)
302 - Integration type (API, Events, File Transfer, etc.)
303 - Purpose (why the system depends on this)
304 6. **System Context Diagram**:
305 - Mermaid C4Context diagram showing:
306 - The system (as a box in the center)
307 - All personas (users) around it
308 - All external systems around it
309 - Relationships and data flows
310 - Use C4Context notation for proper C4 diagram
311 7. **Related Documentation Section**:
312 - Links to container documentation
313 - Links to component documentation
314
315 Save the output as: C4-Documentation/c4-context.md
316
317 Ensure the documentation is:
318 - Understandable by non-technical stakeholders
319 - Focuses on system purpose, users, and external relationships
320 - Includes comprehensive user journey maps
321 - Identifies all external systems and dependencies
322
323- Expected output: c4-context.md with complete system context
324- Context: All container, component, and system documentation
325
326## Configuration Options
327
328- `target_directory`: Root directory to analyze (default: current repository root)
329- `exclude_patterns`: Patterns to exclude (default: node_modules, .git, build, dist, etc.)
330- `output_directory`: Where to write C4 documentation (default: C4-Documentation/)
331- `include_tests`: Whether to analyze test files for context (default: true)
332- `api_format`: Format for API specs (default: openapi)
333
334## Success Criteria
335
336- ✅ Every subdirectory has a corresponding c4-code-\*.md file
337- ✅ All code-level documentation includes complete function signatures
338- ✅ Components are logically grouped with clear boundaries
339- ✅ All components have interface documentation
340- ✅ Master component index created with relationship diagram
341- ✅ Containers map to actual deployment units
342- ✅ All container APIs documented with OpenAPI/Swagger specs
343- ✅ Container diagram shows deployment architecture
344- ✅ System context includes all personas (human and programmatic)
345- ✅ User journeys documented for all key features
346- ✅ All external systems and dependencies identified
347- ✅ Context diagram shows system, users, and external systems
348- ✅ Documentation is organized in C4-Documentation/ directory
349
350## Output Structure
351
352```
353C4-Documentation/
354├── c4-code-*.md # Code-level docs (one per directory)
355├── c4-component-*.md # Component-level docs (one per component)
356├── c4-component.md # Master component index
357├── c4-container.md # Container-level docs
358├── c4-context.md # Context-level docs
359└── apis/ # API specifications
360 ├── [container]-api.yaml # OpenAPI specs for each container
361 └── ...
362```
363
364## Coordination Notes
365
366- **Bottom-up processing**: Process directories from deepest to shallowest
367- **Incremental synthesis**: Each level builds on the previous level's documentation
368- **Complete coverage**: Every directory must have code-level documentation before synthesis
369- **Link consistency**: All documentation files link to each other appropriately
370- **API documentation**: Container APIs must have OpenAPI/Swagger specifications
371- **Stakeholder-friendly**: Context documentation should be understandable by non-technical stakeholders
372- **Mermaid diagrams**: Use proper C4 Mermaid notation for all diagrams
373
374## Example Usage
375
376```bash
377/c4-architecture:c4-architecture
378```
379
380This will:
381
3821. Walk through all subdirectories bottom-up
3832. Create c4-code-\*.md for each directory
3843. Synthesize into components
3854. Map to containers with API docs
3865. Create system context with personas and journeys
387
388All documentation written to: C4-Documentation/