C4 Architecture Documentation Workflow
Selective Reading Rule
Start with:
references/senior-master-standard.md
references/usage-routing.md
references/quality-checklist.md
Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.
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="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/
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---2name: c4-architecture-c4-architecture3description: ALWAYS use this when the request matches C4 Architecture C4 Architecture: Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.4---56# C4 Architecture Documentation Workflow78## Selective Reading Rule910Start with:1112- `references/senior-master-standard.md`13- `references/usage-routing.md`14- `references/quality-checklist.md`1516Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.1718Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.1920[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.]2122## Use this skill when2324- Working on c4 architecture documentation workflow tasks or workflows25- Needing guidance, best practices, or checklists for c4 architecture documentation workflow2627## Do not use this skill when2829- The task is unrelated to c4 architecture documentation workflow30- You need a different domain or tool outside this scope3132## Instructions3334- Clarify goals, constraints, and required inputs.35- Apply relevant best practices and validate outcomes.36- Provide actionable steps and verification.37- If detailed examples are required, open `resources/implementation-playbook.md`.3839## Overview4041This workflow creates comprehensive C4 architecture documentation following the [official C4 model](https://c4model.com/diagrams) by:42431. **Code Level**: Analyzing every subdirectory bottom-up to create code-level documentation442. **Component Level**: Synthesizing code documentation into logical components within containers453. **Container Level**: Mapping components to deployment containers with API documentation (shows high-level technology choices)464. **Context Level**: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)4748**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.4950All documentation is written to a new `C4-Documentation/` directory in the repository root.5152## Phase 1: Code-Level Documentation (Bottom-Up Analysis)5354### 1.1 Discover All Subdirectories5556- Use codebase search to identify all subdirectories in the repository57- Sort directories by depth (deepest first) for bottom-up processing58- Filter out common non-code directories (node_modules, .git, build, dist, etc.)59- Create list of directories to process6061### 1.2 Process Each Directory (Bottom-Up)6263For each directory, starting from the deepest:6465- Use Task tool with subagent_type="c4-architecture::c4-code"66- Prompt: |67 Analyze the code in directory: [directory_path]6869 Create comprehensive C4 Code-level documentation following this structure:70 1. **Overview Section**:71 - Name: [Descriptive name for this code directory]72 - Description: [Short description of what this code does]73 - Location: [Link to actual directory path relative to repo root]74 - Language: [Primary programming language(s) used]75 - Purpose: [What this code accomplishes]76 2. **Code Elements Section**:77 - Document all functions/methods with complete signatures:78 - Function name, parameters (with types), return type79 - Description of what each function does80 - Location (file path and line numbers)81 - Dependencies (what this function depends on)82 - Document all classes/modules:83 - Class name, description, location84 - Methods and their signatures85 - Dependencies86 3. **Dependencies Section**:87 - Internal dependencies (other code in this repo)88 - External dependencies (libraries, frameworks, services)89 4. **Relationships Section**:90 - Optional Mermaid diagram if relationships are complex9192 Save the output as: C4-Documentation/c4-code-[directory-name].md93 Use a sanitized directory name (replace / with -, remove special chars) for the filename.9495 Ensure the documentation includes:96 - Complete function signatures with all parameters and types97 - Links to actual source code locations98 - All dependencies (internal and external)99 - Clear, descriptive names and descriptions100101- Expected output: c4-code-<directory-name>.md file in C4-Documentation/102- Context: All files in the directory and its subdirectories103104**Repeat for every subdirectory** until all directories have corresponding c4-code-\*.md files.105106## Phase 2: Component-Level Synthesis107108### 2.1 Analyze All Code-Level Documentation109110- Collect all c4-code-\*.md files created in Phase 1111- Analyze code structure, dependencies, and relationships112- Identify logical component boundaries based on:113 - Domain boundaries (related business functionality)114 - Technical boundaries (shared frameworks, libraries)115 - Organizational boundaries (team ownership, if evident)116117### 2.2 Create Component Documentation118119For each identified component:120121- Use Task tool with subagent_type="c4-architecture::c4-component"122- Prompt: |123 Synthesize the following C4 Code-level documentation files into a logical component:124125 Code files to analyze:126 [List of c4-code-*.md file paths]127128 Create comprehensive C4 Component-level documentation following this structure:129 1. **Overview Section**:130 - Name: [Component name - descriptive and meaningful]131 - Description: [Short description of component purpose]132 - Type: [Application, Service, Library, etc.]133 - Technology: [Primary technologies used]134 2. **Purpose Section**:135 - Detailed description of what this component does136 - What problems it solves137 - Its role in the system138 3. **Software Features Section**:139 - List all software features provided by this component140 - Each feature with a brief description141 4. **Code Elements Section**:142 - List all c4-code-\*.md files contained in this component143 - Link to each file with a brief description144 5. **Interfaces Section**:145 - Document all component interfaces:146 - Interface name147 - Protocol (REST, GraphQL, gRPC, Events, etc.)148 - Description149 - Operations (function signatures, endpoints, etc.)150 6. **Dependencies Section**:151 - Components used (other components this depends on)152 - External systems (databases, APIs, services)153 7. **Component Diagram**:154 - Mermaid diagram showing this component and its relationships155156 Save the output as: C4-Documentation/c4-component-[component-name].md157 Use a sanitized component name for the filename.158159- Expected output: c4-component-<name>.md file for each component160- Context: All relevant c4-code-\*.md files for this component161162### 2.3 Create Master Component Index163164- Use Task tool with subagent_type="c4-architecture::c4-component"165- Prompt: |166 Create a master component index that lists all components in the system.167168 Based on all c4-component-\*.md files created, generate:169 1. **System Components Section**:170 - List all components with:171 - Component name172 - Short description173 - Link to component documentation174 2. **Component Relationships Diagram**:175 - Mermaid diagram showing all components and their relationships176 - Show dependencies between components177 - Show external system dependencies178179 Save the output as: C4-Documentation/c4-component.md180181- Expected output: Master c4-component.md file182- Context: All c4-component-\*.md files183184## Phase 3: Container-Level Synthesis185186### 3.1 Analyze Components and Deployment Definitions187188- Review all c4-component-\*.md files189- Search for deployment/infrastructure definitions:190 - Dockerfiles191 - Kubernetes manifests (deployments, services, etc.)192 - Docker Compose files193 - Terraform/CloudFormation configs194 - Cloud service definitions (AWS Lambda, Azure Functions, etc.)195 - CI/CD pipeline definitions196197### 3.2 Map Components to Containers198199- Use Task tool with subagent_type="c4-architecture::c4-container"200- Prompt: |201 Synthesize components into containers based on deployment definitions.202203 Component documentation:204 [List of all c4-component-*.md file paths]205206 Deployment definitions found:207 [List of deployment config files: Dockerfiles, K8s manifests, etc.]208209 Create comprehensive C4 Container-level documentation following this structure:210 1. **Containers Section** (for each container):211 - Name: [Container name]212 - Description: [Short description of container purpose and deployment]213 - Type: [Web Application, API, Database, Message Queue, etc.]214 - Technology: [Primary technologies: Node.js, Python, PostgreSQL, etc.]215 - Deployment: [Docker, Kubernetes, Cloud Service, etc.]216 2. **Purpose Section** (for each container):217 - Detailed description of what this container does218 - How it's deployed219 - Its role in the system220 3. **Components Section** (for each container):221 - List all components deployed in this container222 - Link to component documentation223 4. **Interfaces Section** (for each container):224 - Document all container APIs and interfaces:225 - API/Interface name226 - Protocol (REST, GraphQL, gRPC, Events, etc.)227 - Description228 - Link to OpenAPI/Swagger/API Spec file229 - List of endpoints/operations230 5. **API Specifications**:231 - For each container API, create an OpenAPI 3.1+ specification232 - Save as: C4-Documentation/apis/[container-name]-api.yaml233 - Include:234 - All endpoints with methods (GET, POST, etc.)235 - Request/response schemas236 - Authentication requirements237 - Error responses238 6. **Dependencies Section** (for each container):239 - Containers used (other containers this depends on)240 - External systems (databases, third-party APIs, etc.)241 - Communication protocols242 7. **Infrastructure Section** (for each container):243 - Link to deployment config (Dockerfile, K8s manifest, etc.)244 - Scaling strategy245 - Resource requirements (CPU, memory, storage)246 8. **Container Diagram**:247 - Mermaid diagram showing all containers and their relationships248 - Show communication protocols249 - Show external system dependencies250251 Save the output as: C4-Documentation/c4-container.md252253- Expected output: c4-container.md with all containers and API specifications254- Context: All component documentation and deployment definitions255256## Phase 4: Context-Level Documentation257258### 4.1 Analyze System Documentation259260- Review container and component documentation261- Search for system documentation:262 - README files263 - Architecture documentation264 - Requirements documents265 - Design documents266 - Test files (to understand system behavior)267 - API documentation268 - User documentation269270### 4.2 Create Context Documentation271272- Use Task tool with subagent_type="c4-architecture::c4-context"273- Prompt: |274 Create comprehensive C4 Context-level documentation for the system.275276 Container documentation: C4-Documentation/c4-container.md277 Component documentation: C4-Documentation/c4-component.md278 System documentation: [List of README, architecture docs, requirements, etc.]279 Test files: [List of test files that show system behavior]280281 Create comprehensive C4 Context-level documentation following this structure:282 1. **System Overview Section**:283 - Short Description: [One-sentence description of what the system does]284 - Long Description: [Detailed description of system purpose, capabilities, problems solved]285 2. **Personas Section**:286 - For each persona (human users and programmatic "users"):287 - Persona name288 - Type (Human User / Programmatic User / External System)289 - Description (who they are, what they need)290 - Goals (what they want to achieve)291 - Key features used292 3. **System Features Section**:293 - For each high-level feature:294 - Feature name295 - Description (what this feature does)296 - Users (which personas use this feature)297 - Link to user journey map298 4. **User Journeys Section**:299 - For each key feature and persona:300 - Journey name: [Feature Name] - [Persona Name] Journey301 - Step-by-step journey:302 1. [Step 1]: [Description]303 2. [Step 2]: [Description]304 ...305 - Include all system touchpoints306 - For programmatic users (external systems, APIs):307 - Integration journey with step-by-step process308 5. **External Systems and Dependencies Section**:309 - For each external system:310 - System name311 - Type (Database, API, Service, Message Queue, etc.)312 - Description (what it provides)313 - Integration type (API, Events, File Transfer, etc.)314 - Purpose (why the system depends on this)315 6. **System Context Diagram**:316 - Mermaid C4Context diagram showing:317 - The system (as a box in the center)318 - All personas (users) around it319 - All external systems around it320 - Relationships and data flows321 - Use C4Context notation for proper C4 diagram322 7. **Related Documentation Section**:323 - Links to container documentation324 - Links to component documentation325326 Save the output as: C4-Documentation/c4-context.md327328 Ensure the documentation is:329 - Understandable by non-technical stakeholders330 - Focuses on system purpose, users, and external relationships331 - Includes comprehensive user journey maps332 - Identifies all external systems and dependencies333334- Expected output: c4-context.md with complete system context335- Context: All container, component, and system documentation336337## Configuration Options338339- `target_directory`: Root directory to analyze (default: current repository root)340- `exclude_patterns`: Patterns to exclude (default: node_modules, .git, build, dist, etc.)341- `output_directory`: Where to write C4 documentation (default: C4-Documentation/)342- `include_tests`: Whether to analyze test files for context (default: true)343- `api_format`: Format for API specs (default: openapi)344345## Success Criteria346347- ✅ Every subdirectory has a corresponding c4-code-\*.md file348- ✅ All code-level documentation includes complete function signatures349- ✅ Components are logically grouped with clear boundaries350- ✅ All components have interface documentation351- ✅ Master component index created with relationship diagram352- ✅ Containers map to actual deployment units353- ✅ All container APIs documented with OpenAPI/Swagger specs354- ✅ Container diagram shows deployment architecture355- ✅ System context includes all personas (human and programmatic)356- ✅ User journeys documented for all key features357- ✅ All external systems and dependencies identified358- ✅ Context diagram shows system, users, and external systems359- ✅ Documentation is organized in C4-Documentation/ directory360361## Output Structure362363```364C4-Documentation/365├── c4-code-*.md # Code-level docs (one per directory)366├── c4-component-*.md # Component-level docs (one per component)367├── c4-component.md # Master component index368├── c4-container.md # Container-level docs369├── c4-context.md # Context-level docs370└── apis/ # API specifications371 ├── [container]-api.yaml # OpenAPI specs for each container372 └── ...373```374375## Coordination Notes376377- **Bottom-up processing**: Process directories from deepest to shallowest378- **Incremental synthesis**: Each level builds on the previous level's documentation379- **Complete coverage**: Every directory must have code-level documentation before synthesis380- **Link consistency**: All documentation files link to each other appropriately381- **API documentation**: Container APIs must have OpenAPI/Swagger specifications382- **Stakeholder-friendly**: Context documentation should be understandable by non-technical stakeholders383- **Mermaid diagrams**: Use proper C4 Mermaid notation for all diagrams384385## Example Usage386387```bash388/c4-architecture:c4-architecture389```390391This will:3923931. Walk through all subdirectories bottom-up3942. Create c4-code-\*.md for each directory3953. Synthesize into components3964. Map to containers with API docs3975. Create system context with personas and journeys398399All documentation written to: C4-Documentation/400401## Limitations402- Use this skill only when the task clearly matches the scope described above.403- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.404- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.