agentleFS
xAmirHamza77xAmirHamza77/ReverseOps-Skill/skills/diagram-generator/SKILL.md

diagram-generator

Skill4 starsChanged 4 months agoMITView on GitHub

generate, refine, validate, and render diagrams from natural language, notes, code snippets, schemas, tables, or existing diagram source. use for flowcharts, swimlanes, sequence diagrams, state diagrams, er diagrams, class diagrams, architecture/c4-style diagrams, dependency graphs, gantt charts, mind maps, user journeys, sankey-style flows, org charts, network graphs, and other visual models. supports mermaid by default, graphviz dot for complex graph layout, plantuml for uml-heavy engineering diagrams, and svg output when direct markup is more reliable.

  • Installs packages

11 other projects use a version of this, 4 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

29 rules. 0 are common, 18 are distinctive, and 11 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 18

    Distinctive

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create clear, editable diagrams from messy or structured inputs.

    line 17
  2. Distinctive:

    Do not over-ask for clarification.

    line 28
  3. Distinctive:

    Use Mermaid unless another language is clearly better.

    line 32
  4. Distinctive:

    Always provide editable source unless the user explicitly asks only for an image.

    line 52
  5. Distinctive:

    Default to a single best diagram.

    line 53
  6. Distinctive:

    Prefer stable, simple syntax over fancy features that may not render in older Mermaid/PlantUML versions.

    line 54
  7. Distinctive:

    Use short labels. Split long text into notes outside the diagram when needed.

    line 55
  8. Distinctive:

    Avoid ambiguous node IDs. Use ASCII IDs and human-readable labels.

    line 56
  9. Very specific:

    Start with the correct diagram directive, for example flowchart TD, sequenceDiagram, erDiagram, gantt, mindmap, or journey.

    line 67
  10. Distinctive:

    Use subgraphs for swimlanes or architecture layers.

    line 69
  11. Very specific:

    Keep node IDs stable and ASCII-only, for example ingest_service[Ingest Service].

    line 70
  12. Very specific:

    Use decision diamonds for branching: decision{Condition?}.

    line 72
  13. Very specific:

    Use consistent edge labels: -- yes -->, -- no -->, -.

    line 73
  14. Very specific:

    Use alt/else/end, opt/end, loop/end, and par/and/end blocks for conditional, optional, repeated, and parallel flows.

    line 75
  15. Distinctive:

    Use Graphviz for large, dense, or layout-sensitive relationship diagrams.

    line 79
  16. Very specific:

    Prefer digraph G for directed relationships and graph G for undirected networks.

    line 81
  17. Very specific:

    Use subgraph cluster_name for boundaries and subsystems.

    line 83
  18. Distinctive:

    Use plain labels and restrained styling.

    line 84
  19. Distinctive:

    Use edge labels only when they add meaning.

    line 85
  20. Distinctive:

    Use PlantUML when the user asks for UML or needs formal UML notation.

    line 90
  21. Very specific:

    Use actor, participant, database, queue, collections, or component stereotypes when useful.

    line 93
  22. Very specific:

    Use package, rectangle, or node for architecture boundaries.

    line 94
  23. Distinctive:

    Use SVG only when text diagram languages cannot express the requested visual reliably.

    line 100
  24. Distinctive:

    Keep SVG simple, accessible, and editable.

    line 102
  25. Distinctive:

    Prefer rectangles, lines, arrows, and groups over complex paths.

    line 104
  26. Distinctive:

    Do not embed external fonts or remote images.

    line 105
  27. Very specific:

    When the user asks for PNG/SVG/PDF, create a source file and run:

    line 109
  28. Distinctive:

    Use this structure for most diagram answers:

    line 134
  29. Very specific:

    If a renderer is unavailable, scripts/render_diagram.py outputs installation hints instead of failing with an error.

    line 168

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Diagram Generator

ACTION REQUIRED (execute immediately after reading)

  1. NOW: Confirm whether the current task falls within this skill's scope
  2. NOW: Read ../tool-index.md to verify tool availability and actual paths
  3. NEXT: If a tool is missing, invoke bootstrap — do not guess paths
  4. ACT: Enter the first step of the "Workflow" and execute — do not stop at the confirmation stage

Purpose

Create clear, editable diagrams from messy or structured inputs. Prefer text-based diagram source first so the result can be reviewed, versioned, and refined. Render to files only when the user asks for an image/PDF or when a downloadable artifact would materially help.

Default workflow

  1. Identify the user's intent, audience, and source material.
  2. Choose the diagram family and language using the decision table below.
  3. Normalize entities, relationships, labels, states, branches, and time/order information before writing diagram code.
  4. Generate concise, readable diagram source.
  5. Validate the syntax mentally and, when creating files, run scripts/render_diagram.py.
  6. Return the diagram source plus a short note about assumptions. When files are generated, include links to the output files.

Do not over-ask for clarification. If the request is underspecified, make reasonable assumptions and label them briefly.

Diagram language decision table

Use Mermaid unless another language is clearly better.

User wantsPreferWhy
process flow, decision tree, simple swimlaneMermaid flowchartreadable and easy to paste into Markdown
sequence of system/user interactionsMermaid sequenceDiagram or PlantUML sequenceMermaid for docs; PlantUML for UML formality
lifecycle, state machine, transitionsMermaid stateDiagram-v2 or PlantUML statecompact transition syntax
database schema, entities, relationshipsMermaid erDiagramportable ER notation
class/interface/object modelMermaid classDiagram or PlantUML classMermaid for docs; PlantUML for detailed UML
project scheduleMermaid ganttconcise timeline syntax
hierarchy, ideas, notesMermaid mindmapgood default for idea maps
customer/product journeyMermaid journeybuilt-in journey notation
git historyMermaid gitGraphbuilt-in git notation
dependency graph, package graph, large networkGraphviz DOTbetter layout engines for dense graphs
architecture with layers, clusters, boundariesMermaid flowchart with subgraphs, Graphviz clusters, or PlantUML C4-stylechoose based on requested fidelity
weighted flow/sankey-like relationshipMermaid sankey-beta when supported, otherwise SVG or GraphvizMermaid support may vary by renderer
custom visual where source languages fit poorlySVGprecise control over layout and styling

Output policy

  • Always provide editable source unless the user explicitly asks only for an image.
  • Default to a single best diagram. Offer alternatives only when genuinely useful.
  • Prefer stable, simple syntax over fancy features that may not render in older Mermaid/PlantUML versions.
  • Use short labels. Split long text into notes outside the diagram when needed.
  • Avoid ambiguous node IDs. Use ASCII IDs and human-readable labels.
  • Preserve user terminology, but standardize capitalization within a diagram.
  • For technical diagrams, include boundaries such as client, service, database, queue, external API, and operator/user when they are implied.
  • For business-process diagrams, distinguish happy path, decision points, failures, retries, and manual steps when present.
  • For diagrams created from uncertain text, include an Assumptions section after the code.

Mermaid generation rules

Consult references/diagram-patterns.md for compact templates.

General Mermaid rules:

  • Start with the correct diagram directive, for example flowchart TD, sequenceDiagram, erDiagram, gantt, mindmap, or journey.
  • For flowcharts, use flowchart TD unless the user asks for left-to-right; use flowchart LR for architecture and pipelines.
  • Use subgraphs for swimlanes or architecture layers. Name subgraphs with readable labels.
  • Keep node IDs stable and ASCII-only, for example ingest_service[Ingest Service].
  • Quote labels that contain punctuation likely to confuse the parser.
  • Use decision diamonds for branching: decision{Condition?}.
  • Use consistent edge labels: -- yes -->, -- no -->, -. async .->, or == critical ==> only when meaningful.
  • In sequence diagrams, declare participants before messages. Use actor for humans and participant for systems.
  • Use alt/else/end, opt/end, loop/end, and par/and/end blocks for conditional, optional, repeated, and parallel flows.

Graphviz DOT generation rules

Use Graphviz for large, dense, or layout-sensitive relationship diagrams.

  • Prefer digraph G for directed relationships and graph G for undirected networks.
  • Set layout-friendly graph attributes at the top: rankdir=LR, nodesep, ranksep, and splines=true when helpful.
  • Use subgraph cluster_name for boundaries and subsystems.
  • Use plain labels and restrained styling.
  • Use edge labels only when they add meaning.
  • For many nodes, group by domain with clusters and avoid crossing-heavy all-to-all edges.

PlantUML generation rules

Use PlantUML when the user asks for UML or needs formal UML notation.

  • Wrap diagrams with @startuml and @enduml.
  • Use actor, participant, database, queue, collections, or component stereotypes when useful.
  • Use package, rectangle, or node for architecture boundaries.
  • For class diagrams, include only important fields/methods unless the user asks for exhaustive detail.
  • For activity diagrams, use clear start/end markers and explicit branch labels.

SVG generation rules

Use SVG only when text diagram languages cannot express the requested visual reliably.

  • Keep SVG simple, accessible, and editable.
  • Include <title> and meaningful text labels.
  • Prefer rectangles, lines, arrows, and groups over complex paths.
  • Do not embed external fonts or remote images.

Rendering files

When the user asks for PNG/SVG/PDF, create a source file and run:

python "<SKILL_ROOT>/diagram-generator/scripts/render_diagram.py" input.mmd --format svg --out output.svg
python "<SKILL_ROOT>/diagram-generator/scripts/render_diagram.py" input.dot --format png --out output.png
python "<SKILL_ROOT>/diagram-generator/scripts/render_diagram.py" input.puml --format svg --out output.svg

<SKILL_ROOT> is the actual path of this package's skills/ directory; the AI should detect it automatically.

The renderer is intentionally dependency-tolerant. It tries common local tools and reports actionable installation hints if a renderer is unavailable. Do not claim an image was rendered unless the script completed successfully and the output file exists.

Validation checklist

Before finalizing:

  • The diagram type matches the user's task.
  • The source is syntactically plausible for the chosen language.
  • Labels are short enough to fit.
  • Edges and message order reflect the input accurately.
  • Assumptions are called out when the input was incomplete.
  • For generated files, the output exists and opens or has nonzero size.

Common response template

Use this structure for most diagram answers:

Here is the editable [language] version:

```[language]
[source]

Assumptions:

  • [only if needed]

Rendered file: [link] [only if generated]


For English user requests, respond in English. For Chinese user requests, respond in Chinese unless they ask otherwise.

---

## On-Demand Bootstrap

### Automation capability boundaries

| Tool | Auto-installable | Install method | Notes |
|------|-----------------|----------------|-------|
| Mermaid CLI (mmdc) | ✓ | npm install -g @mermaid-js/mermaid-cli | Renders Mermaid to PNG/SVG |
| Graphviz (dot) | ✗ | Manual install | https://graphviz.org/download/ |
| PlantUML | ✗ | Requires Java + plantuml.jar | https://plantuml.com/download |
| Python (render script) | ✓ | Already included in bootstrap | `scripts/render_diagram.py` dependency |

### Notes

This skill primarily outputs text-based diagram source (Mermaid/DOT/PlantUML) and does not necessarily require local rendering tools. The corresponding renderer is needed only when the user explicitly asks for PNG/SVG/PDF files.

If a renderer is unavailable, `scripts/render_diagram.py` outputs installation hints instead of failing with an error.

---

## Routing Context

**Upstream entry**: `skills/SKILL.md` (master control), `routing.md`
**Trigger conditions**: user says "draw a diagram", "flowchart", "architecture diagram", "attack path diagram", "sequence diagram", "Mermaid", "Graphviz", "PlantUML"
**Downstream outputs**:
- Generated diagrams can be embedded in reports from `docs-generator/`
- Attack path diagrams can be used alongside penetration test reports from `pentest-tools/`

**Peer modules**: `docs-generator/` (diagrams embedded in reports)


## Task Completion Self-Check (MUST pass before claiming completion)

- [ ] Did I execute every step of the workflow (rather than just reading it)?
- [ ] Did I use real tool paths based on `tool-index`?
- [ ] Did I produce reproducible evidence (commands/scripts/screenshots/reports)?
- [ ] Did I complete and write back the Checklist items required by RULES?

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.