technical-diagrams
Provides Mermaid diagram syntax, best practices, and styling rules for technical visualizations. Use when creating diagrams, flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, architecture diagrams, C4 diagrams, visualizations, or any visual documentation in markdown. Always use this skill when generating or updating Mermaid code blocks.
What this skill does
# Technical Diagrams
Mermaid is the standard for all technical diagrams in this project. It renders natively in GitHub, GitLab, MkDocs (with Material theme), and most modern documentation platforms.
This skill provides:
- **Critical styling rules** to ensure readability (especially color contrast)
- **Quick reference** examples for common diagram types
- **Reference files** for advanced syntax when building complex diagrams
Always wrap Mermaid code in fenced code blocks with the `mermaid` language identifier.
---
## Why Mermaid
**Native rendering** — GitHub, GitLab, Notion, MkDocs, and Docusaurus render Mermaid blocks without plugins or build steps. No external image generation tools needed.
**Text-based and diffable** — Diagrams live alongside code in version control. Changes appear in pull request diffs, making reviews straightforward and history trackable.
**No external tools** — No Lucidchart exports, no draw.io XML files, no PNG screenshots that go stale. The diagram source is the single source of truth.
**Maintainable** — Updating a diagram means editing text, not wrestling with a GUI. Refactoring a component name? Find-and-replace works on diagrams too.
**Consistent** — A shared syntax produces visually consistent diagrams across all documentation, regardless of who authored them.
---
## Critical Styling Rules
**This is the most important section.** Light text on light backgrounds is the most common Mermaid readability issue. Follow these rules strictly.
### Rule 1: Always use dark text on nodes
Every node must have `color:#000` (or another dark color like `#1a1a1a`, `#333`). Never use white, light gray, or any light-colored text.
> **Caveat — this assumes a light page.** `color:#000` is correct for GitHub and MkDocs **light** mode, but it is *not* self-sufficient on renderers that auto-switch themes — most notably MkDocs Material's dark (`slate`) scheme, which flips Mermaid's theme colors and turns this dark text light-on-light. When a diagram will render on a dark-capable site, pair this palette with the dark-mode companion stylesheet in **[Dark-mode rendering](#dark-mode-rendering-mkdocs-material--other-auto-theming-renderers)** below. Do **not** "fix" it by switching to light text — that just inverts the problem.
### Rule 2: Use `classDef` for consistent styling
Define reusable styles at the bottom of the diagram and apply them with `:::` syntax:
```mermaid
flowchart LR
A[Input]:::primary --> B[Process]:::secondary --> C[Output]:::success
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
classDef success fill:#dcfce7,stroke:#16a34a,color:#000
```
### Rule 3: Safe color palettes
Use these pre-tested combinations that guarantee readability:
| Style Name | Fill | Stroke | Text | Use For |
|-----------|------|--------|------|---------|
| `primary` | `#dbeafe` | `#2563eb` | `#000` | Main components, entry points |
| `secondary` | `#f3e8ff` | `#7c3aed` | `#000` | Supporting components |
| `success` | `#dcfce7` | `#16a34a` | `#000` | Success states, outputs |
| `warning` | `#fef3c7` | `#d97706` | `#000` | Warnings, caution areas |
| `danger` | `#fee2e2` | `#dc2626` | `#000` | Errors, critical items |
| `neutral` | `#f3f4f6` | `#6b7280` | `#000` | Background, inactive items |
### Bad vs Good
**Bad — light text is invisible on light background:**
```
classDef bad fill:#dbeafe,stroke:#2563eb,color:#93c5fd
```
**Good — dark text is always readable:**
```
classDef good fill:#dbeafe,stroke:#2563eb,color:#000
```
---
## Supported Diagram Types
| Diagram Type | Mermaid Keyword | Use Case | Reference File |
|-------------|----------------|----------|----------------|
| Flowchart | `flowchart` | Process flows, decision trees, pipelines | `references/flowcharts.md` |
| Sequence | `sequenceDiagram` | API interactions, message passing, protocols | `references/sequence-diagrams.md` |
| Class | `classDiagram` | Object models, interfaces, relationships | `references/class-diagrams.md` |
| State | `stateDiagram-v2` | State machines, lifecycle management | `references/state-diagrams.md` |
| ER | `erDiagram` | Database schemas, entity relationships | `references/er-diagrams.md` |
| C4 | `C4Context` / `C4Container` / etc. | System architecture, containers, components | `references/c4-diagrams.md` |
**To load a reference file:**
```
Read ${CLAUDE_PLUGIN_ROOT}/skills/technical-diagrams/references/<file>.md
```
---
## Quick Reference
Minimal copy-paste examples for simple diagrams. For complex use cases, load the corresponding reference file.
### Flowchart
```mermaid
flowchart TD
A[Start]:::primary --> B{Decision}:::neutral
B -->|Yes| C[Action A]:::success
B -->|No| D[Action B]:::warning
C --> E[End]:::primary
D --> E
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef success fill:#dcfce7,stroke:#16a34a,color:#000
classDef warning fill:#fef3c7,stroke:#d97706,color:#000
classDef neutral fill:#f3f4f6,stroke:#6b7280,color:#000
```
### Sequence Diagram
```mermaid
sequenceDiagram
participant C as Client
participant S as Server
participant D as Database
C->>S: POST /api/resource
activate S
S->>D: INSERT INTO resources
D-->>S: OK
S-->>C: 201 Created
deactivate S
```
### Class Diagram
```mermaid
classDiagram
class Service {
-repository: Repository
+create(data: CreateDTO): Entity
+findById(id: string): Entity
}
class Repository {
<<interface>>
+save(entity: Entity): void
+findById(id: string): Entity
}
Service --> Repository : uses
```
### State Diagram
```mermaid
stateDiagram-v2
[*] --> Draft
Draft --> Review : submit
Review --> Approved : approve
Review --> Draft : reject
Approved --> Published : publish
Published --> [*]
```
### ER Diagram
```mermaid
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : "appears in"
USER {
int id PK
string email UK
string name
}
ORDER {
int id PK
int user_id FK
date created_at
}
```
### C4 Context Diagram
```mermaid
C4Context
title System Context Diagram
Person(user, "User", "End user of the system")
System(system, "Application", "Main system under design")
System_Ext(ext, "External API", "Third-party service")
Rel(user, system, "Uses", "HTTPS")
Rel(system, ext, "Calls", "REST API")
```
---
## Styling and Theming
### `classDef` — Reusable Style Classes
Define once, apply to many nodes:
```mermaid
flowchart LR
A[Node A]:::primary --> B[Node B]:::secondary
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
```
### `:::` Shorthand — Apply Class Inline
```
A[Label]:::className
```
### `style` — One-Off Inline Styling
For single-node overrides (prefer `classDef` for consistency):
```
style nodeId fill:#dbeafe,stroke:#2563eb,color:#000
```
### Standard Style Classes
Define these at the bottom of any diagram that uses multiple styles:
```
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
classDef success fill:#dcfce7,stroke:#16a34a,color:#000
classDef warning fill:#fef3c7,stroke:#d97706,color:#000
classDef danger fill:#fee2e2,stroke:#dc2626,color:#000
classDef neutral fill:#f3f4f6,stroke:#6b7280,color:#000
```
### Subgraph Styling
Subgraphs can be styled via `style` directives:
```mermaid
flowchart LR
subgraph backend["Backend Services"]
A[API]:::primary --> B[Worker]:::secondary
end
style backend fill:#f8fafc,stroke:#94a3b8,color:#000
```
### Edge Styling with `linkStyle`
Style specific edges by their index (0-based, in order of definition):
```
linkStyle 0 stroke:#2563eb,stroke-width:2px
linkStyle 1 stroke:#dc2626,stroke-wiRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.