skills/se-architecture/arch-diagrams/SKILL.md
Diagrams: C4 model, PlantUML, Mermaid, sequence diagrams, ERDs, infrastructure diagrams
npx skillsauth add alphaonedev/openclaw-graph arch-diagramsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill allows OpenClaw to generate, edit, and render architecture diagrams using tools like C4 model, PlantUML, Mermaid, sequence diagrams, ERDs, and infrastructure diagrams. It integrates diagram creation into coding workflows for visualizing system designs.
Use this skill when documenting software architecture, planning system interactions, or creating visual aids for ERDs and sequence flows. Apply it during design phases, code reviews, or when collaborating on infrastructure setups to quickly prototype diagrams from text descriptions.
To accomplish tasks, provide a clear text description or partial diagram code to OpenClaw, then specify the diagram type. For example, invoke the skill via CLI or API with inputs like JSON configs. Always include context, such as "Generate a C4 container diagram for a web app with a database." Handle iterations by chaining commands, e.g., generate, review, and refine. Use environment variables for authentication, like setting $OPENCLAW_API_KEY before operations.
Use the OpenClaw CLI for direct execution or API for programmatic access. Authenticate with $OPENCLAW_API_KEY in your environment.
CLI Command: openclaw arch-diagrams generate --type mermaid --input "sequenceDiagram: A->B: Request" --output diagram.md
This generates a Mermaid sequence diagram from the input string and saves it to a file.
API Endpoint: POST to /api/v1/arch-diagrams/generate with JSON body: {"type": "plantuml", "description": "@startuml\nAlice -> Bob: Hello\n@enduml", "format": "svg"}
Response includes the rendered SVG; handle with HTTP headers for authentication.
Config Format: Use YAML for inputs, e.g.,
type: c4
elements:
- name: System
type: container
Pass this via CLI flag: --config path/to/config.yaml.
Code Snippet (Python):
import requests
response = requests.post('https://api.openclaw.ai/api/v1/arch-diagrams/generate', json={"type": "erd", "input": "User has many Posts"}, headers={'Authorization': f'Bearer {os.environ["OPENCLAW_API_KEY"]}'})
print(response.json()['output'])
Integrate this skill into your workflow by adding it to IDE extensions (e.g., VS Code plugin for OpenClaw) or CI/CD pipelines. For example, in a GitHub Action, use: run: openclaw arch-diagrams generate --type sequence --input ./specs.md && echo '::set-output name=diagram::$(cat diagram.md)'. Set $OPENCLAW_API_KEY as a secret in your environment. When combining with other skills, pipe outputs; e.g., generate a diagram from code analysis results. Ensure compatibility by specifying versions, like OpenClaw CLI v2.5+.
Always check for errors by parsing response codes or CLI exit statuses. For invalid inputs, OpenClaw returns HTTP 400 with details like "Invalid PlantUML syntax: missing @enduml". Handle network issues by retrying with exponential backoff, e.g., in code: if response.status_code == 503: time.sleep(5); retry(). Validate inputs before sending, such as ensuring diagram types are from ["c4", "mermaid", "plantuml", "sequence", "erd"]. Use try-except blocks for API calls, e.g.,
try:
result = requests.post(url, json=data)
result.raise_for_status()
except requests.exceptions.HTTPError as e:
print(f"Error: {e.response.text} - Fix input and retry")
Generate a C4 System Diagram: To visualize a simple web application, run: openclaw arch-diagrams generate --type c4 --input "System: WebApp with Database and API" --output c4_diagram.puml. This produces a PlantUML file for a C4 system context diagram. Review and refine by adding: openclaw arch-diagrams edit --file c4_diagram.puml --add "Container: Frontend".
Create an ERD for a Database Schema: For modeling relationships, use: openclaw arch-diagrams generate --type erd --input '{"entities": [{"name": "User", "attributes": ["id", "name"]}, {"name": "Post", "attributes": ["id", "content"]}]}' --output erd.mmd. This outputs a Mermaid ERD code, which you can render in Markdown files.
tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui