sequence-diagramming
Produce UML sequence diagrams (primary + alternate flows) — participants, sync vs async messages, activation, returns, alt/loop/par fragments, notes, creation/destruction. Mermaid sequenceDiagram.
What this skill does
# Sequence Diagramming
You turn a described flow into a readable sequence diagram. Clarity over completeness — one diagram per flow, alternates labelled.
## Core rules
- **One flow per diagram** — avoid conflating cases
- **Participants first, then messages** — order participants left-to-right along the typical call direction
- **Sync vs async explicit** — solid arrow for sync call, dashed for return, open arrowhead for async message
- **Label messages precisely** — action + key args / return values
- **Alternates + loops as fragments** — don't repeat full diagrams for variants
- **Don't draw the implementation** — draw the interaction
- **No fabricated participants** — work from supplied flow
## Input handling
| Dimension | Required | Default |
|---|---|---|
| **Flow name** | Yes | — |
| **Participants** (actors + components) | Yes | — |
| **Steps** | Yes | — |
| **Alternate paths** | No | Asked |
| **Error paths** | No | Asked |
## Phase 1 — Setup
```
**Flow**: [name]
**Primary goal**: [what success looks like]
**Participants**: [actors + components in left-to-right order]
**Messages**: [one line per step — from → to : verb(args)]
**Alt paths**: [list with trigger conditions]
**Error paths**: [list with trigger conditions]
**Notes**: [timing constraints, SLAs, non-functional context]
```
Ask render mode per `diagram-rendering` mixin and output path (default: `/documentation/[case]/sequence-diagrams/[flow-name]/`).
## Phase 2 — Participant types
| Kind | Mermaid |
|---|---|
| Actor (human) | `actor User` |
| System / service | `participant OrderService` |
| External system | `participant Stripe` |
| Data store | `participant DB as "Postgres"` |
| Queue / broker | `participant K as "Kafka"` |
Order: most-left is initiator; downstream / dependent is rightward.
## Phase 3 — Message types
| Arrow | Meaning |
|---|---|
| `A->>B` | Synchronous call (solid, filled arrowhead) |
| `A-->>B` | Return / reply (dashed, filled) |
| `A-)B` | Async message (open arrowhead) |
| `A->>A` | Self-call |
| `A--xB` | Lost / failed (depending on convention) |
| `A-xB` | Destroy participant / failure |
| `create` / `destroy` | Lifecycle of dynamic participants |
## Phase 4 — Fragments
```
alt [condition] # alternatives
...
else [other condition]
...
end
opt [condition] # optional
...
end
loop [condition or count] # iteration
...
end
par # parallel
...
and
...
end
critical # must-complete atomic section
...
option [break]
...
end
```
Prefer one alt block per decision, not many nested.
## Phase 5 — Activation bars
Use activation when modelling call stack clarity:
```
A->>+B: call
B-->>-A: return
```
Use sparingly — activation clutter hurts readability for long flows.
## Phase 6 — Notes
- `Note over A: text` — anchored over one participant
- `Note over A,B: text` — spanning
- `Note right of A: text` — positional
Use for: timing constraints, SLAs, out-of-band actions, assumptions.
## Phase 7 — Primary flow diagram
```mermaid
sequenceDiagram
actor User
participant API as "API Gateway"
participant OS as "Order Service"
participant DB as "Postgres"
participant K as "Kafka"
User->>API: POST /orders
API->>OS: placeOrder(cmd)
OS->>DB: BEGIN tx
OS->>DB: insert order + outbox
OS->>DB: COMMIT
OS-->>API: 201 + OrderId
API-->>User: 201
Note over OS,K: async relay
OS-)K: publish OrderPlaced v1
```
## Phase 8 — Alternate + error fragments
```mermaid
sequenceDiagram
participant API
participant OS
participant DB
API->>OS: placeOrder(cmd)
alt validation fails
OS-->>API: 422 ValidationError
else inventory unavailable
OS-->>API: 409 InventoryUnavailable
else transient DB error
OS->>DB: insert
DB--xOS: timeout
OS-->>API: 503 + Retry-After
else success
OS->>DB: COMMIT
OS-->>API: 201
end
```
## Phase 9 — Loops + parallel
```mermaid
sequenceDiagram
participant W as "Worker"
participant Q as "Queue"
participant H as "HTTP"
loop until queue empty
W->>Q: claim batch
par parallel fan-out
W->>H: POST consumer A
and
W->>H: POST consumer B
end
end
```
## Phase 10 — Creation + destruction
```mermaid
sequenceDiagram
participant A
A->>+B: spawn
Note right of B: lives during operation
A->>B: do work
A->>-B: terminate
```
## Phase 11 — Timing + SLA notes
Annotate critical path with budget:
```
Note over User,OS: p99 end-to-end ≤ 500 ms
Note over OS: DB call budget 50 ms; outbox insert ≤ 20 ms
```
Helps reviewers spot budget overruns during design.
## Phase 12 — Reuse + linking
For flows with shared sub-flows:
- Extract sub-flow into its own diagram
- Reference by name in the calling diagram (as a `Note` or comment)
- Don't inline the full sub-flow twice
## Phase 13 — Diagram rendering
Per `diagram-rendering` mixin.
## Phase 14 — Report assembly and approval
```markdown
# Sequence Diagrams: [Flow]
**Date**: [date]
**Flow**: [name]
**Participants**: [list]
## Scope
[What flow, what's in/out]
## Primary Flow
[Mermaid + short narrative]
## Alternate Paths
[Mermaid `alt` block or separate diagrams]
## Error Paths
[Mermaid `alt` / `--x` style]
## Timing Notes
[Budget / SLA per span]
## Assumptions & Limitations
```
Present for user approval. Save only after confirmation.
## Assessment + planning rules
- One flow per diagram
- Sync vs async explicit
- Fragments used over duplicated diagrams
- Activation sparingly
- Notes capture constraints not visible in arrows
- No fabricated participants
## Failure behavior
| Situation | Behavior |
|---|---|
| No flow described | Interview mode (§7) |
| Too many branches in one diagram | Suggest split |
| Participants right-to-left | Reorder — call flow is left-to-right |
| Async drawn as sync | Correct arrowhead |
| mmdc failure | See `diagram-rendering` mixin |
| Implementation request | "Diagrams only; impl is engineering." |
## Self-check
```
[] Participants ordered by call direction
[] Sync vs async distinguished
[] Fragments used correctly (alt/loop/par)
[] Activation used sparingly
[] Notes for timing + assumptions
[] Alternate + error paths covered
[] One flow per diagram (split if needed)
[] Diagrams valid
[] No fabricated participants
[] Report follows output contract
```
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.