diagram-site
Skill1 starsChanged 5 months agoMITView on GitHub
Generate a self-contained, interactive diagram WEBSITE from an engineering document — design doc, review doc, high-level design (HLD), or low-level design (LLD). Produces a folder (index.html + styles.css + app.js + config.js + data.js + vendored mermaid.min.js) that opens offline in any browser: left nav of sections, Mermaid graphs themed to match, hand-built components (decision ladders, phase ladders, confidence/segment scales, problem→fix flip cards), clickable nodes → detail drawer, dark/light theme, zoom, responsive. Has an "altitude" knob: HIGH for business/HLD (no code pointers), LOW for engineering/ LLD/review (shows file:line, spec refs, source). Use when the user says "make a website/site for this design/review doc", "turn this HLD/LLD into interactive diagrams", "diagram site", "/diagram-site", "visualize this architecture as a web page", or wants to present diagrams to a business/product or engineering audience.
In this repository24 other files it gives its agents.
- authorship-validatorSkill
- auth-setupSkill
- code-reviewSkill
- design-reviewSkill
- design-systemSkill
- devex-reviewSkill
- doc-syncSkill
- file-followup-issuesSkill
- handoffSkill
- idea-reviewSkill
- investigate-bugSkill
- plan-reviewSkill
- pr-commentSkill
- pre-merge-reviewSkill
- qa-fixSkill
- qa-reportSkill
- qaSkill
- scope-reviewSkill
- semantic-compressorSkill
- shipSkill
- sql-performanceSkill
- team-retroSkill
- ui-polishSkill
- weekly-planSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
After that you copy the static assets into the output folder and vendor Mermaid.
- Distinctive: line 113
Read the source doc(s): If you weren't handed a specific document, ask which one(s) to convert before starting.
- Very specific: line 133
Validate: run node --check app.js; load data.js + config.js in node and assert that every id listed in sections exists in the data.
- Very specific: line 150
Keep data.title equal to the source-doc title.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
diagram-site
Turn a document stuffed with ASCII art, Mermaid blocks, and tables into a clean,
single-page site you can open in any browser. The renderer (app.js) is fixed
and reused as-is — your only authoring job is two data files: data.js (the
diagrams themselves) and config.js (sections, titles, altitude, footer).
After that you copy the static assets into the output folder and vendor Mermaid.
Gather context first
This skill ships standalone, so it can't assume your project's conventions, house style, or preferences the way it could for its author. Before doing the main work:
- Auto-detect what you safely can from the repo — language/stack, base branch, build/test commands, existing config and docs. Never ask for something you can read for yourself.
- Ask, don't assume, for the rest. Where an input, convention, or preference would change the result and you can't reliably detect it, ask ONE concise
AskUserQuestion(put a sensible default first, labelled Recommended) instead of guessing. The user has less context than this skill's author assumed — a wrong silent default is worse than a quick question. Don't ask about things you can detect, and don't ask more than you need.
For this skill, confirm up front (only the items you can't already detect):
- Which document(s) to turn into a site, and their paths, if you weren't handed them — the source doc(s) drive everything downstream.
- Altitude / audience — HIGH vs LOW. HIGH (business / HLD: hides node
refs, the rawSourceexpander, and layer chips, and strips file:line / function / spec refs) vs LOW (engineering / LLD / review: showsrefs,Source, and layer chips). Infer it from the doc type, but ask when it's genuinely ambiguous (e.g. a "design overview" that could go either way) — it decides which diagrams you show and whether code-level detail leaks. - Where to write the output folder — default
docs/<name>-site/; confirm the path or name if the repo has its own convention (e.g.architecture/,site/). - Curation depth for an HLD — whether to drop internal-wiring / build / dependency diagrams (recommended for a business audience) or include the full set.
Subagents & parallelism (opt-in)
By default this skill runs inline in a single context — no subagents, no Workflow fan-out — to keep it cheap to run.
Parallel subagents can be faster on large jobs (a doc with many diagrams, or deep per-diagram conversion). Before spawning any subagent or Workflow, stop and ask the user, for example:
This doc has [N] diagrams. I can convert them inline here (cheaper, slower) or fan out [M] parallel subagents — one per diagram — then merge (faster, more tokens). Which do you want?
Spawn subagents/workflows only after an explicit yes. If the user declines or doesn't answer, do the whole job inline.
Assets (in assets/)
index.html— fixed shell. Loadsconfig.js,data.js,mermaid.min.js, thenapp.js.styles.css— the design system (dark/light tokens plus every component). Generic; never edit it per project.app.js— the renderer. Readswindow.SITE_CONFIGandwindow.SITE_DATA. Never edit it per project.config.example.js,data.example.js— copy toconfig.js/data.jsand fill in. The full schema is documented inline in both example files (read them).
The two things you author
data.js → window.SITE_DATA = { id: diagram }. Every diagram carries a kind:
| kind | renders as | author |
flow graph state sequence | themed Mermaid graph | supply a mermaid string |
ladder | ordered decision rows; outcome chip auto-detected (HIGH/LOW/PASS/FAIL/…) | nodes[] |
trust-ladder / phase-ladder | vertical numbered rungs (number parsed from the label) | nodes[] with "Phase N — …" labels |
scale | horizontal segmented bar | segments[] ({label,threshold,note,tone}) |
flip-cards | problem→fix flip cards (front = label + front, back = desc) | nodes[]; optional flipTags |
cards table other (default) | node-card grid | nodes[] |
Each node is {id,label,desc,ref?,front?}. Clicking a node opens the drawer (it shows
desc, plus ref/outcome/layer when those exist). ref and the raw Source block
surface only at LOW altitude.
config.js → window.SITE_CONFIG: title, subtitle, altitude, sections[]
(left nav → diagram ids), titleOverrides, optional layers, footer.
The altitude knob (the decision that matters most)
- HIGH (
altitude:"high") — design doc / HLD / business + product audience. Hides noderefs, the rawSourceexpander, and the layer chips/legend. This audience already knows domain and tech vocabulary (API, latency, cache, retry, throughput) — keep those words. Strip the code-level detail: file:line pointers (service.go:412), function / variable / type names (client.Fetch,models.Order), spec section numbers (§3.1), ticket or decision refs, array-index notation (row[13:19]), and internal call-chain hops (handler→service→client). Explain what the system does, never how it is wired together. - LOW (
altitude:"low") — LLD / review / engineering audience. Showsrefs,Source, and layer chips. file:line and spec refs belong here.
Choose altitude from the document type; confirm with the user when the doc type or audience is ambiguous (a "design overview" can read as either), since it decides which diagrams you show and whether code-level detail leaks.
Doc-type playbook
- Design doc → a mix of
flow(data flow),graph(context),state, andcards(components). Altitude follows the audience — HIGH if it's a design overview, LOW if it's the detailed spec. - HLD → HIGH altitude. Sections: Overview (a
flow"how it works" plus agraph"why / context"), Mechanism (flow/scale/ladderat a tech-but-not-code altitude), Roadmap (trust-ladderplus a 3-columncards). Curate for the audience — drop build, dependency, and internal-wiring diagrams. - LLD → LOW altitude. Show everything:
sequence(call flow),state(state machines),ladder(decision algorithms),cards/table(data schemas, output contracts), all withrefs. - Review doc (code / scope / plan / pre-merge review) →
flip-cardsfor findings (front = the issue, back = the fix;flipTags:["ISSUE","RESOLVED"]),cardsfor decision matrices and risk registers (outcome words like PASS/FAIL/BLOCK auto-color),scalefor severity. LOW altitude — refs are useful here.
Generation steps
- Read the source doc(s). If you weren't handed a specific document, ask which one(s) to convert before starting. Inventory every diagram, table, and flow, plus the surrounding narrative.
- Pick altitude and audience. Infer it from the doc type; confirm with the user when ambiguous. This drives which diagrams to show and how to curate the sections.
- Author
data.js. Convert each diagram into akindplus its content. For graph-shaped diagrams, write Mermaid (node IDs and arrows are the structure; put rich text inside"quoted labels"; the renderer useshtmlLabels:false, so avoid a raw</>inside a label — spell it out in words). If the doc has many diagrams and the user opted into subagents (see Subagents & parallelism), fan out one agent per diagram → structured JSON, then merge; otherwise convert the diagrams one by one in this context. At HIGH altitude, write plain-language descriptions and do not include any code pointers (see altitude). - Author
config.js. Brandtitle/subtitle, setaltitude, curatesections, settitleOverrides(keepdata.titlefaithful to the source; override only the displayed title), and add an optionalfooter. - Assemble the output folder (default
docs/<name>-site/; confirm the path or name if the repo has its own convention, e.g.architecture/): copyindex.html,styles.css,app.js; writeconfig.jsanddata.js. - Vendor Mermaid (so it stays self-contained):
curl -fsSL https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js -o <out>/mermaid.min.js(No font CDN —styles.cssfalls back to the system stack, so the result has zero external references.) - Validate: run
node --check app.js; loaddata.js+config.jsin node and assert that every id listed insectionsexists in the data; at HIGH altitude, scan the rendered fields for code pointers (:\d{2,4},\.(go|py|js)\b,§, snake_case/camelCase identifiers) and remove them. - QA in a browser (recommended): open
index.html, click through each section, confirm every Mermaid diagram draws as real SVG (not the ASCII fallback), click nodes (the drawer should open), toggle the theme, and flip the cards. Fix any Mermaid that fell back — it's almost always a label-syntax issue.
Conventions & gotchas
- Self-contained means two things: (a) no external network dependencies (Mermaid vendored, system fonts only); (b) no references to other documents in a standalone deck — drop "see spec §X", doc filenames, ticket IDs, and any "document authority" diagram. The site has to explain itself.
app.jsquote-protects Mermaid only inside the source you hand it — keep node IDs and arrows outside the"…". If a diagram fails to render it falls back to itsraw_ascii/source, which is your signal to fix the label.- Keep
data.titleequal to the source-doc title; usetitleOverridesfor the friendly display title. - This skill commits nothing — leave the output as working-tree files unless the user asks you to commit.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

