Flowchart Design Standard
Scope: Layout, aesthetics, and visual design principles for flowcharts. NOT in scope: Symbol shapes, colors, edge types — see
flowchart_symbols_standard.md(the SINGLE SOURCE OF TRUTH).Core philosophy: 美化是手段,传递信息才是目的。 Any decoration that prevents a reader from narrating the main flow in 3 seconds is harmful.
1. Design Axiom
A flowchart is a visual language for information transfer. Every design choice must answer one question: does this help the reader understand the logic faster? If not, remove it.
| Priority | Goal | Metric |
|---|---|---|
| P0 | 3-second scan | Reader narrates the main flow without clicking anything |
| P1 | Straight lines | Lines that CAN be straight MUST be straight — no unnecessary curves or detours |
| P2 | No overlap | Nodes never overlap nodes; edges never cross nodes; edge crossings minimized to zero |
| P3 | Shape = meaning | Each node's shape instantly tells "what it is" per the symbol standard |
| P4 | Color = role | Same semantic role → same color. No guessing. |
| P5 | Line hierarchy | Primary flow is obviously thicker/darker than everything else |
| P6 | Fit in one view | fitView shows all nodes without scroll, drag, or zoom |
2. Color Principles
Node and edge colors are defined in
flowchart_symbols_standard.md. This section covers how to use color, not which colors.
2.1 Consistency (统一性)
- Same semantic type → same color. All Process nodes are Blue. All Decision nodes are Amber. No exceptions.
- The color palette is fixed per symbol type (see Color Standard in
flowchart_symbols_standard.md). Never invent new hues. - If a node doesn't fit any standard type, use
process(Blue) as default.
2.2 Contrast (对比度)
- Fill vs. Stroke: Every node uses a light fill + saturated stroke. The stroke carries identity; the fill provides area.
- Text vs. Background: Minimum lightness difference > 30%. Use the designated
font-colorfrom the standard. - Primary vs. Secondary edges: Primary Flow is 3px black (opacity 0.85). All other edges are thinner, lighter, or dashed. The visual gap must be obvious.
2.3 Restraint (精简性)
- Max 3 dominant hues in any single diagram. The rest are accents.
- If a diagram uses 6+ symbol types, the palette naturally expands — but the reader still perceives "blue things = actions, amber things = decisions" because shape reinforces color.
- Never use color to encode a second dimension (e.g., "blue = process AND blue = deterministic"). Color encodes symbol type only.
2.4 Context Adaptation (场景适配)
| Context | Recommendation |
|---|---|
| Technical docs | Rely on the standard palette as-is (low saturation, high readability) |
| Presentations | Increase stroke width by 1px; use slightly larger nodes for projector visibility |
| Print / PDF | Ensure all dashed lines reproduce in B&W (dash pattern, not color alone, carries meaning) |
| Dark background | Swap fill/stroke to inverted variants (not covered in the standard; handle per project) |
3. Node Design Principles
3.1 Size Standardization (节点标准化)
| Property | Value | Tolerance |
|---|---|---|
| Min width | 120px | — |
| Max width | 240px | — |
| Min height | 48px | — |
| Max height | 96px (2 lines) | — |
| Border radius | 8px (Process), 16px (AI/Display), 0 (Diamond) | Per symbol standard |
| Stroke width | 2px (normal), 3px (emphasis: AI, Internal Storage) | Per symbol standard |
- Same-type nodes must have the same dimensions. Two Process nodes side by side should be identical in size.
- Decision diamonds are naturally taller due to shape — keep the text area compact.
3.2 Content Density (文字易读化)
Each node has at most 3 text lines. Each line answers ONE question for the reader:
┌──────────────────────────────────┐
│ Literature Survey │ Line 1: What IS this stage?
│ collect background papers │ Line 2: What does it PRODUCE?
│ topic → annotated reading notes │ Line 3: What goes IN → what comes OUT?
└──────────────────────────────────┘
| Line | Field | Question | Font | Max Length |
|---|---|---|---|---|
| 1 | label (Title) |
What is this stage? | 12.5px bold | ≤ 24 chars |
| 2 | sub (Subtitle) |
What does it produce / do? | 10px gray | ≤ 36 chars |
| 3 | io (I/O) |
What goes in → what comes out? | 9px light gray | ≤ 36 chars |
Title: Verb + Object (动词化)
- GOOD:
Literature Survey,Parse Goal,Gate Decision,Final Verify - BAD:
Session(too vague — session of what?),Data Processing(generic)
Subtitle: What it Produces
- GOOD:
collect background papers,build hypothesis tree,distill key findings - BAD:
Literature Review(noun phrase — what does it DO?),goal.md parsing(filename, not meaning)
I/O: Semantic Transformation (语义变换, NOT 实现细节)
The io line describes the domain-level transformation: what data enters, what data exits. It must NOT contain implementation details.
| Quality | Example | Why |
|---|---|---|
| GOOD | papers → hypothesis tree |
Semantic: reader knows the transformation |
| GOOD | goal.md → role + topic + project |
Concrete: specific input → specific outputs |
| GOOD | hypotheses → experiment plan |
Shows the logical data flow between stages |
| BAD | 10 calls → sessions/*.md |
"10 calls" = implementation detail (API call count) |
| BAD | 30 calls → exp_*.md |
Reader doesn't care how many API calls |
| BAD | N lanes → exp_*.md |
Too vague + filename glob instead of meaning |
| BAD | 11 checks → pass / fail |
"11 checks" = implementation detail (check count) |
| BETTER | all artifacts → pass / fail |
Semantic: what is being verified |
The acid test: Cover the label. Can a reader understand the node's purpose from sub + io alone? If not, rewrite.
Rule: The io line must form a data story when read top-to-bottom across all nodes:
goal.md → role + topic + project
→ topic → annotated reading notes
→ papers → hypothesis tree
→ hypotheses → experiment plan
→ plan → per-hypothesis results
→ results → advance or backtrack
→ experiments → reusable insights
→ insights → paper + slides
→ all artifacts → pass / fail
Each output feeds into the next input. If there's a gap, a node label or io is wrong.
Chips (Optional, for Overview Nodes)
| Zone | Rule |
|---|---|
| Chips | Artifact names (max 3). Overflow shows +N. Never >3 visible. |
- Font: Sans-serif only (no serifs, no monospace for node text).
- Alignment: Center-aligned. Never wrap title to 2+ lines — shorten instead.
- No icons inside nodes unless replacing text entirely (max 1 icon per node).
3.3 Badges and Status
- Depth badge (L0/L1/L2): Top-left corner, small pill, neutral background.
- Status badge (pass/fail/running): Top-right corner, single character (✓/✗/●).
- Badges never overlap title text. If the node is too small, omit badges.
4. Edge Design Principles
Edge types and colors are defined in
flowchart_symbols_standard.md. This section covers routing and visual hierarchy.
4.1 Visual Hierarchy (线条层级)
The reader should instantly know which line is the "main road":
| Layer | Edge Type | Visual Weight |
|---|---|---|
| Foreground | Primary Flow | 3px, black, solid, opacity 0.85 |
| Mid-ground | Gate Pass / Gate Fail | 2px, green/red, solid/dashed, opacity 0.70–0.80 |
| Background | Data / Skip / Feedback | 1.5px, muted colors, opacity 0.40–0.50 |
- If all edges look equally important, the diagram is broken. Primary must dominate.
4.2 Straightness Rules (线条必须直,Non-Negotiable)
If a line CAN be straight, it MUST be straight. A crooked line between aligned nodes is always a bug.
| Rule | Description |
|---|---|
| Straight when aligned | If source and target share the same X (vertical flow) or same Y (horizontal flow), the edge MUST be a single straight segment — zero bends. |
| Orthogonal when offset | If source and target are NOT aligned, use exactly one right-angle bend (L-shape). Never use Bezier curves on primary flow. |
| No gratuitous curves | Bezier/spline routing is FORBIDDEN for Primary Flow, Gate Pass, and Gate Fail edges. Only Skip and Feedback edges may use curves, and only when necessary to avoid crossing. |
| Layout causes straightness | Edges don't need routing tricks if nodes are properly aligned. Fix the layout first, not the edge. |
4.3 Routing Rules (线条路由)
| Rule | Description |
|---|---|
| Fixed ports | L→R layout: enter from Left, exit from Right. T→B layout: enter from Top, exit from Bottom. |
| No self-loops | source === target edges are always filtered out — zero exceptions. |
| No back-edges in Overview | Except max 1 Feedback edge. All loops belong in detail views. |
| Zero crossings target | Re-order nodes to eliminate ALL edge crossings. If truly impossible, cross at right angles with a visible gap. |
| No edge-through-node | An edge must NEVER visually pass through or overlap a node it is not connected to. Re-route or re-order nodes to prevent this. |
4.3 Label Rules
| Edge Type | Label? | Example |
|---|---|---|
| Primary Flow | No label | — |
| Gate Pass | pass or yes |
pass |
| Gate Fail | fail or no |
fail |
| Data Flow | Name of data | report.csv |
| Skip / Jump | Optional | skip to |
| Feedback | Optional | retry |
- Labels are small (10px), with white semi-transparent background for readability.
- Primary Flow is never labeled — its identity comes from visual weight alone.
5. Layout Principles
5.1 Spine-First Layout (主干优先)
Every flowchart must have exactly one main trunk (spine). All other information hangs off this spine as sidecars, chips, or detail views.
Correct: Wrong:
A → B → C → D → E A → B → C
↓ ↗
D → E
(two competing paths)
The reader's eye follows ONE line. If two paths look equally strong, the hierarchy is broken.
5.2 Direction Rules
| Node Count | Direction | Layout Method |
|---|---|---|
| ≤ 5 | Left → Right | Single row, direction: right |
| 6–10 | Grid (L→R, T→B) | grid-rows: 2, grid-columns: 5 |
| > 10 | Split into Overview + Detail | Overview ≤ 10 nodes; excess becomes drilldown |
- Never mix L→R and T→B in the same diagram level. Pick one and commit.
5.3 Row Wrapping (Hard Rule)
- Max 5 nodes per row. If more than 5, wrap to the next row.
- 10 nodes = 2 rows × 5 columns (the standard Overview layout).
- Wrapping is left-to-right, top-to-bottom (reading order).
5.4 Alignment (对齐,Non-Negotiable)
If two nodes CAN be aligned, they MUST be aligned. Misalignment is the #1 cause of crooked lines.
| Rule | Description |
|---|---|
| Same-row Y alignment | All nodes in the same row share the EXACT same Y coordinate. Tolerance: 0px (not 12px — zero). |
| Same-column X alignment | All nodes in the same column share the EXACT same X coordinate. |
| Grid snapping | Use grid-rows + grid-columns in D2 to enforce alignment mechanically. Never hand-place nodes if a grid achieves the same result. |
| Alignment before routing | Align nodes FIRST, then draw edges. A straight edge is the natural consequence of aligned nodes. |
Correct (aligned): Wrong (misaligned):
┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐
│ A │───│ B │───│ C │ │ A │──┐ │ B │
└───┘ └───┘ └───┘ └───┘ └─└───┘
(same Y → straight lines) (offset Y → crooked line)
5.5 No Overlap (不重叠,Non-Negotiable)
Nodes must never overlap other nodes. Edges must never pass through unconnected nodes.
| Rule | Description |
|---|---|
| Node-node gap | Minimum 20px clearance between any two node boundaries. |
| Edge-node clearance | An edge must maintain ≥ 10px distance from any node it does not connect to. |
| Edge-edge crossing | Target: ZERO crossings. If unavoidable, cross at right angles (never acute). |
| Re-order to fix | If overlap or crossing occurs, change the node order / column assignment. Do NOT add routing hacks — fix the layout. |
Correct (no overlap): Wrong (edge crosses node):
┌───┐ ┌───┐ ┌───┐───┌───┐
│ A │───│ B │ │ A │ X │ B │
└───┘ └───┘ └───┘───└───┘
┌───┐ ┌───┐ │
│ C │───│ D │ ┌───┐─┘
└───┘ └───┘ │ C │
└───┘
5.6 Spacing
| Metric | Value |
|---|---|
| Horizontal node gap | 60px (L→R) |
| Vertical node gap | 40px (T→B) |
| Same-row Y tolerance | 0px (exact alignment) |
| Same-column X tolerance | 0px (exact alignment) |
| Group internal padding | 16px |
| Group inter-step spacing | 28px |
| Edge-to-unconnected-node clearance | ≥ 10px |
- Uniform spacing is non-negotiable. Inconsistent gaps create the illusion of semantic grouping where none exists.
5.7 Visual Balance (视觉平衡)
- The diagram's center of gravity should be near the geometric center of the canvas.
- Left/right and top/bottom should have roughly equal visual weight.
- If one side is heavy (many nodes), add whitespace or rebalance by moving auxiliary nodes.
6. Overview Design (L0)
The Overview is the reader's first and most important impression. It must be optimized for instant comprehension.
6.1 Hard Limits
| Metric | Target |
|---|---|
| Nodes | = 10 (exactly) |
| Primary edges | 9–11 |
| Feedback edges | ≤ 1 |
| fitView | All 10 nodes visible without scroll |
| Back-edges | 0 (except the 1 allowed Feedback) |
- If the process has < 10 logical steps: split granular steps to reach 10.
- If the process has > 10 logical steps: group related steps into collapsed containers.
6.2 What Belongs in Overview
| Include | Exclude |
|---|---|
| Start / End terminators | Intermediate artifacts (config files, temp data) |
| Main process steps | Sub-steps within a phase |
| Key decision gates | Internal data flows |
| Collapsed group nodes | Retry/rework loops (except 1 Feedback) |
6.3 Collapsed Groups
When multiple related steps are collapsed into one group node:
- Label: Phase name (e.g.,
Analysis) - Badge:
P1→P2→P3or3 steps - Visual: Use
groupclass (neutral border, light fill) - Click behavior: Drill into detail view (no page change — expand in-place or navigate to detail diagram)
6.4 Sidecar Pattern
Artifacts, configurations, and data products should NOT be main-trunk nodes. Instead:
- Attach as chips on the producing node (max 3 visible, overflow
+N) - Or use a single sidecar note (e.g., "Key Artifacts" box) anchored beside the main trunk
- The sidecar does NOT count toward the 10-node limit
7. Detail Design (L1+)
Detail views expand what was collapsed in the Overview.
7.1 Expansion Rules
- Expanding a group only pushes downstream nodes — upstream stays fixed (the reader's mental map is preserved).
- Expanded children stack vertically within the group container (T→B inside L→R spine).
- Collapsed state shows 1 node; expanded state shows N children + internal edges.
7.2 Detail Limits
| Metric | Target |
|---|---|
| Nodes per detail view | ≤ 15 |
| Nesting depth | ≤ 2 levels (L0 → L1 → L2 max) |
| Edge types shown | Primary + Gate + Data (all 6 types allowed) |
7.3 Internal Layout
Within an expanded group:
Group Container (Analysis)
├─ Map (Pass 1) ← vertical stack
├─ Q1 Gate (diamond) ← smaller, same column
├─ Mechanics (Pass 2)
└─ Mastery (Pass 3)
- Same-phase steps share the same X coordinate (strict column alignment).
- Group padding: 16px. Inter-step: 28px.
8. Interaction Principles
8.1 Default State
- Locked layout — nodes are not draggable by default. This is a presentation, not a whiteboard.
- Auto fitView — on load, on expand/collapse, on navigation.
- Provide an "Unlock layout" toggle for editing mode only.
8.2 Progressive Disclosure
- Overview starts with Step 1 visible. Click "Next" to reveal each subsequent step.
- Edges appear when both source and target are visible.
- Notes appear when their associated step is revealed.
8.3 Navigation
- Click group → drill into detail (expand or navigate)
- Back button → return to Overview (restore position)
- Legend toggle → show/hide the legend overlay
9. Legend (Required)
Every diagram MUST include a legend. The legend shows:
- Symbol shapes used in this diagram (subset of the 20 standard types)
- Edge types used in this diagram (subset of the 6 standard types)
Legend rules:
- Fixed position: bottom-right corner or floating overlay
- Does not scroll with the canvas
- Shows only symbols/edges actually present in the current view
- Compact: 1 row of shape chips + 1 row of edge samples
10. Anti-Patterns (What NOT to Do)
| Anti-Pattern | Why It's Bad | Fix |
|---|---|---|
| Crooked line between aligned nodes | Looks broken, screams "auto-layout bug" | Align nodes to same X or Y → line becomes straight automatically |
| Nodes overlapping nodes | Unreadable, blocks content | Increase spacing; re-order columns/rows |
| Edge passing through a node | Confuses "is this connected?" | Re-order nodes or add routing clearance |
| Edge crossing edge | Creates false intersections | Re-order nodes to eliminate; if impossible, cross at 90° |
| Misaligned same-row nodes | Causes unnecessary bends in horizontal edges | Force exact same Y coordinate for all nodes in a row |
| Self-loop edges | 100% visual noise, never informational | Filter source === target |
| All edges same thickness | No hierarchy, reader can't find main flow | Primary 3px, others 1.5px |
| > 10 nodes in Overview | Cognitive overload | Group into collapsed containers |
| Bezier curves on primary flow | Creates unnecessary visual complexity | Use orthogonal/step routing |
| Artifacts as main-trunk nodes | Breaks the action spine | Move to chips or sidecars |
| Mixed L→R and T→B | Inconsistent reading direction | Pick one, commit |
| Color = execution actor (blue=code, green=LLM) | Conflicts with color = symbol type standard | Use shape for semantics, color follows symbol standard |
| Status encoded in fill color | Clashes with symbol-type color | Use border style + badge instead |
| > 3 lines of text in a node | Nodes are labels, not paragraphs | Title ≤ 24 chars, subtitle ≤ 36 chars |
11. Acceptance Checklist (8-Point Test)
Before shipping any flowchart, verify all 8:
| # | Test | Pass Criteria |
|---|---|---|
| 1 | 3-second scan | Without clicking, narrate the main flow in 3 seconds |
| 2 | All lines straight | Every edge between aligned nodes is a single straight segment — zero unnecessary bends |
| 3 | Zero overlap | No node overlaps another node; no edge passes through an unconnected node |
| 4 | Zero crossings | No edge crosses another edge (or crosses at 90° if truly unavoidable) |
| 5 | Shape scan | Each node's shape instantly tells you what it is |
| 6 | Zero self-loops | No edge where source === target |
| 7 | Visual hierarchy | Secondary edges obviously lighter than primary |
| 8 | fitView test | "Show All" fits everything, no overlap, no drag needed |
12. Quick Decision Tree
Use this when designing a new flowchart:
Q: How many main steps?
├─ ≤ 5 → Single row, L→R, direction: right
├─ 6–10 → Grid layout, 2 rows × 5 cols
└─ > 10 → Overview (10 nodes) + Detail drilldowns
Q: Does a step contain sub-steps?
├─ Yes, 2–5 sub-steps → Collapse into group node
├─ Yes, > 5 sub-steps → Separate detail diagram
└─ No → Regular node
Q: Is this an artifact, not an action?
├─ Key output (PDF, report) → Data or Document node in spine
├─ Intermediate file (config, index) → Chip on producing node
└─ Multiple artifacts → Sidecar note box
Q: Does this edge go backward?
├─ Main retry loop → 1 Feedback edge (purple dotted)
├─ Gate fail → rework → Gate Fail edge (red dashed) to rework node
└─ Other backward reference → Skip edge (slate dashed), or hide in detail
References
- Symbol Standard:
flowchart_symbols_standard.md— shapes, colors, edge types (SINGLE SOURCE OF TRUTH) - D2 Classes:
flowviz_d2_classes.md— copy-paste D2 class blocks - FlowViz Skill:
/flowchartSKILL.md — workflow and rendering instructions