The skill assumes diagrams are a TOOL, not the goal. Many docs (Jira tickets, short ADRs, runbook steps) need no diagram at all.
| Venue / Intent |
Doc Type |
Typical Sections |
Diagram? |
| New system / major architecture choice |
Design doc / RFC |
Context, Goals, Non-goals, Decision, Alternatives, Risks, Open questions |
Usually yes (1-3) |
| Bug or task assignment |
Jira ticket |
Summary, Repro, Expected vs Actual, Acceptance criteria |
Usually no |
| Service / repo intro |
README |
What, Why, Run locally, Architecture, Contributing |
Sometimes (1 architecture) |
| One specific decision |
ADR |
Status, Context, Decision, Consequences |
Rarely |
| Incident response |
Postmortem |
Timeline, Impact, Root cause, Remediation, Action items |
Optional (sequence/timeline) |
| Operational procedure |
Runbook |
Trigger, Steps, Verification, Rollback |
Optional (decision tree) |
| Cross-team alignment |
Tech proposal |
Problem, Proposed approach, Tradeoffs, Migration plan |
Often (state-before/after) |
The decision tree is suggestive, not prescriptive — ask the user what venue the doc lives in (Confluence, Jira, GitHub, code repo, Slack) before picking the shape.
**Summary** (one sentence — what the work is)
**Why now / context**
[1-3 lines of background. Link the parent epic if one exists.]
**Acceptance criteria**
- [ ] Specific, observable outcome 1
- [ ] Specific, observable outcome 2
- [ ] Tests added / updated
**Out of scope**
[Anything a reviewer might assume is in but isn't.]
**Notes / links**
- Related PRs:
- Related Jira: PBAT-...
- Slack thread:
Skip diagrams in tickets unless the work is intrinsically visual (e.g. a new sequence between services). If the ticket is being filed from a design doc, link the design doc — don't restate it.
Before creating: GREP the epic / sibling tickets for already-shipped overlapping work (from feedback-grep-epic-before-filing).
# <Title>
## Context
Why this exists. What problem we're solving. Link prior art.
## Goals
Bulleted, observable success conditions.
## Non-goals
What this explicitly does NOT solve. Prevents scope creep in review.
## Proposed design
The actual decision + how it works. THIS is where diagrams usually go.
## Alternatives considered
Each alternative + why it lost. One paragraph each — not a survey.
## Risks / open questions
Honest list. Open questions belong here, not in chat.
## Migration / rollout
If applicable: stages, kill switches, rollback plan.
## Verification
How we'll know it worked — metrics, tests, monitors.
Keep alternatives honest — reviewers smell straw-man comparisons. Cite real evidence (links to issues, PRs, benchmark runs) rather than asserting tradeoffs.
| Tool |
Use For |
Input |
mcp__drawio__open_drawio_mermaid |
Any Mermaid source you just generated |
Raw Mermaid text (the same string you'd put inside a ```mermaid fence) |
mcp__drawio__open_drawio_xml |
Hand-authored mxGraph XML, or XML exported from another tool |
draw.io XML |
mcp__drawio__open_drawio_csv |
Tabular node/edge data |
CSV per draw.io's CSV import spec |
Default workflow:
- Decide diagram type (see
<diagram_type_decision_tree>)
- Generate Mermaid source applying the patterns + styling rules below
- Call
mcp__drawio__open_drawio_mermaid with that source — DO NOT paste it as a Markdown fence first
- Also keep the Mermaid source in the design doc (or under
./diagrams/<name>.mmd) so it's diff-able in git
If the user explicitly asks for "just the Mermaid", skip step 3. If the doc has no diagrams (Jira ticket, short ADR), skip this whole block.
| User Request |
Diagram Type |
| "workflow", "process", "business logic", "user flow" |
Activity diagram (flowchart) |
| "infrastructure", "deployment", "cloud", "k8s" |
Deployment diagram |
| "system architecture", "components", "microservices" |
Architecture diagram |
| "API flow", "interactions", "request/response" |
Sequence diagram |
| "code to diagram" |
Analyze code → pick appropriate type(s) |
| "design document", "full docs" |
Multiple diagrams + prose |
|
|
Activity Diagram (Workflows)
flowchart TD
Start([Start]) --> Process[Process Data]
Process --> Check{Valid?}
Check -->|Yes| Save[Save]
Check -->|No| Error[Error]
Save --> Complete([Complete])
Architecture Diagram (Components)
graph TB
Client[User] --> LB[Load Balancer]
LB --> App1[App Server 1]
LB --> App2[App Server 2]
App1 --> DB[(Database)]
App1 --> Cache[(Redis)]
Sequence Diagram (API Flows)
sequenceDiagram
participant C as Client
participant A as API
participant D as Database
C->>A: POST /login
A->>D: Verify credentials
D-->>A: User record
A-->>C: JWT token
Deployment Diagram (Infrastructure)
graph TB
subgraph Cloud[Cloud Provider]
LB[Load Balancer]
subgraph Compute[Compute]
App1[Container 1]
App2[Container 2]
end
DB[(Database)]
Queue[Message Queue]
end
LB --> Compute
Compute --> DB
Compute --> Queue
Rules:
- Light background → Dark text color
- Always specify
color: in every classDef
- One diagram = one concept (single responsibility)
- Avoid emoji/Unicode symbols in node labels — draw.io's Mermaid import handles them inconsistently across themes. Use text labels and let
classDef carry the visual semantics.
- Identify framework — Look for routing patterns, decorators, annotations
- Map architecture — Controllers → Services → Repositories → Database
- Extract flows — Follow method call chains for sequence diagrams
- Find business logic — Conditionals and loops → activity diagrams
- Map infrastructure — Docker/K8s/cloud configs → deployment diagrams
Generate multiple diagram types from a single codebase when appropriate.
Quick checks:
- Every node referenced in an edge is defined somewhere
- Subgraph names don't collide with node IDs
classDef names referenced via class actually exist
- Pasted into https://mermaid.live renders without error
Only after the source validates, call mcp__drawio__open_drawio_mermaid. NEVER add a Mermaid fence to a Markdown doc until you've round-tripped it through validation.
The draw.io plugin renders the diagram in the browser — you don't need to also produce a .png. If the user wants a static image, ask them to export from inside draw.io (File → Export As → PNG/SVG) so the export carries the embedded XML for later editing.
1---2name: design-doc-diagrams3description: Write design docs, READMEs, Jira tickets, RFCs — with or without diagrams. Diagrams render via draw.io MCP plugin.4---56<objective>7Help the user write any document — design doc, README, Jira ticket, RFC, architecture proposal, runbook — at the right shape for its audience and venue. When a diagram makes the doc clearer (workflow, infra, API flow, system topology), generate Mermaid source and render it via the draw.io MCP plugin so the user gets an editable, shareable diagram instead of a static fence.89The skill assumes diagrams are a TOOL, not the goal. Many docs (Jira tickets, short ADRs, runbook steps) need no diagram at all.10</objective>1112<when_to_activate>13- User asks to "write a design doc", "draft a README", "create a Jira ticket", "write an RFC", "document this"14- User asks to "create a diagram", "generate mermaid", "code to diagram", "open in draw.io"15- User asks to turn a conversation, code, or notes into structured documentation16- User asks to update existing docs to match new code or decisions17</when_to_activate>1819<doc_type_decision_tree>20Pick the right shape before writing:2122| Venue / Intent | Doc Type | Typical Sections | Diagram? |23|---|---|---|---|24| New system / major architecture choice | Design doc / RFC | Context, Goals, Non-goals, Decision, Alternatives, Risks, Open questions | Usually yes (1-3) |25| Bug or task assignment | Jira ticket | Summary, Repro, Expected vs Actual, Acceptance criteria | Usually no |26| Service / repo intro | README | What, Why, Run locally, Architecture, Contributing | Sometimes (1 architecture) |27| One specific decision | ADR | Status, Context, Decision, Consequences | Rarely |28| Incident response | Postmortem | Timeline, Impact, Root cause, Remediation, Action items | Optional (sequence/timeline) |29| Operational procedure | Runbook | Trigger, Steps, Verification, Rollback | Optional (decision tree) |30| Cross-team alignment | Tech proposal | Problem, Proposed approach, Tradeoffs, Migration plan | Often (state-before/after) |3132The decision tree is suggestive, not prescriptive — ask the user what venue the doc lives in (Confluence, Jira, GitHub, code repo, Slack) before picking the shape.33</doc_type_decision_tree>3435<jira_ticket_shape>36Jira tickets are the most common shape that ISN'T a design doc. Default template:3738```39**Summary** (one sentence — what the work is)4041**Why now / context**42[1-3 lines of background. Link the parent epic if one exists.]4344**Acceptance criteria**45- [ ] Specific, observable outcome 146- [ ] Specific, observable outcome 247- [ ] Tests added / updated4849**Out of scope**50[Anything a reviewer might assume is in but isn't.]5152**Notes / links**53- Related PRs:54- Related Jira: PBAT-...55- Slack thread:56```5758Skip diagrams in tickets unless the work is intrinsically visual (e.g. a new sequence between services). If the ticket is being filed from a design doc, link the design doc — don't restate it.5960Before creating: GREP the epic / sibling tickets for already-shipped overlapping work (from `feedback-grep-epic-before-filing`).61</jira_ticket_shape>6263<design_doc_shape>64Heavyweight docs (RFC, design doc, tech proposal) follow a common skeleton — adapt section names to the org's template:6566```67# <Title>6869## Context70Why this exists. What problem we're solving. Link prior art.7172## Goals73Bulleted, observable success conditions.7475## Non-goals76What this explicitly does NOT solve. Prevents scope creep in review.7778## Proposed design79The actual decision + how it works. THIS is where diagrams usually go.8081## Alternatives considered82Each alternative + why it lost. One paragraph each — not a survey.8384## Risks / open questions85Honest list. Open questions belong here, not in chat.8687## Migration / rollout88If applicable: stages, kill switches, rollback plan.8990## Verification91How we'll know it worked — metrics, tests, monitors.92```9394Keep alternatives honest — reviewers smell straw-man comparisons. Cite real evidence (links to issues, PRs, benchmark runs) rather than asserting tradeoffs.95</design_doc_shape>9697<render_to_drawio>98When a diagram IS needed, draw.io MCP plugin (`@drawio/mcp`) is the primary render path. It builds a draw.io URL with the diagram in the URL `#fragment` (so the payload never leaves the user's machine) and opens it locally in the browser.99100| Tool | Use For | Input |101|------|---------|-------|102| `mcp__drawio__open_drawio_mermaid` | Any Mermaid source you just generated | Raw Mermaid text (the same string you'd put inside a ```mermaid fence) |103| `mcp__drawio__open_drawio_xml` | Hand-authored mxGraph XML, or XML exported from another tool | draw.io XML |104| `mcp__drawio__open_drawio_csv` | Tabular node/edge data | CSV per draw.io's CSV import spec |105106**Default workflow:**1071. Decide diagram type (see `<diagram_type_decision_tree>`)1082. Generate Mermaid source applying the patterns + styling rules below1093. Call `mcp__drawio__open_drawio_mermaid` with that source — DO NOT paste it as a Markdown fence first1104. Also keep the Mermaid source in the design doc (or under `./diagrams/<name>.mmd`) so it's diff-able in git111112If the user explicitly asks for "just the Mermaid", skip step 3. If the doc has no diagrams (Jira ticket, short ADR), skip this whole block.113</render_to_drawio>114115<diagram_type_decision_tree>116Analyze user intent to determine diagram type:117118| User Request | Diagram Type |119|--------------|-------------|120| "workflow", "process", "business logic", "user flow" | Activity diagram (flowchart) |121| "infrastructure", "deployment", "cloud", "k8s" | Deployment diagram |122| "system architecture", "components", "microservices" | Architecture diagram |123| "API flow", "interactions", "request/response" | Sequence diagram |124| "code to diagram" | Analyze code → pick appropriate type(s) |125| "design document", "full docs" | Multiple diagrams + prose |126</diagram_type_decision_tree>127128<diagram_patterns>129130### Activity Diagram (Workflows)131```mermaid132flowchart TD133 Start([Start]) --> Process[Process Data]134 Process --> Check{Valid?}135 Check -->|Yes| Save[Save]136 Check -->|No| Error[Error]137 Save --> Complete([Complete])138```139140### Architecture Diagram (Components)141```mermaid142graph TB143 Client[User] --> LB[Load Balancer]144 LB --> App1[App Server 1]145 LB --> App2[App Server 2]146 App1 --> DB[(Database)]147 App1 --> Cache[(Redis)]148```149150### Sequence Diagram (API Flows)151```mermaid152sequenceDiagram153 participant C as Client154 participant A as API155 participant D as Database156 C->>A: POST /login157 A->>D: Verify credentials158 D-->>A: User record159 A-->>C: JWT token160```161162### Deployment Diagram (Infrastructure)163```mermaid164graph TB165 subgraph Cloud[Cloud Provider]166 LB[Load Balancer]167 subgraph Compute[Compute]168 App1[Container 1]169 App2[Container 2]170 end171 DB[(Database)]172 Queue[Message Queue]173 end174 LB --> Compute175 Compute --> DB176 Compute --> Queue177```178</diagram_patterns>179180<styling_rules>181ALL diagrams MUST use high-contrast colors:182```mermaid183classDef primary fill:#90EE90,stroke:#333,stroke-width:2px,color:darkgreen184classDef secondary fill:#87CEEB,stroke:#333,stroke-width:2px,color:darkblue185classDef database fill:#E6E6FA,stroke:#333,stroke-width:2px,color:darkblue186classDef error fill:#FFB6C1,stroke:#DC143C,stroke-width:2px,color:black187```188189Rules:190- Light background → Dark text color191- Always specify `color:` in every `classDef`192- One diagram = one concept (single responsibility)193- Avoid emoji/Unicode symbols in node labels — draw.io's Mermaid import handles them inconsistently across themes. Use text labels and let `classDef` carry the visual semantics.194</styling_rules>195196<code_to_diagram>197When converting source code to diagrams:1981991. **Identify framework** — Look for routing patterns, decorators, annotations2002. **Map architecture** — Controllers → Services → Repositories → Database2013. **Extract flows** — Follow method call chains for sequence diagrams2024. **Find business logic** — Conditionals and loops → activity diagrams2035. **Map infrastructure** — Docker/K8s/cloud configs → deployment diagrams204205Generate multiple diagram types from a single codebase when appropriate.206</code_to_diagram>207208<validation>209Validate Mermaid syntax BEFORE calling the draw.io tool — a malformed Mermaid string will surface as a vague error in the browser tab.210211Quick checks:212- Every node referenced in an edge is defined somewhere213- Subgraph names don't collide with node IDs214- `classDef` names referenced via `class` actually exist215- Pasted into https://mermaid.live renders without error216217Only after the source validates, call `mcp__drawio__open_drawio_mermaid`. **NEVER add a Mermaid fence to a Markdown doc until you've round-tripped it through validation.**218</validation>219220<file_naming>221When persisting Mermaid source alongside docs:222```223./diagrams/<doc_name>_<num>_<type>_<title>.mmd224```225Example: `./diagrams/api_design_01_sequence_auth_flow.mmd`226227The draw.io plugin renders the diagram in the browser — you don't need to also produce a `.png`. If the user wants a static image, ask them to export from inside draw.io (File → Export As → PNG/SVG) so the export carries the embedded XML for later editing.228</file_naming>229230<best_practices>2311. **Pick the doc shape first** — design doc vs ticket vs README vs ADR vs postmortem. Asking which venue the doc lives in saves a rewrite.2322. **Diagrams are optional** — many docs are better with zero diagrams. Don't force one just because the skill name has "diagrams" in it.2333. **Render via draw.io** — when a diagram IS used, round-trip through `mcp__drawio__open_drawio_mermaid` unless the user opted out.2344. **Single Responsibility** — One diagram = one concept.2355. **High Contrast** — Never skip `color:` in styles.2366. **Validate Early** — Check Mermaid syntax before opening in draw.io.2377. **Keep the source in git** — `.mmd` files diff cleanly; draw.io XML does not.2388. **Honest alternatives** — In design docs, alternatives must read as plausible options the reviewer might prefer, not straw men.239</best_practices>240241<success_criteria>242- [ ] Doc shape matches the venue (Jira / Confluence / README / inline ADR)243- [ ] Audience is clear — explain to a stranger, not just the writer244- [ ] Diagrams included only where they make the doc clearer245- [ ] If diagrams used: high-contrast styling, Mermaid validated, `mcp__drawio__open_drawio_mermaid` called, source persisted to `.mmd`246- [ ] Single responsibility per diagram247- [ ] For Jira tickets: epic-grep done before file248- [ ] For design docs: alternatives are honest, not straw-manned249</success_criteria>