Skip to main content

/ux-flowchart-generate

Generate GitHub-renderable Mermaid flowcharts from PRDs, docs, codebases, or any combination — with evidence maps and confidence scoring.


What It Does

Generates Mermaid flowcharts that render directly on GitHub, with:

  • Evidence maps tracing every diagram node to its PRD section, code path, and test file
  • Confidence scoring (automated, based on evidence completeness)
  • Unknowns lists identifying gaps and mismatches between PRD and code
  • Quality gates (17 machine-checkable + 5 human-review flags)

Supports four source types (prd, doc, repo, mixed) and four diagram goals (userflow, systemflow, architecture, stateflow). Optionally accepts UI screenshots for visual traceability alongside generated diagrams.


Usage

PRD-only user flow:

/ux-flowchart-generate prd docs/prd-auth.md userflow "password reset"

Repo-only system flow:

/ux-flowchart-generate repo src/middleware/ systemflow "auth"

Mixed mode (PRD + code):

/ux-flowchart-generate mixed docs/prd-checkout.md src/checkout/ userflow

Interactive wizard:

/ux-flowchart-generate

Parameters

ParamRequiredValuesDefault
source_typeYesprd, doc, repo, mixed
pathsYesSpace-separated file/directory paths
goalYesuserflow, systemflow, architecture, stateflowuserflow
scopeNoFree text to narrow focusEntire source

What It Asks

QuestionWhen
Source type?If not provided in arguments
File paths?If not provided in arguments
Diagram goal?If not provided in arguments
Audience?Always (determines label language)
Update mode?When existing diagram detected
Scope confirmation?When scope provided
Proceed with generation?Before generation (HARD STOP)
Write to file?Before writing output
Feedback?After writing

Output

Path: jaan-to/outputs/ux/diagrams/{id}-{slug}/

Files produced:

FileContents
{id}-flowchart-{slug}.mdMermaid diagram + unknowns table + metrics + validation results
{id}-evidence-map-{slug}.mdNode-by-node traceability table + mismatches + source file index

Example: jaan-to/outputs/ux/diagrams/01-password-reset/01-flowchart-password-reset.md


Diagram Conventions

Node Shapes

UX ConceptShapeSyntax
Entry pointStadium (pill)id([Label])
User actionRectangleid[Label]
DecisionDiamondid{Label?}
SuccessDouble circleid(((Label)))
ErrorRectangle + red classid[Error: Label]:::error
LoadingRounded rectangleid(Label)
External APISubroutineid[[Label]]
Data storeCylinderid[(Label)]

Edge Types

TypeSyntaxUse
Happy path-->Primary flow
Error path-.->Fallback/error
Critical==>Emphasis (max 1-2)
Mismatch-.-> + :::mismatchPRD-code discrepancy

Confidence Scoring

Evidence-based, automated (no manual override):

LevelSymbolCriteria
High🟢PRD + code + test all present
Medium🟡PRD or code (not both), or missing test
Low🔴Inferred only — no direct trace
UnknownNot yet assessed

Quality Gates

17 machine-checkable gates that must pass before output:

  • Syntax valid, node cap (≤25), edge cap (≤50), text cap (<40K chars)
  • Cyclomatic complexity (≤15), no orphans, complete decisions
  • Entry/exit nodes exist, error paths present, all edges labeled
  • Semantic IDs, no reserved words, direction set, styles defined
  • Metadata present, evidence complete

5 human-review flags reported but not blocking:

  • Audience fit, abstraction consistency, flow direction, UI states, mismatches flagged

Auto-Split

Large diagrams are automatically split when any threshold is exceeded:

MetricThreshold
Nodes>25
Edges>50
Cyclomatic>15
Parallel branches>8
Mermaid chars>20,000

Split produces an overview diagram with subprocess nodes linking to detail diagrams in the same folder.


Tips

  • Use mixed mode for the richest output — it cross-references PRD against code and flags mismatches
  • Narrow scope for large codebases (e.g., "auth module" not entire repo)
  • Provide test file paths for higher confidence scores
  • For userflow goal, labels use user-facing language; for systemflow, technical terms are fine
  • GitHub renders Mermaid v11.4.1 — no click events, tooltips, or FontAwesome

Learning

This skill reads from:

jaan-to/learn/jaan-to-ux-flowchart-generate.learn.md

Add feedback:

/learn-add ux-flowchart-generate "Always validate mermaid syntax before preview"

Back to UX Skills