Insight Diagram - Project Diagram Generation Skill
Analyze any codebase to automatically generate 14 types of UML diagrams + architecture diagrams + flowcharts, rendered as HTML+SVG using
.
Diagram Categories and List
Structural Diagrams — Static
Describe the physical composition and static structure of the system.
| No. | Diagram Type | English Identifier | Focus |
|---|
| 1 | System Architecture Diagram | architecture | Component relationships, global perspective (non-UML, most commonly used) |
| 2 | Class Diagram | class | Define classes, attributes, operations and relationships |
| 3 | Object Diagram | object | Object instances and their relationships at a specific moment |
| 4 | Component Diagram | component | System components and their dependency relationships |
| 5 | Deployment Diagram | deployment | Physical hardware, nodes and software deployment |
| 6 | Package Diagram | package | Group and organize model elements |
| 7 | Composite Structure Diagram | composite-structure | Internal structure of classes |
| 8 | Profile Diagram | profile | Extend UML metamodel, define custom stereotypes |
Behavioral Diagrams — Dynamic
Describe the interaction process between the system and external participants or within the system.
| No. | Diagram Type | English Identifier | Focus |
|---|
| 9 | Flowchart | flowchart | Main process and branches (non-UML, most commonly used) |
| 10 | Use Case Diagram | usecase | Display system functions from the user's perspective |
| 11 | Activity Diagram | activity | Process flow or steps |
| 12 | State Machine Diagram | state-machine | State transitions in the object lifecycle |
| 13 | Sequence Diagram | sequence | Display interactions between objects in chronological order |
| 14 | Communication Diagram | communication | Focus on organizational relationships between objects |
| 15 | Timing Diagram | timing | Focus on time constraints for state changes |
| 16 | Interaction Overview Diagram | interaction-overview | Combine activity diagrams and sequence diagrams |
| 17 | Swimlane Diagram | swimlane | Cross-component/role responsibility process (variant of activity diagram) |
Example References
The
directory of this skill contains 13 completed diagram HTML files, serving as reference templates for visual styles and content structure.
You must read the corresponding example file before generating any diagram to ensure consistent style and standardized structure.
Example File List
| File | Diagram Type | English Identifier |
|---|
examples/architecture.html
| System Architecture Diagram | architecture |
| Class Diagram | class |
| Object Diagram | object |
| Component Diagram | component |
| Deployment Diagram | deployment |
| Flowchart | flowchart |
| Use Case Diagram | usecase |
| Activity Diagram | activity |
| Sequence Diagram | sequence |
examples/communication.html
| Communication Diagram | communication |
| Data Flow Diagram | dfd |
examples/interaction-overview.html
| Interaction Overview Diagram | interaction-overview |
| Swimlane Diagram | swimlane |
Reference Rules
-
Read Before Generation: Before calling
, use the Read tool to read the example file of the corresponding type, and extract:
- SVG layout strategy (node spacing, grouping method, arrow direction)
- Node style hierarchy (core node accent highlight, normal node solid border, optional node dashed border)
- Annotation style (phase labels, Legend, card summary)
- Information density (number of fields/properties displayed per node)
-
Structure Alignment: The generated diagram should maintain the same structural hierarchy as the example:
- Top of page: Title + Subtitle + Diagram type description
- Middle body: SVG diagram area (with light border container)
- Bottom: Information summary card + Footer
-
Replace Content Instead of Copying: The business data (NovaShield risk control system) in the examples is a fictional reference case. When generating, replace it with the actual architecture information of the target project. Only reference the layout and style, do not copy business content.
-
Types Without Corresponding Examples: For the 5 diagram types without example files (package, composite-structure, profile, state-machine, timing), refer to the closest existing examples (e.g., package diagram refers to component diagram, state machine diagram refers to activity diagram) and follow the same visual language.
Execution Process
Step 1: Analyze the Codebase
Read key project files to extract architecture information:
- Read the file in the project root directory (if exists) to get an overview of the project
- Read files in each subdirectory (if exists) to get module details
- Use Glob to scan the source code file structure (, , , etc.)
- Read entry files (, , , etc.) to identify top-level components
- Use Grep to search for key patterns: interface definitions, function signatures, dependency injection, configuration items
Extract the following information from the above:
- Component List: Services, modules, external dependencies
- Relationship Diagram: Who calls whom, who depends on whom, data flow direction
- Core Types: Structs/classes, interfaces, enums
- Processes: Main business processes, exception handling processes
- Deployment: Processes, middleware, external services
Step 2: Select Diagrams
Use AskUserQuestion to let users select the diagrams to generate (multiSelect: true), displayed in 4 groups:
Group 1 — Structural Diagrams (Static):
- System Architecture Diagram (architecture)
- Class Diagram (class)
- Object Diagram (object)
- Component Diagram (component)
Group 2 — Continued Structural Diagrams + Deployment:
- Deployment Diagram (deployment)
- Package Diagram (package)
- Composite Structure Diagram (composite-structure)
- Profile Diagram (profile)
Group 3 — Behavioral Diagrams (Dynamic):
- Flowchart (flowchart)
- Use Case Diagram (usecase)
- Activity Diagram (activity)
- State Machine Diagram (state-machine)
Group 4 — Interaction Diagrams + Common Non-UML:
- Sequence Diagram (sequence)
- Communication Diagram (communication)
- Interaction Overview Diagram (interaction-overview)
- Swimlane Diagram (swimlane)
- Generate All (all)
Default recommendation: architecture + sequence + flowchart
Step 3: Generate One by One
For each selected diagram type:
- Read Example First: Use the Read tool to read
examples/<identifier>.html
(e.g., examples/architecture.html
) to extract layout patterns, node styles, and annotation methods
- Based on the architecture information extracted in Step 1, organize the elements and relationships that should be displayed in the diagram
- Call the skill, passing in the diagram type, title, content description, output path, must specify the light style
- Save the output file to (e.g., )
- Briefly report the completion status
Generation Rules:
- Style: Must use the light Claude style (warm white background #FAF9F6, terracotta/sage/plum/rose color scheme, Inter font, white card container), consistent with the Anthropic Claude brand visual
- Anti-Overlap: All SVG elements (nodes, arrows, labels) must not overlap with each other. Specific practices:
- Calculate the bounding box of each element to ensure no overlap
- Draw arrows below nodes (draw arrows first then nodes in SVG)
- Leave sufficient spacing between nodes (minimum 40px vertically, minimum 30px horizontally)
- Text does not exceed the boundary of the node it belongs to; truncate or wrap long text
- Place connection line labels at the offset of the line midpoint to avoid covering lines or nodes
- If there are too many elements causing crowding, split into multiple sub-diagrams or reduce element size
Batch generation order (macro to micro):
architecture → component → deployment → package → composite-structure → profile → class → object → usecase → flowchart → activity → state-machine → swimlane → sequence → communication → timing → interaction-overview
Step 4: Report
After all are completed, output:
- List of generated files
- Brief description of each diagram
Content Guidelines for Each Diagram
System Architecture Diagram (architecture) — Non-UML, Most Commonly Used
- Display top-level system components and their connection relationships
- Distinguish internal modules from external dependencies
- Mark core data flow directions
Class Diagram (class)
- Core types are class nodes (name + fields + methods)
- Inheritance, composition, dependency relationships
- Separation of interfaces and implementations
- Limit to 10-15 core types
Object Diagram (object)
- Select a typical runtime scenario
- Display object instances and their attribute values
- Link relationships between objects
Component Diagram (component)
- Each component is a node
- Arrows indicate dependency/call direction
- Mark interface names
Deployment Diagram (deployment)
- Physical nodes (servers, containers, Serverless)
- Middleware (message queues, caches, databases)
- External services (third-party APIs)
- Mark communication protocols
Package Diagram (package)
- Group by module/namespace
- Dependency relationships between packages
- Reflect layered architecture
Composite Structure Diagram (composite-structure)
- Internal structure of classes/components
- Parts and Connectors
- Ports and interfaces
Profile Diagram (profile)
- Custom Stereotypes
- Tagged Values extending metamodel definitions
- Domain-specific modeling constraints
Flowchart (flowchart) — Non-UML, Most Commonly Used
- Main process + key branches
- Failure/exception paths
- Clear start and end nodes
Use Case Diagram (usecase)
- Actors (people/external systems)
- Use case ellipses
- include/extend relationships
Activity Diagram (activity)
- Phases/steps are activity nodes
- Parallel branches use fork/join
- Decision points use diamonds
State Machine Diagram (state-machine)
- Key states of objects
- Events triggering state transitions
- Actions/guard conditions
- Initial and final states
Sequence Diagram (sequence)
- Actors are vertical lifelines
- Horizontal arrows are message calls
- Mark key return values
- Focus on 2-5 core interaction scenarios
Communication Diagram (communication)
- Components are nodes, messages are connections
- Mark message serial numbers
- Emphasize collaboration relationships rather than timing
Timing Diagram (timing)
- Time axis expands horizontally
- Time constraints for state changes
- Duration annotations
Interaction Overview Diagram (interaction-overview)
- Control flow nodes embed interaction fragments
- Display conditional branches and loops
- Macro overview of each interaction scenario
Swimlane Diagram (swimlane) — Variant of Activity Diagram
- Divide swimlanes by component/role
- Process steps are within corresponding swimlanes
- Cross-swimlane arrows indicate interactions