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.
- If detailed examples are required, open
resources/implementation-playbook.md.
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="general-purpose"
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="general-purpose"
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="general-purpose"
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="general-purpose"
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="general-purpose"
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."4risk: unknown5source: community6---78# C4 Architecture Documentation Workflow910Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.1112[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.]1314## Use this skill when1516- Working on c4 architecture documentation workflow tasks or workflows17- Needing guidance, best practices, or checklists for c4 architecture documentation workflow1819## Do not use this skill when2021- The task is unrelated to c4 architecture documentation workflow22- You need a different domain or tool outside this scope2324## Instructions2526- Clarify goals, constraints, and required inputs.27- Apply relevant best practices and validate outcomes.28- Provide actionable steps and verification.29- If detailed examples are required, open `resources/implementation-playbook.md`.3031## Overview3233This workflow creates comprehensive C4 architecture documentation following the [official C4 model](https://c4model.com/diagrams) by:34351. **Code Level**: Analyzing every subdirectory bottom-up to create code-level documentation362. **Component Level**: Synthesizing code documentation into logical components within containers373. **Container Level**: Mapping components to deployment containers with API documentation (shows high-level technology choices)384. **Context Level**: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)3940**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.4142All documentation is written to a new `C4-Documentation/` directory in the repository root.4344## Phase 1: Code-Level Documentation (Bottom-Up Analysis)4546### 1.1 Discover All Subdirectories4748- Use codebase search to identify all subdirectories in the repository49- Sort directories by depth (deepest first) for bottom-up processing50- Filter out common non-code directories (node_modules, .git, build, dist, etc.)51- Create list of directories to process5253### 1.2 Process Each Directory (Bottom-Up)5455For each directory, starting from the deepest:5657- Use Task tool with subagent_type="general-purpose"58- Prompt: |59 Analyze the code in directory: [directory_path]6061 Create comprehensive C4 Code-level documentation following this structure:62 1. **Overview Section**:63 - Name: [Descriptive name for this code directory]64 - Description: [Short description of what this code does]65 - Location: [Link to actual directory path relative to repo root]66 - Language: [Primary programming language(s) used]67 - Purpose: [What this code accomplishes]68 2. **Code Elements Section**:69 - Document all functions/methods with complete signatures:70 - Function name, parameters (with types), return type71 - Description of what each function does72 - Location (file path and line numbers)73 - Dependencies (what this function depends on)74 - Document all classes/modules:75 - Class name, description, location76 - Methods and their signatures77 - Dependencies78 3. **Dependencies Section**:79 - Internal dependencies (other code in this repo)80 - External dependencies (libraries, frameworks, services)81 4. **Relationships Section**:82 - Optional Mermaid diagram if relationships are complex8384 Save the output as: C4-Documentation/c4-code-[directory-name].md85 Use a sanitized directory name (replace / with -, remove special chars) for the filename.8687 Ensure the documentation includes:88 - Complete function signatures with all parameters and types89 - Links to actual source code locations90 - All dependencies (internal and external)91 - Clear, descriptive names and descriptions9293- Expected output: c4-code-<directory-name>.md file in C4-Documentation/94- Context: All files in the directory and its subdirectories9596**Repeat for every subdirectory** until all directories have corresponding c4-code-\*.md files.9798## Phase 2: Component-Level Synthesis99100### 2.1 Analyze All Code-Level Documentation101102- Collect all c4-code-\*.md files created in Phase 1103- Analyze code structure, dependencies, and relationships104- Identify logical component boundaries based on:105 - Domain boundaries (related business functionality)106 - Technical boundaries (shared frameworks, libraries)107 - Organizational boundaries (team ownership, if evident)108109### 2.2 Create Component Documentation110111For each identified component:112113- Use Task tool with subagent_type="general-purpose"114- Prompt: |115 Synthesize the following C4 Code-level documentation files into a logical component:116117 Code files to analyze:118 [List of c4-code-*.md file paths]119120 Create comprehensive C4 Component-level documentation following this structure:121 1. **Overview Section**:122 - Name: [Component name - descriptive and meaningful]123 - Description: [Short description of component purpose]124 - Type: [Application, Service, Library, etc.]125 - Technology: [Primary technologies used]126 2. **Purpose Section**:127 - Detailed description of what this component does128 - What problems it solves129 - Its role in the system130 3. **Software Features Section**:131 - List all software features provided by this component132 - Each feature with a brief description133 4. **Code Elements Section**:134 - List all c4-code-\*.md files contained in this component135 - Link to each file with a brief description136 5. **Interfaces Section**:137 - Document all component interfaces:138 - Interface name139 - Protocol (REST, GraphQL, gRPC, Events, etc.)140 - Description141 - Operations (function signatures, endpoints, etc.)142 6. **Dependencies Section**:143 - Components used (other components this depends on)144 - External systems (databases, APIs, services)145 7. **Component Diagram**:146 - Mermaid diagram showing this component and its relationships147148 Save the output as: C4-Documentation/c4-component-[component-name].md149 Use a sanitized component name for the filename.150151- Expected output: c4-component-<name>.md file for each component152- Context: All relevant c4-code-\*.md files for this component153154### 2.3 Create Master Component Index155156- Use Task tool with subagent_type="general-purpose"157- Prompt: |158 Create a master component index that lists all components in the system.159160 Based on all c4-component-\*.md files created, generate:161 1. **System Components Section**:162 - List all components with:163 - Component name164 - Short description165 - Link to component documentation166 2. **Component Relationships Diagram**:167 - Mermaid diagram showing all components and their relationships168 - Show dependencies between components169 - Show external system dependencies170171 Save the output as: C4-Documentation/c4-component.md172173- Expected output: Master c4-component.md file174- Context: All c4-component-\*.md files175176## Phase 3: Container-Level Synthesis177178### 3.1 Analyze Components and Deployment Definitions179180- Review all c4-component-\*.md files181- Search for deployment/infrastructure definitions:182 - Dockerfiles183 - Kubernetes manifests (deployments, services, etc.)184 - Docker Compose files185 - Terraform/CloudFormation configs186 - Cloud service definitions (AWS Lambda, Azure Functions, etc.)187 - CI/CD pipeline definitions188189### 3.2 Map Components to Containers190191- Use Task tool with subagent_type="general-purpose"192- Prompt: |193 Synthesize components into containers based on deployment definitions.194195 Component documentation:196 [List of all c4-component-*.md file paths]197198 Deployment definitions found:199 [List of deployment config files: Dockerfiles, K8s manifests, etc.]200201 Create comprehensive C4 Container-level documentation following this structure:202 1. **Containers Section** (for each container):203 - Name: [Container name]204 - Description: [Short description of container purpose and deployment]205 - Type: [Web Application, API, Database, Message Queue, etc.]206 - Technology: [Primary technologies: Node.js, Python, PostgreSQL, etc.]207 - Deployment: [Docker, Kubernetes, Cloud Service, etc.]208 2. **Purpose Section** (for each container):209 - Detailed description of what this container does210 - How it's deployed211 - Its role in the system212 3. **Components Section** (for each container):213 - List all components deployed in this container214 - Link to component documentation215 4. **Interfaces Section** (for each container):216 - Document all container APIs and interfaces:217 - API/Interface name218 - Protocol (REST, GraphQL, gRPC, Events, etc.)219 - Description220 - Link to OpenAPI/Swagger/API Spec file221 - List of endpoints/operations222 5. **API Specifications**:223 - For each container API, create an OpenAPI 3.1+ specification224 - Save as: C4-Documentation/apis/[container-name]-api.yaml225 - Include:226 - All endpoints with methods (GET, POST, etc.)227 - Request/response schemas228 - Authentication requirements229 - Error responses230 6. **Dependencies Section** (for each container):231 - Containers used (other containers this depends on)232 - External systems (databases, third-party APIs, etc.)233 - Communication protocols234 7. **Infrastructure Section** (for each container):235 - Link to deployment config (Dockerfile, K8s manifest, etc.)236 - Scaling strategy237 - Resource requirements (CPU, memory, storage)238 8. **Container Diagram**:239 - Mermaid diagram showing all containers and their relationships240 - Show communication protocols241 - Show external system dependencies242243 Save the output as: C4-Documentation/c4-container.md244245- Expected output: c4-container.md with all containers and API specifications246- Context: All component documentation and deployment definitions247248## Phase 4: Context-Level Documentation249250### 4.1 Analyze System Documentation251252- Review container and component documentation253- Search for system documentation:254 - README files255 - Architecture documentation256 - Requirements documents257 - Design documents258 - Test files (to understand system behavior)259 - API documentation260 - User documentation261262### 4.2 Create Context Documentation263264- Use Task tool with subagent_type="general-purpose"265- Prompt: |266 Create comprehensive C4 Context-level documentation for the system.267268 Container documentation: C4-Documentation/c4-container.md269 Component documentation: C4-Documentation/c4-component.md270 System documentation: [List of README, architecture docs, requirements, etc.]271 Test files: [List of test files that show system behavior]272273 Create comprehensive C4 Context-level documentation following this structure:274 1. **System Overview Section**:275 - Short Description: [One-sentence description of what the system does]276 - Long Description: [Detailed description of system purpose, capabilities, problems solved]277 2. **Personas Section**:278 - For each persona (human users and programmatic "users"):279 - Persona name280 - Type (Human User / Programmatic User / External System)281 - Description (who they are, what they need)282 - Goals (what they want to achieve)283 - Key features used284 3. **System Features Section**:285 - For each high-level feature:286 - Feature name287 - Description (what this feature does)288 - Users (which personas use this feature)289 - Link to user journey map290 4. **User Journeys Section**:291 - For each key feature and persona:292 - Journey name: [Feature Name] - [Persona Name] Journey293 - Step-by-step journey:294 1. [Step 1]: [Description]295 2. [Step 2]: [Description]296 ...297 - Include all system touchpoints298 - For programmatic users (external systems, APIs):299 - Integration journey with step-by-step process300 5. **External Systems and Dependencies Section**:301 - For each external system:302 - System name303 - Type (Database, API, Service, Message Queue, etc.)304 - Description (what it provides)305 - Integration type (API, Events, File Transfer, etc.)306 - Purpose (why the system depends on this)307 6. **System Context Diagram**:308 - Mermaid C4Context diagram showing:309 - The system (as a box in the center)310 - All personas (users) around it311 - All external systems around it312 - Relationships and data flows313 - Use C4Context notation for proper C4 diagram314 7. **Related Documentation Section**:315 - Links to container documentation316 - Links to component documentation317318 Save the output as: C4-Documentation/c4-context.md319320 Ensure the documentation is:321 - Understandable by non-technical stakeholders322 - Focuses on system purpose, users, and external relationships323 - Includes comprehensive user journey maps324 - Identifies all external systems and dependencies325326- Expected output: c4-context.md with complete system context327- Context: All container, component, and system documentation328329## Configuration Options330331- `target_directory`: Root directory to analyze (default: current repository root)332- `exclude_patterns`: Patterns to exclude (default: node_modules, .git, build, dist, etc.)333- `output_directory`: Where to write C4 documentation (default: C4-Documentation/)334- `include_tests`: Whether to analyze test files for context (default: true)335- `api_format`: Format for API specs (default: openapi)336337## Success Criteria338339- ✅ Every subdirectory has a corresponding c4-code-\*.md file340- ✅ All code-level documentation includes complete function signatures341- ✅ Components are logically grouped with clear boundaries342- ✅ All components have interface documentation343- ✅ Master component index created with relationship diagram344- ✅ Containers map to actual deployment units345- ✅ All container APIs documented with OpenAPI/Swagger specs346- ✅ Container diagram shows deployment architecture347- ✅ System context includes all personas (human and programmatic)348- ✅ User journeys documented for all key features349- ✅ All external systems and dependencies identified350- ✅ Context diagram shows system, users, and external systems351- ✅ Documentation is organized in C4-Documentation/ directory352353## Output Structure354355```356C4-Documentation/357├── c4-code-*.md # Code-level docs (one per directory)358├── c4-component-*.md # Component-level docs (one per component)359├── c4-component.md # Master component index360├── c4-container.md # Container-level docs361├── c4-context.md # Context-level docs362└── apis/ # API specifications363 ├── [container]-api.yaml # OpenAPI specs for each container364 └── ...365```366367## Coordination Notes368369- **Bottom-up processing**: Process directories from deepest to shallowest370- **Incremental synthesis**: Each level builds on the previous level's documentation371- **Complete coverage**: Every directory must have code-level documentation before synthesis372- **Link consistency**: All documentation files link to each other appropriately373- **API documentation**: Container APIs must have OpenAPI/Swagger specifications374- **Stakeholder-friendly**: Context documentation should be understandable by non-technical stakeholders375- **Mermaid diagrams**: Use proper C4 Mermaid notation for all diagrams376377## Example Usage378379```bash380/c4-architecture:c4-architecture381```382383This will:3843851. Walk through all subdirectories bottom-up3862. Create c4-code-\*.md for each directory3873. Synthesize into components3884. Map to containers with API docs3895. Create system context with personas and journeys390391All documentation written to: C4-Documentation/