name: c4-architecture-c4-architecture
description: Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
tags: [architecture]
Platform Note: This skill was designed for multi-agent execution. Perplexity Computer handles orchestration automatically — treat sub-agent instructions as sequential steps to complete thoroughly.
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-architecture-33description: <!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->4---5<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->6---7name: c4-architecture-c4-architecture8description: Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.9tags: [architecture]10---1112> **Platform Note:** This skill was designed for multi-agent execution. Perplexity Computer handles orchestration automatically — treat sub-agent instructions as sequential steps to complete thoroughly.1314# C4 Architecture Documentation Workflow1516Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.1718[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.]1920## Use this skill when2122- Working on c4 architecture documentation workflow tasks or workflows23- Needing guidance, best practices, or checklists for c4 architecture documentation workflow2425## Do not use this skill when2627- The task is unrelated to c4 architecture documentation workflow28- You need a different domain or tool outside this scope2930## Instructions3132- Clarify goals, constraints, and required inputs.33- Apply relevant best practices and validate outcomes.34- Provide actionable steps and verification.3536## Overview3738This workflow creates comprehensive C4 architecture documentation following the [official C4 model](https://c4model.com/diagrams) by:39401. **Code Level**: Analyzing every subdirectory bottom-up to create code-level documentation412. **Component Level**: Synthesizing code documentation into logical components within containers423. **Container Level**: Mapping components to deployment containers with API documentation (shows high-level technology choices)434. **Context Level**: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)4445**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.4647All documentation is written to a new `C4-Documentation/` directory in the repository root.4849## Phase 1: Code-Level Documentation (Bottom-Up Analysis)5051### 1.1 Discover All Subdirectories5253- Use codebase search to identify all subdirectories in the repository54- Sort directories by depth (deepest first) for bottom-up processing55- Filter out common non-code directories (node_modules, .git, build, dist, etc.)56- Create list of directories to process5758### 1.2 Process Each Directory (Bottom-Up)5960For each directory, starting from the deepest:6162- Use Task tool with subagent_type="c4-architecture::c4-code"63- Prompt: |64 Analyze the code in directory: [directory_path]6566 Create comprehensive C4 Code-level documentation following this structure:67 1. **Overview Section**:68 - Name: [Descriptive name for this code directory]69 - Description: [Short description of what this code does]70 - Location: [Link to actual directory path relative to repo root]71 - Language: [Primary programming language(s) used]72 - Purpose: [What this code accomplishes]73 2. **Code Elements Section**:74 - Document all functions/methods with complete signatures:75 - Function name, parameters (with types), return type76 - Description of what each function does77 - Location (file path and line numbers)78 - Dependencies (what this function depends on)79 - Document all classes/modules:80 - Class name, description, location81 - Methods and their signatures82 - Dependencies83 3. **Dependencies Section**:84 - Internal dependencies (other code in this repo)85 - External dependencies (libraries, frameworks, services)86 4. **Relationships Section**:87 - Optional Mermaid diagram if relationships are complex8889 Save the output as: C4-Documentation/c4-code-[directory-name].md90 Use a sanitized directory name (replace / with -, remove special chars) for the filename.9192 Ensure the documentation includes:93 - Complete function signatures with all parameters and types94 - Links to actual source code locations95 - All dependencies (internal and external)96 - Clear, descriptive names and descriptions9798- Expected output: c4-code-<directory-name>.md file in C4-Documentation/99- Context: All files in the directory and its subdirectories100101**Repeat for every subdirectory** until all directories have corresponding c4-code-\*.md files.102103## Phase 2: Component-Level Synthesis104105### 2.1 Analyze All Code-Level Documentation106107- Collect all c4-code-\*.md files created in Phase 1108- Analyze code structure, dependencies, and relationships109- Identify logical component boundaries based on:110 - Domain boundaries (related business functionality)111 - Technical boundaries (shared frameworks, libraries)112 - Organizational boundaries (team ownership, if evident)113114### 2.2 Create Component Documentation115116For each identified component:117118- Use Task tool with subagent_type="c4-architecture::c4-component"119- Prompt: |120 Synthesize the following C4 Code-level documentation files into a logical component:121122 Code files to analyze:123 [List of c4-code-*.md file paths]124125 Create comprehensive C4 Component-level documentation following this structure:126 1. **Overview Section**:127 - Name: [Component name - descriptive and meaningful]128 - Description: [Short description of component purpose]129 - Type: [Application, Service, Library, etc.]130 - Technology: [Primary technologies used]131 2. **Purpose Section**:132 - Detailed description of what this component does133 - What problems it solves134 - Its role in the system135 3. **Software Features Section**:136 - List all software features provided by this component137 - Each feature with a brief description138 4. **Code Elements Section**:139 - List all c4-code-\*.md files contained in this component140 - Link to each file with a brief description141 5. **Interfaces Section**:142 - Document all component interfaces:143 - Interface name144 - Protocol (REST, GraphQL, gRPC, Events, etc.)145 - Description146 - Operations (function signatures, endpoints, etc.)147 6. **Dependencies Section**:148 - Components used (other components this depends on)149 - External systems (databases, APIs, services)150 7. **Component Diagram**:151 - Mermaid diagram showing this component and its relationships152153 Save the output as: C4-Documentation/c4-component-[component-name].md154 Use a sanitized component name for the filename.155156- Expected output: c4-component-<name>.md file for each component157- Context: All relevant c4-code-\*.md files for this component158159### 2.3 Create Master Component Index160161- Use Task tool with subagent_type="c4-architecture::c4-component"162- Prompt: |163 Create a master component index that lists all components in the system.164165 Based on all c4-component-\*.md files created, generate:166 1. **System Components Section**:167 - List all components with:168 - Component name169 - Short description170 - Link to component documentation171 2. **Component Relationships Diagram**:172 - Mermaid diagram showing all components and their relationships173 - Show dependencies between components174 - Show external system dependencies175176 Save the output as: C4-Documentation/c4-component.md177178- Expected output: Master c4-component.md file179- Context: All c4-component-\*.md files180181## Phase 3: Container-Level Synthesis182183### 3.1 Analyze Components and Deployment Definitions184185- Review all c4-component-\*.md files186- Search for deployment/infrastructure definitions:187 - Dockerfiles188 - Kubernetes manifests (deployments, services, etc.)189 - Docker Compose files190 - Terraform/CloudFormation configs191 - Cloud service definitions (AWS Lambda, Azure Functions, etc.)192 - CI/CD pipeline definitions193194### 3.2 Map Components to Containers195196- Use Task tool with subagent_type="c4-architecture::c4-container"197- Prompt: |198 Synthesize components into containers based on deployment definitions.199200 Component documentation:201 [List of all c4-component-*.md file paths]202203 Deployment definitions found:204 [List of deployment config files: Dockerfiles, K8s manifests, etc.]205206 Create comprehensive C4 Container-level documentation following this structure:207 1. **Containers Section** (for each container):208 - Name: [Container name]209 - Description: [Short description of container purpose and deployment]210 - Type: [Web Application, API, Database, Message Queue, etc.]211 - Technology: [Primary technologies: Node.js, Python, PostgreSQL, etc.]212 - Deployment: [Docker, Kubernetes, Cloud Service, etc.]213 2. **Purpose Section** (for each container):214 - Detailed description of what this container does215 - How it's deployed216 - Its role in the system217 3. **Components Section** (for each container):218 - List all components deployed in this container219 - Link to component documentation220 4. **Interfaces Section** (for each container):221 - Document all container APIs and interfaces:222 - API/Interface name223 - Protocol (REST, GraphQL, gRPC, Events, etc.)224 - Description225 - Link to OpenAPI/Swagger/API Spec file226 - List of endpoints/operations227 5. **API Specifications**:228 - For each container API, create an OpenAPI 3.1+ specification229 - Save as: C4-Documentation/apis/[container-name]-api.yaml230 - Include:231 - All endpoints with methods (GET, POST, etc.)232 - Request/response schemas233 - Authentication requirements234 - Error responses235 6. **Dependencies Section** (for each container):236 - Containers used (other containers this depends on)237 - External systems (databases, third-party APIs, etc.)238 - Communication protocols239 7. **Infrastructure Section** (for each container):240 - Link to deployment config (Dockerfile, K8s manifest, etc.)241 - Scaling strategy242 - Resource requirements (CPU, memory, storage)243 8. **Container Diagram**:244 - Mermaid diagram showing all containers and their relationships245 - Show communication protocols246 - Show external system dependencies247248 Save the output as: C4-Documentation/c4-container.md249250- Expected output: c4-container.md with all containers and API specifications251- Context: All component documentation and deployment definitions252253## Phase 4: Context-Level Documentation254255### 4.1 Analyze System Documentation256257- Review container and component documentation258- Search for system documentation:259 - README files260 - Architecture documentation261 - Requirements documents262 - Design documents263 - Test files (to understand system behavior)264 - API documentation265 - User documentation266267### 4.2 Create Context Documentation268269- Use Task tool with subagent_type="c4-architecture::c4-context"270- Prompt: |271 Create comprehensive C4 Context-level documentation for the system.272273 Container documentation: C4-Documentation/c4-container.md274 Component documentation: C4-Documentation/c4-component.md275 System documentation: [List of README, architecture docs, requirements, etc.]276 Test files: [List of test files that show system behavior]277278 Create comprehensive C4 Context-level documentation following this structure:279 1. **System Overview Section**:280 - Short Description: [One-sentence description of what the system does]281 - Long Description: [Detailed description of system purpose, capabilities, problems solved]282 2. **Personas Section**:283 - For each persona (human users and programmatic "users"):284 - Persona name285 - Type (Human User / Programmatic User / External System)286 - Description (who they are, what they need)287 - Goals (what they want to achieve)288 - Key features used289 3. **System Features Section**:290 - For each high-level feature:291 - Feature name292 - Description (what this feature does)293 - Users (which personas use this feature)294 - Link to user journey map295 4. **User Journeys Section**:296 - For each key feature and persona:297 - Journey name: [Feature Name] - [Persona Name] Journey298 - Step-by-step journey:299 1. [Step 1]: [Description]300 2. [Step 2]: [Description]301 ...302 - Include all system touchpoints303 - For programmatic users (external systems, APIs):304 - Integration journey with step-by-step process305 5. **External Systems and Dependencies Section**:306 - For each external system:307 - System name308 - Type (Database, API, Service, Message Queue, etc.)309 - Description (what it provides)310 - Integration type (API, Events, File Transfer, etc.)311 - Purpose (why the system depends on this)312 6. **System Context Diagram**:313 - Mermaid C4Context diagram showing:314 - The system (as a box in the center)315 - All personas (users) around it316 - All external systems around it317 - Relationships and data flows318 - Use C4Context notation for proper C4 diagram319 7. **Related Documentation Section**:320 - Links to container documentation321 - Links to component documentation322323 Save the output as: C4-Documentation/c4-context.md324325 Ensure the documentation is:326 - Understandable by non-technical stakeholders327 - Focuses on system purpose, users, and external relationships328 - Includes comprehensive user journey maps329 - Identifies all external systems and dependencies330331- Expected output: c4-context.md with complete system context332- Context: All container, component, and system documentation333334## Configuration Options335336- `target_directory`: Root directory to analyze (default: current repository root)337- `exclude_patterns`: Patterns to exclude (default: node_modules, .git, build, dist, etc.)338- `output_directory`: Where to write C4 documentation (default: C4-Documentation/)339- `include_tests`: Whether to analyze test files for context (default: true)340- `api_format`: Format for API specs (default: openapi)341342## Success Criteria343344- ✅ Every subdirectory has a corresponding c4-code-\*.md file345- ✅ All code-level documentation includes complete function signatures346- ✅ Components are logically grouped with clear boundaries347- ✅ All components have interface documentation348- ✅ Master component index created with relationship diagram349- ✅ Containers map to actual deployment units350- ✅ All container APIs documented with OpenAPI/Swagger specs351- ✅ Container diagram shows deployment architecture352- ✅ System context includes all personas (human and programmatic)353- ✅ User journeys documented for all key features354- ✅ All external systems and dependencies identified355- ✅ Context diagram shows system, users, and external systems356- ✅ Documentation is organized in C4-Documentation/ directory357358## Output Structure359360```361C4-Documentation/362├── c4-code-*.md # Code-level docs (one per directory)363├── c4-component-*.md # Component-level docs (one per component)364├── c4-component.md # Master component index365├── c4-container.md # Container-level docs366├── c4-context.md # Context-level docs367└── apis/ # API specifications368 ├── [container]-api.yaml # OpenAPI specs for each container369 └── ...370```371372## Coordination Notes373374- **Bottom-up processing**: Process directories from deepest to shallowest375- **Incremental synthesis**: Each level builds on the previous level's documentation376- **Complete coverage**: Every directory must have code-level documentation before synthesis377- **Link consistency**: All documentation files link to each other appropriately378- **API documentation**: Container APIs must have OpenAPI/Swagger specifications379- **Stakeholder-friendly**: Context documentation should be understandable by non-technical stakeholders380- **Mermaid diagrams**: Use proper C4 Mermaid notation for all diagrams381382## Example Usage383384```bash385/c4-architecture:c4-architecture386```387388This will:3893901. Walk through all subdirectories bottom-up3912. Create c4-code-\*.md for each directory3923. Synthesize into components3934. Map to containers with API docs3945. Create system context with personas and journeys395396All documentation written to: C4-Documentation/397398<!-- Source: .faos/custom/skills/architecture/c4-architecture-c4-architecture/SKILL.md -->