172-java-diagrams
Scannednpx machina-cli add skill jabrena/cursor-rules-java/172-java-diagrams --openclawJava Diagrams Generator with modular step-based configuration
Generate comprehensive Java project diagrams through a modular, step-based interactive process that covers UML sequence diagrams, UML class diagrams, C4 model diagrams, and UML state machine diagrams using PlantUML syntax.
Core areas: UML sequence diagram generation for application workflows and API interactions, UML class diagram generation for package structure and class relationships, C4 model diagram generation at Context/Container/Component/Code abstraction levels, UML state machine diagram generation for entity lifecycles and business workflows, PlantUML syntax for all diagram types, file organization strategies (single-file, separate-files, or integrated with existing documentation), and final diagram validation with PlantUML syntax checking.
Prerequisites: Run ./mvnw validate or mvn validate before applying any diagram generation. If validation fails, stop immediately — do not proceed until all validation errors are resolved.
Multi-step scope: Step 1 assesses diagram preferences through targeted questions to determine which subsequent steps to execute. Step 2 generates UML sequence diagrams for main application flows, API interactions, and complex business logic — conditionally executed if selected. Step 3 generates UML class diagrams for all packages, core business logic packages, or specific packages, showing inheritance, composition, and dependency relationships — conditionally executed if selected. Step 4 generates C4 model diagrams covering System Context, Container, Component, and Code levels — conditionally executed if selected. Step 5 generates UML state machine diagrams for entity lifecycles, business workflows, system behaviors, and user interactions — conditionally executed if selected. Step 6 validates all generated diagrams and produces a comprehensive summary of files created, directory structure, content coverage, and usage instructions for rendering with PlantUML.
Before applying changes: Read the reference for detailed good/bad examples, constraints, and safeguards for each diagram generation pattern.
Reference
For detailed guidance, examples, and constraints, see references/172-java-diagrams.md.
Source
git clone https://github.com/jabrena/cursor-rules-java/blob/main/skills/172-java-diagrams/SKILL.mdView on GitHub Overview
Generates comprehensive Java project diagrams (UML sequence, UML class, C4 model, and UML state diagrams) through a modular, step-based interactive process. It outputs PlantUML syntax and supports single-file, separate-files, or integration with existing documentation, with built-in validation and a final summary.
How This Skill Works
The process is split into modular steps: Step 1 collects diagram preferences to decide which steps to run. Steps 2–5 generate the selected diagram types (sequence, class, C4, state) in a conditional, step-based flow. Step 6 validates all diagrams against PlantUML syntax and produces a comprehensive summary of files, structure, and usage instructions. Prerequisites include running mvn validate before applying any diagram generation.
When to Use It
- When you need to map application workflows and API interactions with UML sequence diagrams.
- When you want to visualize package structure and class relationships with UML class diagrams.
- When documenting Java architecture across Context/Container/Component/Code levels (C4 model).
- When modeling entity lifecycles, business workflows, or system behaviors with state machines.
- When you want to validate diagrams against PlantUML syntax and generate usage instructions.
Quick Start
- Step 1: Run prerequisites and answer Step 1 questions to set your diagram scope.
- Step 2: Generate the selected diagrams (sequence, class, C4, state) based on your choices.
- Step 3: Validate all diagrams with PlantUML syntax and review the generated summary and file layout.
Best Practices
- Run mvn validate before applying diagram generation.
- Clarify the diagram scope in Step 1 to avoid unnecessary diagrams.
- Choose an appropriate file organization strategy (single-file, separate-files, or integrated).
- Validate PlantUML syntax after generation and fix errors before rendering.
- Keep diagrams up to date by re-running steps after significant code changes.
Example Use Cases
- Document a Java web application's request flow using UML sequence diagrams.
- Capture a microservice ecosystem with C4 Context/Container diagrams.
- Show class inheritance, composition, and dependencies across packages.
- Model an entity lifecycle (e.g., order processing) with UML state machines.
- Provide a PlantUML-ready diagram package for project documentation.