| name | c4-generator |
| description | Generate C4 diagrams from project analysis. |
Objective
Enable AI agents to automatically generate C4 diagrams (C1, C2, C3, and C4 levels) from project analysis.
Process Steps
-
Project Structure Analysis
- Identify the general architecture, main modules, components, and purpose of the system.
-
Package/Folder Structure and Organization Analysis
- Map the directory hierarchy, logical groupings, and responsibilities of each package/folder.
-
Analysis of Integrations with External Systems and Resources
- Detect connections with APIs, queues, files, databases, and other external systems.
-
Dependency Analysis
- Identify relevant libraries, frameworks, and external dependencies for the architecture.
-
C4 Diagram Generation
- Generate diagrams for each level (C1, C2, C3, C4) in Mermaid format.
-
User Interaction
- If there are doubts or ambiguous points, ask the user for clarification before finalizing the diagrams.
-
Final Markdown Generation
- Create a markdown file containing:
- Analysis summary
- Mermaid diagrams for each level (C1, C2, C3, C4)
Example of Generated Markdown Structure
C4 Analysis of Project
Analysis Summary
- General project structure
- Main packages and responsibilities
- External integrations
- Dependencies
C4 Diagram - Level 1 (Context)
C4Context
...
C4 Diagram - Level 2 (Container)
C4Container
...
C4 Diagram - Level 3 (Component)
C4Component
...
C4 Diagram - Level 4 (Code)
C4Dynamic
...
Observations
- Always question the user if any point of the analysis is not clear.
- Use the actual project structure to detail the diagrams.
- Adapt the diagrams according to the complexity and context of the analyzed project.