diagram-gen
Generate Mermaid diagrams from your codebase. Use when you need architecture visualizations.
Why use this skill?
Keep your documentation accurate with automated Mermaid diagrams. Analyze your codebase and visualize architecture instantly with this OpenClaw developer tool.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/lxgicstudios/diagram-genWhat This Skill Does
The diagram-gen skill for OpenClaw is a powerful automated documentation assistant designed to eliminate the frustration of stale architecture diagrams. By leveraging intelligent code analysis, this skill scans your codebase and produces accurate, high-quality Mermaid.js diagrams. It bridges the gap between raw source code and visual representation, supporting various formats including flowcharts for process visualization, class diagrams for object-oriented structures, sequence diagrams for call flow analysis, and ER diagrams for database schema exploration. It outputs standardized Mermaid syntax that renders seamlessly across GitHub, VS Code, and popular markdown editors.
Installation
To integrate this skill into your OpenClaw environment, execute the following command in your terminal:
clawhub install openclaw/skills/skills/lxgicstudios/diagram-gen
Ensure you have Node.js 18 or higher installed on your system. Additionally, because the skill utilizes AI for structural analysis, you must have a valid OPENAI_API_KEY set in your environment variables to allow the agent to process your codebase accurately.
Use Cases
- Onboarding: Rapidly help new developers understand the project architecture by generating visual maps of complex modules.
- Code Review: Visualize the impact of structural changes by generating 'before' and 'after' sequence diagrams during refactoring.
- Documentation: Generate living documentation for your repository that stays in sync with your code, reducing the need for manual maintenance.
- Architecture Audits: Quickly identify circular dependencies or overly complex class relationships that are difficult to spot in plain text files.
Example Prompts
- "Analyze the ./src/services directory and generate a sequence diagram showing how the authentication flow interacts with the database user module."
- "Create a class diagram for the core models in my project and save it to architecture-overview.mmd."
- "Generate a flowchart depicting the error handling logic within the primary API controllers found in the current directory."
Tips & Limitations
- Focus Your Scope: While the tool can scan an entire repository, providing specific directories or file paths results in cleaner, more readable diagrams. Avoid running it on massive, monolithic directories to prevent visual clutter.
- Pick the Right Type: Different diagrams serve different purposes. Use sequence diagrams for behavioral logic and class diagrams for static structural relationships.
- Manual Verification: Treat generated diagrams as a starting point. While highly accurate, complex logical branches might require manual adjustments in the Mermaid syntax if the agent encounters ambiguous code patterns.
- Environment: Always ensure your
OPENAI_API_KEYis kept secure and not hardcoded in your source files.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-lxgicstudios-diagram-gen": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, external-api
Related Skills
script-gen
Generate package.json scripts with AI. Use when setting up npm scripts.
email-template-gen
Generate responsive email templates. Use when building transactional emails.
branch-namer
Generate descriptive git branch names from plain English. Use when you need a branch name that follows conventions.
cloudflare-gen
Generate Cloudflare Workers configuration and code. Use when building on the edge.
adr-writer
Generate Architecture Decision Records with AI. Use when documenting technical decisions.