diff --git a/apps/skills/plannotator-visual-explainer/SKILL.md b/apps/skills/plannotator-visual-explainer/SKILL.md index fde2e93..7a887d0 100644 --- a/apps/skills/plannotator-visual-explainer/SKILL.md +++ b/apps/skills/plannotator-visual-explainer/SKILL.md @@ -2,124 +2,110 @@ name: plannotator-visual-explainer disable-model-invocation: true description: > - Generate beautiful, self-contained HTML visualizations themed with Plannotator's design system. - Wraps the visual-explainer skill by nicobailon with Plannotator theme token integration. Use for - architecture diagrams, diff reviews, plan reviews, data tables, slide decks, project recaps, or - any visual explanation of technical concepts — whenever you want output styled consistently with - Plannotator's UI and compatible with --render-html annotation. Triggers on the same prompts as - visual-explainer (diagrams, architecture overviews, visual plans, diff reviews) but produces - output that uses Plannotator CSS custom properties instead of custom palettes. + Generate self-contained HTML visualizations with Plannotator theming. Use for implementation + plans, PR explainers, architecture diagrams, data tables, slide decks, and any visual + explanation of technical concepts. Plans and PR explainers follow Plannotator's prescriptive + approach; all other visual content delegates to nicobailon/visual-explainer. --- # Plannotator Visual Explainer -This skill wraps [visual-explainer](https://github.com/nicobailon/visual-explainer) by Nico Bailon with Plannotator theme integration and additional component patterns. You follow visual-explainer's workflow, references, templates, and anti-slop rules — with Plannotator's color/typography tokens and extended patterns for plans and technical documents. +Three paths depending on content type. Each has its own references and structure. -## Setup +## Route by content type -Before generating, ensure `visual-explainer` is available: +**Implementation plan, design doc, or proposal** → Follow the [Plan path](#plan-path). Read `references/design-system.md` and `references/svg-patterns.md`. Prescriptive structure. -1. Check if the skill exists at any of these paths (in order): - - `~/.claude/skills/visual-explainer/SKILL.md` - - `~/.agents/skills/visual-explainer/SKILL.md` - - `~/.codex/skills/visual-explainer/SKILL.md` +**PR explainer, diff review, or code change walkthrough** → Follow the [PR path](#pr-path). Read `references/design-system.md` and `references/pr-components.md`. Prescriptive structure. -2. If not found, install it: - ```bash - npx skills add nicobailon/visual-explainer -g --yes - ``` +**Everything else** (architecture diagrams, data tables, slide decks, project recaps, general visual explanations) → Follow the [Visual explainer path](#visual-explainer-path). Delegates to nicobailon/visual-explainer with Plannotator theme tokens. -3. Read the visual-explainer `SKILL.md` to absorb its full workflow, diagram type routing, structure rules, and anti-slop guidelines. Read its `references/` and `templates/` as directed by its workflow. +## Delivery -## Theme Override +Always deliver via Plannotator's annotation UI. Do NOT use `open` or `xdg-open`. -Instead of visual-explainer's custom palettes and font pairings, use Plannotator's semantic theme tokens. Read `references/theme-override.md` for the exact CSS custom properties and mapping table. Apply these **after** reading visual-explainer's references — they replace only the color and typography layer. +**Plans/proposals** (user should approve/deny): +```bash +plannotator annotate --render-html --gate +``` -## Extended Patterns +**Everything else** (informational): +```bash +plannotator annotate --render-html +``` -Plannotator adds component patterns that complement visual-explainer's toolkit. Read `references/extended-patterns.md` for timelines, inline SVG diagrams, code blocks with syntax highlighting, risk tables, and open question callouts. Use these alongside Nico's `.ve-card`, `.kpi-card`, `.pipeline` components — they share the same theme tokens. +--- -## Design Philosophy: Use the Power of HTML +## Plan path -The point of generating HTML instead of markdown is spatial layout. Don't pack every piece of information into dense cards. Let the page breathe. +For implementation plans, design docs, feature specs, migration guides, and proposals. -- **Whitespace is a feature.** Generous padding, large section gaps, breathing room between cards. If a section feels cramped, it needs more space, not smaller text. -- **One idea per viewport.** The reader should be able to absorb one concept at a time as they scroll. A hero section, then a diagram, then a detail grid — not all three crammed together. -- **Visual weight signals importance.** Hero sections dominate (large type, accent-tinted backgrounds, more padding). Supporting details are compact and can collapse. Not everything deserves equal treatment. -- **Show, don't describe.** A timeline shows sequencing. A diagram shows relationships. A before/after grid shows change. A code block shows the interface. Use the right visual element — don't describe things in prose that a component could show directly. -- **Timelines show sequence without estimates.** Show the phases and their dependencies, but do not attach hour/day/week estimates. AI consistently misjudges timing. Showing phases in order communicates sequencing; attaching numbers communicates false precision. +**Before generating, read:** +1. `references/design-system.md` — Plannotator theme tokens, typography, component patterns +2. `references/svg-patterns.md` — inline SVG building blocks for architecture diagrams, flowcharts, data flow -## Workflow +**Document structure (in order, pick what fits):** -1. **Read** visual-explainer's SKILL.md (full workflow, diagram types, quality checks) -2. **Read** the relevant visual-explainer references and templates for your content type -3. **Read** `references/theme-override.md` for Plannotator color/typography tokens -4. **Read** `references/extended-patterns.md` for additional components (timelines, code blocks, risk tables, SVG diagrams) -5. **Generate** following visual-explainer's structure and rules, with Plannotator tokens and extended patterns. Use Nico's component classes (`.ve-card`, `.ve-card--hero`, `.kpi-card`, `.pipeline`, etc.) for cards and layout. Use the extended patterns for timelines, code blocks, risk tables, and SVG diagrams. -6. **Deliver** via Plannotator's annotation UI: +1. **Header** — eyebrow label (mono, uppercase), title (serif, large), prompt box (the original brief) +2. **Summary strip** — 3-5 stat cards showing key numbers at a glance (components, endpoints, tables, etc.) +3. **Milestones / timeline** — vertical timeline showing phases without time estimates. Phases show sequence and dependencies, not duration. +4. **Architecture / data flow** — inline SVG diagram. Use for 3+ interacting components. Highlighted boxes for new components, dashed arrows for async paths. +5. **Mockups** — build UI mockups in HTML/CSS directly, not as descriptions +6. **Key code** — dark-theme code blocks with syntax highlighting. Only architecturally significant interfaces/schemas — not every function. +7. **Risks & mitigations** — table with severity badges (HIGH/MED/LOW) +8. **Open questions** — callout cards with decision owner ("Decide with: backend team") -**If the output is a plan or proposal** (something the user should approve/deny): -```bash -plannotator annotate --render-html --gate -``` +Not every plan needs every section. Skip what doesn't serve the content. Never include time estimates, boilerplate sections, or exhaustive file lists. -**If the output is a visual explainer, diagram, or informational page:** -```bash -plannotator annotate --render-html -``` +**Adapt to the task:** Backend → lead with data flow. Frontend → lead with mockups. Refactoring → lead with before/after diagrams. Infrastructure → lead with architecture. -Always use `--render-html` so the HTML renders as-is in the Plannotator UI with theme inheritance and annotation support. Do NOT use `open` or `xdg-open` directly. +**Quality bar:** The plan answers "what, why, and how" within 30 seconds of reading. Whitespace is a feature — one idea per viewport. -## What visual-explainer provides (do not duplicate) +--- -All of these come from visual-explainer — read them there, don't reinvent them: -- Diagram type routing (architecture, flowchart, sequence, ER, state, mind map, etc.) -- Mermaid integration (theming, zoom controls, scaling, layout direction) -- CSS structural patterns (ve-card, grids, connectors, depth tiers, collapsibles) -- Slide deck mode (viewport-snapping presentations) -- Data table patterns (sticky headers, status indicators, responsive scrolling) -- Anti-slop rules (forbidden fonts, colors, animations, patterns) -- Quality checks (squint test, swap test, overflow protection) -- Animation guidelines (staggered entrance, reduced-motion support) +## PR path -## Plan-specific guidance +For PR walkthroughs, diff reviews, code change explainers, and reviewer guides. -When the output is an implementation plan, design doc, or proposal: +**Before generating, read:** +1. `references/design-system.md` — Plannotator theme tokens, typography, component patterns +2. `references/pr-components.md` — diff rendering, review comment bubbles, risk chips, file cards, before/after panels -**Adapt the visual vocabulary to the task:** -- **Backend/API work**: Lead with data flow diagrams, schemas, API signatures -- **Frontend/UI work**: Lead with mockups, component hierarchy, state flow -- **Infrastructure/DevOps**: Lead with architecture diagrams, deployment flow -- **Refactoring**: Lead with before/after diagrams showing structural change -- **Cross-cutting features**: Lead with a system map showing all touchpoints +**Document structure (in order, pick what fits):** -**Section menu — pick what fits:** -Solution overview, architecture/data flow diagram, UI mockups, key code, integration points, risks & mitigations, open questions, considerations & rationale, reusability & code quality. Not every plan needs every section — choose what serves the content. +1. **Header** — PR title, meta strip (file count, +/- lines, branch, author) +2. **TL;DR** — bordered card with primary accent left border. 2-3 sentences. Readers who see nothing else should get the gist. +3. **Why** — motivation and before/after comparison (two-column grid) +4. **File tour** — collapsible cards per file. Each has: file path + badge (NEW/MOD/DEL) + line stats, a "why" paragraph, and important diff hunks. High-risk files expanded, safe files collapsed. +5. **Risk map** — visual chips showing which files need careful review vs. which are mechanical. Three tiers: attention (destructive), medium (warning), safe (success). +6. **Where to focus** — numbered callout cards. Each names a file/function and describes the concern. +7. **Test plan** — checkbox-style verification checklist +8. **Rollout** (if applicable) — phased deployment with feature flags -**What NOT to include in plans:** -- Time estimates (timelines showing sequence are fine, hour/day estimates are not) -- Boilerplate sections that would just say "N/A" -- Exhaustive file lists — show the important files, not every file touched +Use Pierre diffs via CDN for syntax-highlighted inline diffs — see `references/pr-components.md` for the pattern. -**Quality bar for plans:** The plan should answer "what are we building, why, and how" within 30 seconds of reading. +--- + +## Visual explainer path -## PR explainer guidance +For architecture diagrams, data tables, slide decks, project recaps, comparisons, and any other visual explanation. -When the output is a PR walkthrough, diff review, or code change explainer: +**Before generating:** -- **TL;DR first** — a bordered card summarizing what the PR does and why, so readers who skim get the gist -- **Risk map** — visual chips showing which files need careful review vs. which are mechanical -- **Inline diffs** — use the diff rendering pattern from `references/extended-patterns.md` for important hunks (not every hunk) -- **File-by-file commentary** — collapsible cards per file with a "why" paragraph explaining the purpose of changes -- **"Where to focus"** — numbered callouts telling reviewers exactly what to look at and why -- **Before/after comparison** — two-column grid for behavior changes +1. Ensure `visual-explainer` is installed: + - Check: `~/.claude/skills/visual-explainer/SKILL.md` or `~/.agents/skills/visual-explainer/SKILL.md` + - If not found: `npx skills add nicobailon/visual-explainer -g --yes` +2. Read visual-explainer's `SKILL.md` (workflow, diagram types, anti-slop rules) +3. Read the relevant visual-explainer references and templates for your content type +4. Read `references/theme-override.md` — Plannotator tokens replacing Nico's palettes -See `references/extended-patterns.md` for diff rendering, review comment bubbles, and file badge patterns. +Follow visual-explainer's structure, component classes (`.ve-card`, `.kpi-card`, `.pipeline`), and anti-slop rules. The only override is the color/typography layer — Plannotator tokens instead of Nico's custom palettes. + +--- -## What this skill adds +## Design philosophy (all paths) -- Plannotator theme tokens (colors, typography, radii) — see `references/theme-override.md` -- Extended component patterns (timelines, code blocks, risk tables, SVG diagrams, open questions) — see `references/extended-patterns.md` -- Plan-specific guidance (section menu, adaptation by task type, quality bar) -- `--render-html` delivery with annotation support and theme inheritance -- Design philosophy emphasizing spatial layout, breathing room, and visual hierarchy +- **Whitespace is a feature.** Generous padding, large section gaps. If cramped, add space — don't shrink text. +- **One idea per viewport.** Hero section, then diagram, then detail grid — not all crammed together. +- **Show, don't describe.** A timeline shows sequencing. A diagram shows relationships. A code block shows the interface. +- **No time estimates.** Timelines show phases and dependencies. Never attach hour/day estimates. diff --git a/apps/skills/plannotator-visual-explainer/references/design-system.md b/apps/skills/plannotator-visual-explainer/references/design-system.md new file mode 100644 index 0000000..f28d6c1 --- /dev/null +++ b/apps/skills/plannotator-visual-explainer/references/design-system.md @@ -0,0 +1,560 @@ +# Design System Reference + +Plan documents use Plannotator's semantic theme tokens. This makes them theme-aware: standalone files render with bundled defaults; embedded in the Plannotator UI, they inherit whatever theme is active (30+ themes, light and dark variants). + +## Standalone defaults + +Include this `:root` block so the plan works when opened directly in a browser. These are the Plannotator light theme values — they get overridden when embedded. + +```css +:root { + --background: oklch(0.97 0.005 260); + --foreground: oklch(0.18 0.02 260); + --card: oklch(1 0 0); + --card-foreground: oklch(0.18 0.02 260); + --primary: oklch(0.50 0.25 280); + --primary-foreground: oklch(1 0 0); + --secondary: oklch(0.50 0.18 180); + --secondary-foreground: oklch(1 0 0); + --muted: oklch(0.92 0.01 260); + --muted-foreground: oklch(0.40 0.02 260); + --accent: oklch(0.60 0.22 50); + --accent-foreground: oklch(0.18 0.02 260); + --destructive: oklch(0.50 0.25 25); + --destructive-foreground: oklch(1 0 0); + --success: oklch(0.45 0.20 150); + --success-foreground: oklch(1 0 0); + --warning: oklch(0.55 0.18 85); + --warning-foreground: oklch(0.18 0.02 260); + --border: oklch(0.88 0.01 260); + --input: oklch(0.92 0.01 260); + --ring: oklch(0.50 0.25 280); + --code-bg: oklch(0.92 0.01 260); + + --font-sans: 'Inter', system-ui, -apple-system, sans-serif; + --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace; + --font-display: ui-serif, Georgia, 'Times New Roman', serif; + --radius: 0.625rem; +} +``` + +`--font-display` is plan-specific — used for headings and titles to create visual contrast with the body. It's not part of the core Plannotator theme, so it won't be overridden when embedded (which is the desired behavior). + +## Token usage map + +| Role | Token | SVG equivalent | +|------|-------|----------------| +| Page background | `--background` | — | +| Primary text | `--foreground` | `fill` on text | +| Card / panel background | `--card` | `fill` on rects | +| Subdued text, labels, captions | `--muted-foreground` | `fill` on labels | +| Soft backgrounds, secondary fills | `--muted` | `fill` on secondary rects | +| Primary accent (CTA, attention, keywords) | `--primary` | `stroke` / `fill` on highlighted elements | +| Warm accent | `--accent` | — | +| Positive / success | `--success` | `stroke` / `fill` on success paths | +| Caution | `--warning` | `fill` on warning badges | +| Error / destructive | `--destructive` | `stroke` / `fill` on error paths | +| Borders, dividers | `--border` | `stroke` on box outlines | +| Arrow strokes, diagram lines | `--muted-foreground` | `stroke` on connectors | +| Code block background | `--code-bg` | — | +| Body font | `--font-sans` | `font-family` on SVG body text | +| Code / labels font | `--font-mono` | `font-family` on SVG labels | +| Display / heading font | `--font-display` | `font-family` on SVG titles | + +## Base styles + +```css +*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; } + +body { + font-family: var(--font-sans); + background: var(--background); + color: var(--foreground); + line-height: 1.65; + font-size: 15px; + -webkit-font-smoothing: antialiased; +} + +.container { + max-width: 1080px; + margin: 0 auto; + padding: 64px 24px; +} +``` + +## Typography + +**Headings** — `var(--font-display)`, weight 500, `var(--foreground)`. +- H1: `2rem` page title +- H2: `1.4rem` section headers +- H3: `1.15rem` subsection headers + +**Body** — `var(--font-sans)`, weight 400, `0.95rem`, line-height `1.65`. Max paragraph width `65ch`. + +**Labels & metadata** — `var(--font-mono)`, `0.7–0.8rem`, weight 500, uppercase, letter-spacing `0.06em`, `var(--muted-foreground)`. + +**Code** — `var(--font-mono)`, `0.85rem`, line-height `1.55`. + +## Component patterns + +### Page header + +```html +
+ Implementation plan · Project name +

Plan Title Goes Here

+
+ Brief +

The original task or problem statement that motivated this plan.

+
+
+``` + +```css +.eyebrow { + font-family: var(--font-mono); + font-size: 0.72rem; + font-weight: 500; + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--muted-foreground); +} + +header h1 { + font-family: var(--font-display); + font-size: 2rem; + font-weight: 500; + margin: 8px 0 24px; + line-height: 1.2; +} + +.prompt-box { + background: var(--muted); + border: 1.5px solid var(--border); + border-radius: var(--radius); + padding: 16px 24px; +} + +.prompt-label { + font-family: var(--font-mono); + font-size: 0.7rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--muted-foreground); + display: block; + margin-bottom: 4px; +} + +.prompt-box p { + font-size: 0.92rem; + color: var(--muted-foreground); + line-height: 1.55; +} +``` + +### Summary strip (stat cards) + +```html +
+
+ 4 + Components +
+ +
+``` + +```css +.summary-strip { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); + gap: 16px; + margin: 32px 0; +} + +.stat-card { + border: 1.5px solid var(--border); + border-radius: var(--radius); + padding: 16px 24px; + text-align: center; + background: var(--card); +} + +.stat-value { + font-family: var(--font-display); + font-size: 1.8rem; + font-weight: 500; + display: block; + color: var(--foreground); +} + +.stat-label { + font-family: var(--font-mono); + font-size: 0.7rem; + font-weight: 500; + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--muted-foreground); + margin-top: 4px; + display: block; +} +``` + +### Section header + +```html +
+
+ 01 +

Solution Overview

+
+ +
+``` + +```css +section { margin-top: 64px; } + +.section-header { + display: flex; + align-items: baseline; + gap: 16px; + margin-bottom: 24px; + padding-bottom: 8px; + border-bottom: 1.5px solid var(--border); +} + +.section-number { + font-family: var(--font-mono); + font-size: 0.75rem; + font-weight: 600; + color: var(--primary); +} + +.section-header h2 { + font-family: var(--font-display); + font-size: 1.4rem; + font-weight: 500; +} +``` + +### Code block (dark theme) + +```html +
+ src/api/handler.ts +
interface PlanRequest {
+  title: string;
+  sections: Section[];
+}
+
+``` + +```css +.code-panel { + background: var(--code-bg); + border-radius: var(--radius); + padding: 24px; + overflow-x: auto; + margin: 16px 0; + border: 1.5px solid var(--border); +} + +.code-label { + font-family: var(--font-mono); + font-size: 0.7rem; + color: var(--muted-foreground); + display: block; + margin-bottom: 8px; +} + +.code-panel pre { + margin: 0; + font-family: var(--font-mono); + font-size: 0.85rem; + line-height: 1.55; + color: var(--foreground); +} + +/* Syntax tokens — these use semantic roles, not fixed colors */ +.code-panel .kw { color: var(--primary); } /* keywords */ +.code-panel .fn { color: var(--accent); } /* identifiers, types */ +.code-panel .str { color: var(--success); } /* strings */ +.code-panel .cm { color: var(--muted-foreground); font-style: italic; } /* comments */ +.code-panel .num { color: var(--warning); } /* numbers */ +``` + +### Risk table + +```html +
+
+
Database migration on large table
+
HIGH
+
Run during off-peak with online DDL
+
+ +
+``` + +```css +.risk-grid { + border: 1.5px solid var(--border); + border-radius: var(--radius); + overflow: hidden; +} + +.risk-row { + display: grid; + grid-template-columns: 1fr auto 1.5fr; + gap: 24px; + padding: 16px 24px; + align-items: center; + border-bottom: 1px solid var(--border); +} + +.risk-row:last-child { border-bottom: none; } +.risk-name { font-weight: 500; } +.risk-mitigation { font-size: 0.9rem; color: var(--muted-foreground); } + +.badge { + font-family: var(--font-mono); + font-size: 0.68rem; + font-weight: 600; + padding: 2px 8px; + border-radius: calc(var(--radius) - 4px); + text-transform: uppercase; + letter-spacing: 0.04em; +} + +.badge.high { + background: color-mix(in oklab, var(--destructive) 15%, transparent); + color: var(--destructive); +} +.badge.med { + background: color-mix(in oklab, var(--warning) 15%, transparent); + color: var(--warning); +} +.badge.low { + background: color-mix(in oklab, var(--success) 15%, transparent); + color: var(--success); +} +``` + +### Callout / open question + +```html +
+

Should we use WebSockets or SSE?

+

SSE is simpler but unidirectional. WebSockets add infrastructure complexity.

+ Decide with: infrastructure team +
+``` + +```css +.callout { + border-left: 3px solid var(--primary); + padding: 16px 24px; + margin: 16px 0; + background: var(--card); + border-radius: 0 var(--radius) var(--radius) 0; +} + +.callout h3 { + font-family: var(--font-display); + font-size: 1.05rem; + font-weight: 500; + margin-bottom: 4px; +} + +.callout p { + font-size: 0.9rem; + color: var(--muted-foreground); + line-height: 1.55; +} + +.decide-with { + font-family: var(--font-mono); + font-size: 0.72rem; + color: var(--primary); + font-weight: 500; + display: block; + margin-top: 8px; +} +``` + +### Tag chips + +```html +
+ packages/server + new endpoint +
+``` + +```css +.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; } + +.tag { + font-family: var(--font-mono); + font-size: 0.68rem; + padding: 2px 8px; + border-radius: calc(var(--radius) - 4px); + background: var(--muted); + color: var(--muted-foreground); +} + +.tag.highlight { + background: color-mix(in oklab, var(--primary) 12%, transparent); + color: var(--primary); +} +``` + +### Diagram panel + +Wraps SVG diagrams in a bordered container: + +```html +
+ + + + Request flow through the API gateway +
+``` + +```css +.diagram-panel { + border: 1.5px solid var(--border); + border-radius: var(--radius); + padding: 24px; + margin: 24px 0; + background: var(--card); +} + +.diagram-caption { + font-family: var(--font-mono); + font-size: 0.72rem; + color: var(--muted-foreground); + display: block; + margin-top: 8px; + text-align: center; +} +``` + +### Two-column grid + +```css +.two-col { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 24px; +} + +@media (max-width: 720px) { + .two-col { grid-template-columns: 1fr; } +} +``` + +### Collapsible details + +```html +
+ Implementation details +
+
+``` + +```css +details { + border: 1.5px solid var(--border); + border-radius: var(--radius); + margin: 16px 0; +} + +summary { + font-family: var(--font-sans); + font-weight: 500; + padding: 16px 24px; + cursor: pointer; + list-style: none; +} + +summary::before { + content: '▸'; + display: inline-block; + margin-right: 8px; + transition: transform 0.2s; +} + +details[open] summary::before { transform: rotate(90deg); } + +.details-body { padding: 0 24px 24px; } +``` + +### Milestone timeline + +Vertical timeline showing phases without time estimates. + +```html +
+
+
Phase 1
+
+
+

Foundation

+

Set up core infrastructure and initial integrations.

+
packages/server
+
+
+
+``` + +```css +.milestones { display: flex; flex-direction: column; gap: 0; } + +.milestone { + display: grid; + grid-template-columns: 120px 28px 1fr; + gap: 0 18px; +} + +.milestone .when { + text-align: right; + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--muted-foreground); + padding-top: 4px; +} + +.milestone .dot-col { display: flex; flex-direction: column; align-items: center; } + +.milestone .dot { + width: 14px; height: 14px; border-radius: 50%; + background: var(--card); + border: 3px solid var(--primary); + flex-shrink: 0; +} + +.milestone .dot.done { background: var(--success); border-color: var(--success); } + +.milestone .line { width: 2px; flex: 1; background: var(--border); margin: 4px 0; } +.milestone:last-child .line { display: none; } + +.milestone .body { padding-bottom: 36px; } + +.milestone .body h3 { + font-family: var(--font-display); + font-size: 1.15rem; + font-weight: 500; + margin-bottom: 4px; +} + +.milestone .body p { + font-size: 0.88rem; + color: var(--muted-foreground); + max-width: 620px; + margin-bottom: 10px; +} +``` diff --git a/apps/skills/plannotator-visual-explainer/references/extended-patterns.md b/apps/skills/plannotator-visual-explainer/references/extended-patterns.md deleted file mode 100644 index 65ecad6..0000000 --- a/apps/skills/plannotator-visual-explainer/references/extended-patterns.md +++ /dev/null @@ -1,629 +0,0 @@ -# Extended Patterns - -Components that complement visual-explainer's toolkit. These use the same Plannotator theme tokens from `theme-override.md` and can be mixed freely with Nico's `.ve-card`, `.kpi-card`, `.pipeline` patterns. - -## Timeline - -Vertical timeline showing phases or sequence — without time estimates. Shows ordering and dependencies, not duration. - -```html -
-
-
Phase 1
-
-
-
-
-
-

Foundation

-

Set up the core infrastructure and initial integrations.

-
-
- -
-``` - -```css -.timeline { display: flex; flex-direction: column; gap: 0; } - -.timeline-item { - display: grid; - grid-template-columns: 100px 28px 1fr; - gap: 16px; - min-height: 80px; -} - -.timeline-label { - font-family: var(--font-mono); - font-size: 0.75rem; - color: var(--muted-foreground); - text-align: right; - padding-top: 4px; -} - -.timeline-dot-col { - display: flex; - flex-direction: column; - align-items: center; -} - -.timeline-dot { - width: 14px; - height: 14px; - border-radius: 50%; - background: var(--card); - border: 3px solid var(--primary); - flex-shrink: 0; -} - -.timeline-dot.active { background: var(--primary); } - -.timeline-line { - width: 2px; - flex: 1; - background: var(--border); -} - -.timeline-content { padding-bottom: 24px; } - -.timeline-content h4 { - font-family: var(--font-display); - font-size: 1rem; - font-weight: 500; - margin-bottom: 4px; -} - -.timeline-content p { - font-size: 0.88rem; - color: var(--muted-foreground); -} -``` - -The last timeline item should hide the line: `style="background: transparent"` on the `.timeline-line`. - -## Code Blocks with Syntax Highlighting - -Dark-themed code panels showing key interfaces, schemas, or API signatures. Use sparingly — show the 5-10 lines that matter, not full files. - -```html -
- src/api/handler.ts -
interface Config {
-  port: number;
-  host: string;
-}
-
-``` - -```css -.code-panel { - background: var(--code-bg); - border: 1.5px solid var(--border); - border-radius: var(--radius); - padding: 20px 24px; - overflow-x: auto; - margin: 16px 0; -} - -.code-file { - font-family: var(--font-mono); - font-size: 0.7rem; - color: var(--muted-foreground); - display: block; - margin-bottom: 8px; -} - -.code-panel pre { - margin: 0; - font-family: var(--font-mono); - font-size: 0.85rem; - line-height: 1.55; - color: var(--foreground); - white-space: pre-wrap; - word-break: break-word; -} - -.code-panel .kw { color: var(--primary); } -.code-panel .fn { color: var(--accent); } -.code-panel .str { color: var(--success); } -.code-panel .cm { color: var(--muted-foreground); font-style: italic; } -.code-panel .num { color: var(--warning); } -``` - -## Risk Table - -Severity-graded risk assessment with colored badges. - -```html -
-
-
Database migration on live table
-
HIGH
-
Run during off-peak with online DDL
-
-
-``` - -```css -.risk-grid { - border: 1.5px solid var(--border); - border-radius: var(--radius); - overflow: hidden; -} - -.risk-row { - display: grid; - grid-template-columns: 1fr auto 1.5fr; - gap: 24px; - padding: 16px 24px; - align-items: center; - border-bottom: 1px solid var(--border); -} - -.risk-row:last-child { border-bottom: none; } -.risk-name { font-weight: 500; } -.risk-mitigation { font-size: 0.9rem; color: var(--muted-foreground); } - -.risk-badge { - font-family: var(--font-mono); - font-size: 0.65rem; - font-weight: 600; - padding: 2px 8px; - border-radius: 4px; - text-transform: uppercase; - letter-spacing: 0.04em; -} - -.risk-high { - background: color-mix(in oklab, var(--destructive) 15%, transparent); - color: var(--destructive); -} -.risk-med { - background: color-mix(in oklab, var(--warning) 15%, transparent); - color: var(--warning); -} -.risk-low { - background: color-mix(in oklab, var(--success) 15%, transparent); - color: var(--success); -} -``` - -## Open Questions - -Callout cards for unresolved decisions. Each names who can answer. - -```html -
-

Should we use WebSockets or SSE?

-

SSE is simpler but unidirectional. WebSockets add infrastructure complexity.

- Decide with: infrastructure team -
-``` - -```css -.question { - border-left: 3px solid var(--primary); - padding: 16px 24px; - margin: 16px 0; - background: var(--card); - border-radius: 0 var(--radius) var(--radius) 0; -} - -.question h3 { - font-family: var(--font-display); - font-size: 1.05rem; - font-weight: 500; - margin-bottom: 4px; -} - -.question p { - font-size: 0.9rem; - color: var(--muted-foreground); - line-height: 1.55; -} - -.question-owner { - font-family: var(--font-mono); - font-size: 0.72rem; - color: var(--primary); - font-weight: 500; - display: block; - margin-top: 8px; -} -``` - -## Inline SVG Diagrams - -For architecture, data flow, and simple flowcharts where Mermaid is overkill (under 8 nodes, simple topology). These produce crisp, theme-aware vector diagrams drawn directly in the HTML. Use Mermaid for anything with complex edge routing (10+ nodes, many crossing connections). - -### Container - -```html -
- - - - Request flow through the API gateway -
-``` - -```css -.svg-panel { - border: 1.5px solid var(--border); - border-radius: var(--radius); - padding: 24px; - margin: 24px 0; - background: var(--card); -} - -.svg-caption { - font-family: var(--font-mono); - font-size: 0.72rem; - color: var(--muted-foreground); - display: block; - margin-top: 8px; - text-align: center; -} -``` - -### Arrow markers - -Define in ``. Reference via `marker-end="url(#arrow)"`. - -```svg - - - - - - - - - - - - - - -``` - -### Box node - -```svg - - - API Server - Express + middleware - -``` - -### Highlighted box (new or hot-path component) - -```svg - - - New Service - to be created - -``` - -### Connecting arrows - -```svg - - - - - - - - -``` - -### Edge labels - -```svg -REST -``` - -### Flowchart elements - -```svg - - -Valid? - - - - - - - - - - - - -``` - -### Data flow (request/response) - -```svg - - -POST /api/plan - - - -{ plan, status } -``` - -### Fan-out pattern - -```svg - - - -``` - -### Bar chart - -```svg - - - - - - - - - - - - - - 25 - - - Q1 - -``` - -### Using CSS classes in SVG - -For cleaner markup, define reusable classes inside the SVG: - -```svg - - - -``` - -### Positioning rules - -- `viewBox` with fixed coordinates + `style="width:100%;max-width:720px"` for responsive scaling -- Standard node: `120–160px` wide, `48–56px` tall -- Minimum gap: `60px` horizontal, `40px` vertical -- Arrow label offset: `8–12px` above the line - -### Color roles in SVG - -| Element | Token | -|---------|-------| -| Box background | `var(--card)` | -| Box stroke | `var(--border)` | -| Highlighted box | `var(--primary)` stroke, `color-mix(in oklab, var(--primary) 8%, transparent)` fill | -| Arrows / connectors | `var(--muted-foreground)` | -| Title text | `var(--foreground)` | -| Subtitle / labels | `var(--muted-foreground)` | -| Success path | `var(--success)` | -| Error path | `var(--destructive)` | -| Warning | `var(--warning)` | - -## Section Headers - -Numbered sections with display font headings: - -```css -.section-header { - display: flex; - align-items: baseline; - gap: 14px; - margin-bottom: 24px; - padding-bottom: 8px; - border-bottom: 1.5px solid var(--border); -} - -.section-num { - font-family: var(--font-mono); - font-size: 0.75rem; - font-weight: 600; - color: var(--primary); -} - -.section-header h2 { - font-family: var(--font-display); - font-size: 1.35rem; - font-weight: 500; -} -``` - -## Tag Chips - -Small inline labels for categorizing items: - -```css -.tag { - font-family: var(--font-mono); - font-size: 0.68rem; - padding: 2px 8px; - border-radius: 4px; - background: var(--muted); - color: var(--muted-foreground); -} - -.tag-highlight { - background: color-mix(in oklab, var(--primary) 12%, transparent); - color: var(--primary); -} -``` - -## Diff Rendering (for PR reviews) - -Use Pierre diffs via CDN for syntax-highlighted, theme-aware diff rendering. Pierre renders into shadow DOM (no style conflicts) and supports Plannotator theme tokens via CSS variable injection. - -```html - - - -``` - -Pierre handles syntax highlighting (via Shiki), line numbers, add/del coloring, word-level diffs, and split/unified views automatically. The `unsafeCSS` option injects Plannotator theme tokens into the shadow DOM. - -For multiple diffs on one page, create one `` per file and set `fileDiff` + `options` on each. - -## Review Comment Bubbles (for PR reviews) - -Speech bubbles with severity-coded left borders. - -```css -.bubble { - position: relative; - background: var(--card); - border: 1.5px solid var(--border); - border-left-width: 4px; - border-radius: 8px; - padding: 12px 14px 12px 16px; - max-width: 680px; -} - -.bubble.blocking { border-left-color: var(--primary); } -.bubble.nit { border-left-color: var(--border); } -.bubble.suggestion { border-left-color: var(--success); } - -.bubble .severity { - font-family: var(--font-mono); - font-size: 0.65rem; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.06em; -} - -.bubble.blocking .severity { color: var(--primary); } -.bubble.nit .severity { color: var(--muted-foreground); } -.bubble.suggestion .severity { color: var(--success); } -``` - -## File Badges (for PR reviews) - -```css -.file-badge { - font-family: var(--font-mono); - font-size: 0.62rem; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.04em; - padding: 2px 6px; - border-radius: 4px; -} - -.file-badge.new { background: color-mix(in oklab, var(--success) 15%, transparent); color: var(--success); } -.file-badge.mod { background: color-mix(in oklab, var(--warning) 15%, transparent); color: var(--warning); } -.file-badge.del { background: color-mix(in oklab, var(--destructive) 15%, transparent); color: var(--destructive); } -``` diff --git a/apps/skills/plannotator-visual-explainer/references/pr-components.md b/apps/skills/plannotator-visual-explainer/references/pr-components.md new file mode 100644 index 0000000..7de7789 --- /dev/null +++ b/apps/skills/plannotator-visual-explainer/references/pr-components.md @@ -0,0 +1,717 @@ +# PR Component Patterns + +Component patterns specific to PR explainer documents. For the base design system (colors, typography, layout), see `../../plannotator-visual-plan/references/design-system.md`. + +## Table of Contents +1. [PR Header](#pr-header) +2. [TL;DR Box](#tldr-box) +3. [Diff Rendering](#diff-rendering) +4. [Review Comments](#review-comments) +5. [Risk Map](#risk-map) +6. [File Cards](#file-cards) +7. [Before / After](#before--after) +8. [Where to Focus](#where-to-focus) +9. [Test Plan](#test-plan) +10. [File Badges](#file-badges) + +## PR header + +```html +
+ Pull request · repo-name +

Add real-time notification system

+
+ 6 files + +142 + -38 + feature/notifications → main +
+
+``` + +```css +.pr-meta { + display: flex; + flex-wrap: wrap; + gap: 16px; + font-family: var(--font-mono); + font-size: 0.78rem; + color: var(--muted-foreground); + margin-top: 8px; +} + +.pr-meta .additions { color: var(--success); } +.pr-meta .deletions { color: var(--destructive); } +``` + +## TL;DR box + +```html +
+

TL;DR

+

Adds WebSocket-based notifications with per-user channels. Messages fan out + from a new NotificationService through Redis pub/sub. Existing REST endpoints + are unchanged.

+
+``` + +```css +.tldr { + background: var(--card); + border: 1.5px solid var(--border); + border-left: 4px solid var(--primary); + border-radius: var(--radius); + padding: 20px 24px; + max-width: 760px; + margin: 24px 0; +} + +.tldr h3 { + font-family: var(--font-mono); + font-size: 0.72rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--primary); + margin-bottom: 8px; +} + +.tldr p { + font-size: 0.95rem; + line-height: 1.6; + color: var(--muted-foreground); +} +``` + +## Diff rendering + +Use Pierre diffs via CDN for syntax-highlighted, theme-aware diff rendering. Renders into shadow DOM (no style conflicts) with Shiki syntax highlighting. + +```html + + +``` + +For multiple diffs, create one `` per file. Pierre handles syntax highlighting, line numbers, add/del coloring, and word-level diffs automatically. + +## Review comments + +Speech bubbles with severity-coded left borders, attached below a diff block. + +```html +
+
+ line 11 + BLOCKING +

This mutation isn't wrapped in a transaction. If the second write + fails, the first persists — leaving the user in a broken state.

+
+
+ line 24 + NIT +

Prefer const here since config is never reassigned.

+
+
+``` + +```css +.comments { + padding: 18px 20px; + display: flex; + flex-direction: column; + gap: 14px; + background: var(--muted); + border-top: 1px solid var(--border); +} + +.bubble { + position: relative; + background: var(--card); + border: 1.5px solid var(--border); + border-left-width: 4px; + border-radius: 8px; + padding: 12px 14px 12px 16px; + max-width: 680px; +} + +.bubble.blocking { border-left-color: var(--primary); } +.bubble.nit { border-left-color: var(--border); } +.bubble.suggestion { border-left-color: var(--success); } + +.bubble::before { + content: ""; + position: absolute; + left: -9px; + top: 16px; + width: 12px; + height: 12px; + background: var(--card); + border-left: 1.5px solid var(--border); + border-bottom: 1.5px solid var(--border); + transform: rotate(45deg); +} + +.bubble.blocking::before { + border-left-color: var(--primary); + border-bottom-color: var(--primary); +} + +.anchor { + font-family: var(--font-mono); + font-size: 0.68rem; + color: var(--muted-foreground); +} + +.severity { + font-family: var(--font-mono); + font-size: 0.65rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.06em; + margin-left: 8px; +} + +.bubble.blocking .severity { color: var(--primary); } +.bubble.nit .severity { color: var(--muted-foreground); } +.bubble.suggestion .severity { color: var(--success); } + +.bubble p { + margin-top: 6px; + font-size: 0.88rem; + line-height: 1.55; + color: var(--foreground); +} + +.bubble code { + font-family: var(--font-mono); + font-size: 0.82rem; + background: var(--muted); + padding: 1px 5px; + border-radius: 3px; +} +``` + +## Risk map + +Chips that give a quick overview of file risk levels. + +```html + +``` + +```css +.risk-map { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin: 24px 0; +} + +.chip { + display: inline-flex; + align-items: center; + gap: 8px; + font-family: var(--font-mono); + font-size: 0.75rem; + padding: 6px 12px; + border: 1.5px solid var(--border); + border-radius: 20px; + text-decoration: none; + color: var(--foreground); + transition: box-shadow 0.15s; +} + +.chip:hover { + box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 25%, transparent); +} + +.chip .dot { + width: 9px; + height: 9px; + border-radius: 50%; +} + +.chip.attention { + background: color-mix(in oklab, var(--destructive) 8%, transparent); + border-color: color-mix(in oklab, var(--destructive) 40%, transparent); +} +.chip.attention .dot { background: var(--destructive); } + +.chip.medium { + background: color-mix(in oklab, var(--warning) 10%, transparent); + border-color: color-mix(in oklab, var(--warning) 30%, transparent); +} +.chip.medium .dot { background: var(--warning); } + +.chip.safe { + background: color-mix(in oklab, var(--success) 8%, transparent); + border-color: color-mix(in oklab, var(--success) 35%, transparent); +} +.chip.safe .dot { background: var(--success); } +``` + +## File cards + +Expandable cards grouping a file's diff and review commentary. + +```html +
+
+
+ src/auth/middleware.ts + MOD + +28 -12 +
+ ATTENTION +
+
+

Replaced session-cookie auth with JWT verification. The trust boundary + moves from the session store to the token signature check.

+
+
+
+
+ + +
+ + src/types/index.ts + MOD + +4 -0 + SAFE + +
+

Added NotificationPayload type export.

+
+
+``` + +```css +.file-card { + border: 1.5px solid var(--border); + border-radius: var(--radius); + background: var(--card); + overflow: hidden; + scroll-margin-top: 20px; + margin: 16px 0; +} + +.file-head { + padding: 16px 20px; + border-bottom: 1.5px solid var(--border); + display: flex; + align-items: center; + justify-content: space-between; +} + +.file-info { + display: flex; + align-items: center; + gap: 12px; +} + +.file-path { + font-family: var(--font-mono); + font-size: 0.82rem; + font-weight: 600; +} + +.file-stats { + font-family: var(--font-mono); + font-size: 0.72rem; +} + +.file-stats .additions { color: var(--success); } +.file-stats .deletions { color: var(--destructive); } + +.file-why { + padding: 12px 20px; + border-bottom: 1px solid var(--border); +} + +.file-why p { + font-size: 0.9rem; + color: var(--muted-foreground); + line-height: 1.55; +} + +/* Collapsed (safe) files */ +.file-collapsed { + border: 1.5px solid var(--border); + border-radius: var(--radius); + background: var(--card); + margin: 8px 0; +} + +.file-collapsed summary { + list-style: none; + cursor: pointer; + padding: 14px 20px; + display: flex; + align-items: center; + gap: 12px; +} + +.file-collapsed summary::after { + content: '+'; + font-family: var(--font-mono); + font-size: 0.85rem; + color: var(--muted-foreground); + margin-left: auto; +} + +.file-collapsed[open] summary::after { + content: '\2212'; +} +``` + +## Before / after + +Two-column comparison grid. + +```html +
+
+

Before

+

Auth checked via session cookie on every request. + Session store hit adds ~15ms latency.

+
+
+

After

+

JWT signature verified in-process. No external store hit. + Latency drops to ~1ms per request.

+
+
+``` + +```css +.before-after { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 16px; + margin: 16px 0; +} + +@media (max-width: 640px) { + .before-after { grid-template-columns: 1fr; } +} + +.ba-panel { + background: var(--card); + border: 1.5px solid var(--border); + border-radius: var(--radius); + padding: 18px 20px; +} + +.ba-panel.after { + border-color: var(--success); +} + +.ba-panel h4 { + font-family: var(--font-mono); + font-size: 0.72rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.06em; + margin-bottom: 8px; +} + +.ba-panel.before h4 { color: var(--muted-foreground); } +.ba-panel.after h4 { color: var(--success); } + +.ba-panel p { + font-size: 0.9rem; + line-height: 1.55; + color: var(--foreground); +} +``` + +## Where to focus + +Numbered callout cards directing reviewers. + +```html +
+
+ 1 +
+ src/auth/middleware.ts:verifyToken() +

New trust boundary. Verify the JWT validation covers all edge cases: + expired tokens, malformed signatures, missing claims.

+
+
+
+``` + +```css +.focus-list { + display: flex; + flex-direction: column; + gap: 12px; + margin: 16px 0; +} + +.focus-item { + background: var(--card); + border: 1.5px solid var(--border); + border-radius: var(--radius); + padding: 16px 20px; + display: flex; + gap: 16px; + align-items: flex-start; +} + +.focus-number { + font-family: var(--font-mono); + font-size: 0.78rem; + font-weight: 600; + color: var(--primary-foreground); + background: var(--primary); + width: 26px; + height: 26px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.focus-item strong { + font-family: var(--font-mono); + font-size: 0.82rem; + display: block; + margin-bottom: 4px; +} + +.focus-item p { + font-size: 0.88rem; + color: var(--muted-foreground); + line-height: 1.5; +} +``` + +## Test plan + +Checkbox-style verification checklist. + +```html +
+
+ + Expired JWT returns 401 with proper error body +
+
+ + Concurrent WebSocket connections scale to 1000 without memory leak +
+
+``` + +```css +.test-list { + display: flex; + flex-direction: column; + gap: 8px; + margin: 16px 0; +} + +.test-item { + display: flex; + align-items: flex-start; + gap: 12px; + background: var(--card); + border: 1.5px solid var(--border); + border-radius: var(--radius); + padding: 13px 18px; + font-size: 0.88rem; +} + +.check { + width: 18px; + height: 18px; + border-radius: 5px; + border: 1.5px solid var(--border); + flex-shrink: 0; + position: relative; + margin-top: 2px; +} + +.test-item.done .check { + background: var(--success); + border-color: var(--success); +} + +.test-item.done .check::after { + content: ''; + position: absolute; + left: 5px; + top: 2px; + width: 5px; + height: 9px; + border-right: 2px solid var(--card); + border-bottom: 2px solid var(--card); + transform: rotate(40deg); +} +``` + +## File badges + +```css +.file-badge { + font-family: var(--font-mono); + font-size: 0.62rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.04em; + padding: 2px 6px; + border-radius: calc(var(--radius) - 4px); +} + +.file-badge.new { + background: color-mix(in oklab, var(--success) 15%, transparent); + color: var(--success); +} + +.file-badge.mod { + background: color-mix(in oklab, var(--warning) 15%, transparent); + color: var(--warning); +} + +.file-badge.del { + background: color-mix(in oklab, var(--destructive) 15%, transparent); + color: var(--destructive); +} + +.risk-tag { + font-family: var(--font-mono); + font-size: 0.65rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.06em; + padding: 3px 8px; + border-radius: calc(var(--radius) - 4px); +} + +.risk-tag.attention { + background: color-mix(in oklab, var(--destructive) 12%, transparent); + color: var(--destructive); +} + +.risk-tag.medium { + background: color-mix(in oklab, var(--warning) 12%, transparent); + color: var(--warning); +} + +.risk-tag.safe { + background: color-mix(in oklab, var(--success) 12%, transparent); + color: var(--success); +} +``` + +## Rollout plan + +Phased deployment strip showing ramp percentages. + +```html +
+
+
Day 0
+
internal
+
Team only. Watch error rates.
+
+
+
Day 2
+
10%
+
Random sample. Alert on anomalies.
+
+
+
Day 4
+
100%
+
Full ramp.
+
+
+``` + +```css +.rollout { display: flex; gap: 0; } + +.rollout-step { + flex: 1; + background: var(--card); + border: 1.5px solid var(--border); + padding: 16px 18px; +} + +.rollout-step:first-child { border-radius: var(--radius) 0 0 var(--radius); } +.rollout-step:last-child { border-radius: 0 var(--radius) var(--radius) 0; } +.rollout-step + .rollout-step { border-left: none; } + +.rollout-when { + font-family: var(--font-mono); + font-size: 0.68rem; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--muted-foreground); + margin-bottom: 8px; +} + +.rollout-pct { + font-family: var(--font-mono); + font-size: 1.35rem; + font-weight: 600; + color: var(--primary); + margin-bottom: 6px; +} + +.rollout-desc { + font-size: 0.82rem; + color: var(--muted-foreground); +} + +@media (max-width: 720px) { + .rollout { flex-direction: column; } + .rollout-step { border-radius: var(--radius); } + .rollout-step + .rollout-step { border-left: 1.5px solid var(--border); margin-top: 10px; } +} +``` diff --git a/apps/skills/plannotator-visual-explainer/references/svg-patterns.md b/apps/skills/plannotator-visual-explainer/references/svg-patterns.md new file mode 100644 index 0000000..e0e4c0c --- /dev/null +++ b/apps/skills/plannotator-visual-explainer/references/svg-patterns.md @@ -0,0 +1,368 @@ +# SVG Diagram Patterns + +Building blocks for creating diagrams in implementation plans. All SVGs are inline — no external dependencies. Compose these patterns to build architecture diagrams, data flow visualizations, flowcharts, and charts. + +All colors reference Plannotator theme tokens. In SVG, use the CSS custom property values directly via `style` attributes or the corresponding CSS classes. + +## Table of Contents +1. [Arrow Markers](#arrow-markers) +2. [Architecture Diagrams](#architecture-diagrams) +3. [Flowcharts](#flowcharts) +4. [Data Flow](#data-flow) +5. [Bar Charts](#bar-charts) +6. [Positioning & Layout](#positioning--layout) + +## Arrow markers + +Define reusable markers in ``. Reference them via `marker-end="url(#arrow)"`. + +```svg + + + + + + + + + + + + + + + + + +``` + +**Note on CSS vars in SVG:** `fill="var(--primary)"` works in inline SVG within an HTML document. For broader compatibility, you can also style via CSS classes instead of inline attributes. + +## Architecture diagrams + +Box-and-arrow diagrams showing how components connect. + +### Box node + +```svg + + + API Server + Express + middleware + +``` + +### Highlighted box (new or hot-path component) + +```svg + + + New Service + to be created + +``` + +### Connecting arrows + +```svg + + + + + + + + +``` + +### Edge labels + +Place at the midpoint of an arrow, offset above: + +```svg +REST +``` + +### Full architecture example + +```svg + + + + + + + + + + + Browser + React SPA + + + + HTTPS + + + + API Gateway + new + + + + + + + Postgres + existing + + + + + + + Redis Cache + +``` + +## Flowcharts + +### Process box + +```svg + +Parse input +``` + +### Decision diamond + +```svg + +Valid? +``` + +### Terminal / pill node + +```svg + +Start +``` + +### Success / failure endpoints + +```svg + + +Done + + + +Error +``` + +### Curved branch path + +For routing flow from a decision to a side branch: + +```svg + +``` + +## Data flow + +### Request / response pair + +```svg + + +POST /api/plan + + + +{ plan, status } +``` + +### Fan-out pattern + +```svg + + + + +``` + +## Bar charts + +```svg + + + + + + + + + 30 + 20 + 10 + + + + + + + + + 20 + 25 + + + Q1 + Q2 + Q3 + Q4 + +``` + +## Positioning & layout + +### SVG container sizing +- Use `viewBox` with fixed coordinates; set `style="width:100%;max-width:NNNpx"` for responsive scaling +- Standard widths: `720px` full-width, `480px` half-width, `360px` sidebar +- Standard heights: `180–320px` for most diagrams + +### Box sizing +- Standard node: `120–160px` wide, `48–56px` tall +- Minimum gap between nodes: `60px` horizontal, `40px` vertical +- Arrow label offset: `8–12px` above the line +- Diagram padding: `20px` inside the viewBox edges + +### Color roles in diagrams + +| Element | Fill / stroke | Token | +|---------|---------------|-------| +| Box background | fill | `var(--card)` | +| Box stroke | stroke | `var(--border)` | +| Highlighted box bg | fill | `color-mix(in oklab, var(--primary) 8%, transparent)` | +| Highlighted box stroke | stroke | `var(--primary)` | +| Arrow / connector | stroke | `var(--muted-foreground)` | +| Title text | fill | `var(--foreground)` | +| Subtitle / label text | fill | `var(--muted-foreground)` | +| Success path | stroke | `var(--success)` | +| Error path | stroke | `var(--destructive)` | +| Warning | fill | `var(--warning)` | + +### Using CSS classes in SVG + +For cleaner markup, define reusable classes in a ` + + +```