sc-mermaid
Generate mermaid diagrams — flowcharts for architecture, sequence diagrams for interactions. This skill SHOULD be used when the user asks to "create a diagram", "draw an architecture diagram", "sequence diagram", "flowchart", "visualize the system", or "generate mermaid".
What this skill does
# sc-mermaid: Mermaid Diagram Generator
Generate mermaid diagrams for architecture visualization and interaction flows.
**Input**: $ARGUMENTS
## Mode Detection
Parse `$ARGUMENTS` to determine diagram type:
| Signal | Mode |
|--------|------|
| `flowchart`, `architecture`, `system`, component relationships | **Flowchart** |
| `sequence`, `flow`, `interaction`, request/response patterns | **Sequence** |
| Ambiguous | Ask the user or infer from context |
---
## Flowchart Mode
### Investigation
1. Scope identification: Determine which components, services, and relationships to include
2. Architecture analysis: Read relevant files and understand data/control flow
3. Validation: Cross-reference findings against codebase to ensure accuracy
### Diagram Requirements
- Use TB (top-bottom) or LR (left-right) direction based on flow complexity
- Apply the neutral theme for professional rendering
- Use semantic node shapes:
- `[Rectangle]` — services, applications
- `[(Database)]` — data stores (PostgreSQL, Redis, OpenSearch)
- `((Circle))` — external services, APIs
- `[[Subroutine]]` — modules, workers, background jobs
- `{Rhombus}` — decision points, routing logic
- `{{Hexagon}}` — gateways, proxies, middleware
- Style nodes and links using CSS classes for visual grouping
- Label every relationship with meaningful text
- Group related components with subgraphs (quote subgraph titles)
### Deliverables
1. Mermaid diagram file (`{descriptive-name}.mmd`)
2. Syntax validation: `mmdc -i <file>.mmd --parseOnly` (fix errors if any)
3. Bulleted architectural explanation
4. Validation report with file path references
5. Viewing instructions (optionally render: `mmdc -i <file>.mmd -o preview.png`)
---
## Sequence Mode
Generate diagrams compatible with `mermaid-ascii` for terminal rendering.
### Syntax Reference (mermaid-ascii parser)
**Works:**
```
sequenceDiagram # REQUIRED first line
participant A as Alice # aliases (optional)
"Quoted Name" # spaces in names
A->>B: message # solid arrow (colon REQUIRED)
A-->>B: message # dotted arrow (colon REQUIRED)
A->>A: self # self-message (use for notes)
%% comment # ignored by parser
```
**Fails:**
```
A->B: msg # wrong arrow (needs ->>)
A-->B: msg # wrong arrow (needs -->>)
A->>B # missing colon
Note over A # not implemented
loop/alt/opt # not implemented
activate A # not implemented
```
### Design Rules
1. **Colon is mandatory**: `A->>B: text` works, `A->>B` fails
2. **Only ->> and -->>**: No other arrow types parse
3. **Self-messages for notes**: `A->>A: (thinking)` instead of `Note`
4. **Comments for structure**: `%% Phase 1:` or `%% alt: if X then Y`
5. **Short labels**: ASCII rendering is wide; keep messages brief
6. **Limit participants**: 4-6 max for terminal readability
### Workflow
1. Understand the flow from $ARGUMENTS or ask clarifying questions
2. Identify actors — use clear short names
3. Map interactions between them
4. Generate diagram following the template
5. Validate: `cat <file> | mermaid-ascii -f -`
6. Save file and show both source and ASCII render
### Template
```
%% Flow: [title]
%% Render: cat <file> | mermaid-ascii -f -
sequenceDiagram
participant A as ActorOne
participant B as ActorTwo
%% Phase 1: [description]
A->>B: request
B-->>A: response
```
### Example: API Request Flow
```
%% Flow: API authentication
%% Render: cat api-auth.mmd | mermaid-ascii -f -
sequenceDiagram
participant C as Client
participant G as Gateway
participant A as Auth
participant S as Service
C->>G: POST /api/data
G->>A: validate token
A-->>G: valid
G->>S: forward request
S-->>G: response
G-->>C: 200 OK
%% alt: invalid token
%% A-->>G: 401
%% G-->>C: 401 Unauthorized
```
### Validation
Before saving, ALWAYS test with:
```bash
cat <<'EOF' | mermaid-ascii -f -
[your diagram here]
EOF
```
If it errors, fix the syntax. Common fixes:
- Add missing colon after target: `A->>B` -> `A->>B:`
- Fix arrow type: `A->B:` -> `A->>B:`
- Remove unsupported syntax (Notes, loops, etc.)
---
## Output
Write diagram to `{descriptive-name}.mmd` in the current directory (or ask user for location).
Include in the file:
- Diagram code
- Architectural explanation as markdown comments
- Validation notes with file path references
$ARGUMENTS
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.