svg
Generate professional-quality diagrams as raw SVG. Use when the diagram-router selects SVG, or when the user needs pixel-precise control, custom visuals, threat models, comparisons, Venn diagrams, or any diagram type that other formats cannot handle well. SVG is the most expressive format -- unlimited visual possibilities, browser-native rendering.
What this skill does
# SVG Diagram Skill
Generate professional, whitepaper-quality diagrams as raw SVG. Each diagram should look distinct -- the right visual form for the content, not a templated layout.
**When to use SVG over other formats:**
- User wants maximum visual quality and custom design
- Diagram type lacks native support in Mermaid/D2 (threat models, comparisons, Venn, hub-spoke)
- Pixel-precise positioning is needed
- Output must render in any browser without JS dependencies
- User explicitly requests SVG
**When another format may be better:**
- Quick documentation diagrams that will live in GitHub markdown (Mermaid)
- Informal whiteboard-style sketches (Excalidraw)
- Architecture diagrams where auto-layout is preferred over manual positioning (D2)
Consult the **design-system** skill for color, typography, composition, and quality rules that apply across all formats.
## Workflow
### 1. Understand Intent
Before generating anything, establish:
- **What story does the diagram tell?** The answer determines the diagram type.
- **Who is the audience?** (executives, engineers, customers, mixed)
- **What are the key relationships?** (hierarchy, sequence, data flow, comparison, threat surface)
- **Are there source documents?** Read them -- extract real terminology and structure.
### 2. Choose the Right Diagram Type
**This is the most important decision.** Do not default to a layered architecture stack. Each content type has a natural visual form:
| Content | Best Diagram Type | Why |
|---------|-------------------|-----|
| System components and layers | Layered architecture | Shows hierarchy and containment |
| Request/response lifecycle | Sequence diagram | Shows temporal ordering between actors |
| Data or process pipeline | Flow diagram (LTR or TTB) | Shows transformation steps |
| Attack surface / threat model | Threat flow with trust boundaries | Shows where controls intersect threats |
| Before/after or option comparison | Side-by-side comparison | Shows contrast |
| Central service with consumers | Hub and spoke | Shows radial relationships |
| Capability x category mapping | Matrix / grid | Shows coverage |
| State transitions | State machine | Shows conditions and transitions |
| Timeline with milestones | Roadmap / timeline | Shows progression |
| Org/team responsibility | Swimlane diagram | Shows who does what |
| Token/identity merging | Composition diagram | Shows inputs converging to output |
| Decision logic | Decision tree / flowchart | Shows branching paths |
| Set overlaps | Venn diagram | Shows shared/unique characteristics |
If the content could work as multiple types, choose the one that best highlights the **primary relationship** the reader needs to understand. When in doubt, ask the user.
Consult [layout-patterns.md](references/layout-patterns.md) for structural guidance and SVG construction patterns for each type.
### 3. Generate the SVG
Build the SVG using the component library in [svg-design-system.md](references/svg-design-system.md). **Read the "Common SVG Mistakes" section first** -- it lists the most frequent errors. Core principles:
- **Always use `<defs>`** for gradients, shadows, markers -- define once, reference everywhere
- **System fonts** -- `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif`
- **Depth through gradients and shadows** -- not flat fills
- **Generous whitespace** -- padding is a design element
- **Visual hierarchy** through size, color weight, and elevation (shadows)
Beyond these fundamentals, **adapt the visual treatment to the diagram type**:
- A sequence diagram needs lifelines, activation bars, and message arrows -- not rounded boxes with bullet points
- A threat model needs trust boundaries (dashed regions), threat actors, and control points -- not a platform container
- A timeline needs a horizontal axis with markers -- not stacked layers
- A state machine needs circles/rounded-rects for states and labeled transitions
The design system references are a **toolkit of components**, not a template. Select the right components for the diagram type.
### 4. Validate
After writing the SVG file, run the validation script to check for layout issues:
```bash
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/validate-svg.py <file.svg>
```
The validator checks for:
- **OVERLAP**: Arrow lines passing through unrelated boxes
- **PARALLEL**: Parallel arrows closer than 30px (visually merge)
- **LABEL-LINE**: Labels overlapping arrow lines
- **LABEL-BOX**: Labels overlapping unrelated boxes
- **PADDING**: Container boundaries clipping enclosed elements
**Exit codes**: 0 = clean, 1 = issues found, 2 = parse error.
**How to interpret results:**
- **OVERLAP and PARALLEL** are the most critical -- these are structural defects that must be fixed by rerouting arrows or adding separation
- **LABEL-LINE** usually means a label needs to be repositioned (offset 8-12px from the line)
- **LABEL-BOX** can be false positives for labels intentionally inside boxes (the validator does not know which labels belong to which boxes by default) -- focus on cases where a label from one element overlaps a different element's box
- **PADDING** means a dashed container boundary is too tight around an enclosed element -- expand the container or shrink the element
Fix any OVERLAP or PARALLEL issues before presenting to the user. LABEL and PADDING issues are worth fixing but are lower priority.
### 5. Iterate
Present the SVG and ask for feedback. Common refinements: information density, visual emphasis, terminology alignment, color palette, annotations.
## SVG Document Structure
Every generated SVG follows this structure:
```xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {width} {height}"
font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"
role="img" aria-labelledby="diagramTitle diagramDesc">
<title id="diagramTitle">{Concise diagram title}</title>
<desc id="diagramDesc">{1-2 sentence description}</desc>
<defs>
<!-- Gradients, shadows, markers, patterns -->
</defs>
<rect width="{width}" height="{height}" fill="#FAFBFC"/>
<!-- Content groups, ordered back-to-front -->
</svg>
```
### Required Accessibility Elements
- `role="img"` on the root `<svg>` element
- `<title>` with a concise diagram name
- `<desc>` with a 1-2 sentence description
- `aria-labelledby="diagramTitle diagramDesc"`
### Canvas Sizes
| Diagram Type | Recommended viewBox |
|---|---|
| Architecture | `0 0 1400 1000` |
| Sequence | `0 0 1400 800` to `0 0 1600 900` |
| Flow | `0 0 1400 600` to `0 0 1600 800` |
| Threat model | `0 0 1400 900` |
| Timeline | `0 0 1500 600` to `0 0 1500 700` |
| State machine | `0 0 1200 800` |
| Comparison | `0 0 1400 700` |
| Compact/embed | `0 0 1000 600` |
## SVG-Specific Rules
### Common Mistakes to Avoid
1. **DO NOT use CSS `style` attribute on `<svg>`** -- use SVG attributes directly. CSS `background` does not work when SVG is used as `<img>` source.
2. **DO NOT use `rgba()` in fill/stroke** -- use `fill="white" fill-opacity="0.18"` instead.
3. **DO NOT make diagonal gradients** unless intentional -- use `x1="0%" y1="0%" x2="0%" y2="100%"` for top-to-bottom.
4. **DO NOT use V-shaped arrowheads** (open chevrons) -- use filled triangles: `M0,0 L12,4 L0,8 L3,4 Z`.
5. **DO NOT use `text-transform` as SVG attribute** -- it is CSS-only. Write the text in uppercase directly.
6. **ALWAYS use background `<rect>`** -- not CSS background. `<rect width="{w}" height="{h}" fill="#FAFBFC"/>` as first child after `<defs>`.
### Arrow and Layout Clearance Rules
These rules prevent the most common SVG quality issues -- overlapping arrows, lines running through boxes, and labels colliding with elements.
**Arrow routing -- NEVER route through unrelated boxes:**
- Before drawing any arrow/line path, check whether it crosses through a box it is not connected to
- If a straight line would pass through an intermediate box, route AROUNDRelated in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.