code-to-uml
CLAUDE.md0 starsChanged 6 months agoMITView on GitHub
A vanilla JavaScript web application that renders PlantUML diagrams in the browser. No build tools, no package.json, no bundler — plain HTML/CSS/JS served by a lightweight Node.js dev server. Requires Java on PATH for the plantuml.jar fallback rendering endpoint (POST /api/plantuml-svg). Tests use Node's built-in assert/strict — no test framework. Each test/*.test.js file is self-contained. PlantUML diagrams are rendered via a two-tier strategy: The fallback logic lives in component/render-failure-common.js (renderWithFailureHandling). It detects SVG errors, runtime crashes, and timeout conditions, then…
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- code-to-umlSkill
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 48
All components expose their API on window via IIFE.
- Very specific: line 87
Default language: Chinese (zh)
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md 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
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
A vanilla JavaScript web application that renders PlantUML diagrams in the browser. No build tools, no package.json, no bundler — plain HTML/CSS/JS served by a lightweight Node.js dev server.
Running the Server
# Start dev server (default port 5401)
./serve.sh
# or
node serve.js
# Custom port
node serve.js 8080Requires Java on PATH for the plantuml.jar fallback rendering endpoint (POST /api/plantuml-svg).
Running Tests
# Run all tests
node test/run-all.js
# Run a single test
node test/cache-index-sort.test.jsTests use Node's built-in assert/strict — no test framework. Each test/*.test.js file is self-contained.
Architecture
Rendering Pipeline
PlantUML diagrams are rendered via a two-tier strategy:
- Browser rendering (primary):
js/plantuml.jsrenders PlantUML source to SVG client-side using WebAssembly - Jar fallback (fallback): If browser rendering fails (runtime error, diagram too large), the app calls
POST /api/plantuml-svgwhich spawnsjava -jar plantuml.jar --svg -pipeserver-side
The fallback logic lives in component/render-failure-common.js (renderWithFailureHandling). It detects SVG errors, runtime crashes, and timeout conditions, then automatically retries via the jar endpoint.
Component Modules (IIFE pattern)
All components expose their API on window via IIFE. Load order matters — dependencies must load before dependents:
| Module | Global | Purpose |
js/plantuml.js | window.plantumlRender | Browser-side PlantUML renderer |
js/viz-global.js | Graphviz | Graphviz/Viz.js for certain diagram types |
component/docs-page-core.js | PlantUmlDocsCore | Core utilities: source reading, error detection, SVG manipulation, jar fallback HTTP client |
component/render-failure-common.js | PlantUmlRenderFailureCommon | Render orchestration with automatic fallback |
component/demo-example-component.js | PlantUmlDemoExample | Creates example DOM nodes (source editor + preview + actions) |
component/toc-component.js | PlantUmlToc | Side table-of-contents with scroll-based active tracking |
i18n/zh.js, i18n/en.js | __DOCS_I18N_ZH__, __DOCS_I18N_EN__ | Dictionary globals |
i18n-config.js | DocsI18n | i18n runtime (getMode/setMode/t/apply), dispatches docs:langchange events |
demo.js | — | Main page controller: bootstraps demo, manages tabs, render queue, lightbox |
Demo Example Data (.ctu files)
Examples are stored in data/demo/ as .ctu files with bilingual naming: {diagram-type}--{id}_{lang}.ctu
Each .ctu file uses a custom section format:
Title: Section Title
Describe: Section description
------------------------------------------------------------
[Example]
Example title
[Description]
Example description (supports markdown)
[Detail]
Detail text shown below preview
[UML]
@startuml
...PlantUML source...
@endumlMultiple examples per file are separated by ----- lines. The server parses these in serve.js → parseCtuGroups() and serves them via GET /api/demo-examples?lang=zh|en.
i18n
- Default language: Chinese (
zh) - Persisted to
localStoragekeyplantuml-docs-lang - Language switch dispatches
docs:langchangecustom event; components re-render on this event - Demo examples are bilingual — each
.ctufile exists in both*_zh.ctuand*_en.ctuvariants
Lightbox
Clicking a rendered diagram preview opens a full-screen lightbox (demo.js → initPreviewLightbox) with zoom (scroll/pinch), pan (drag), and keyboard (Escape to close) support.
Key Files
serve.js— Dev server with static file serving +/api/demo-examples+/api/plantuml-svgendpointsdemo.html— Single-page app shelldemo.js— Main page controller (tab switching, render queue, lightbox, i18n wiring)main.css— All stylescomponent/docs-page-core.js— Shared rendering utilities and error detectiondata/demo/*.ctu— Diagram example data files
Conventions
- Pure vanilla JS — no frameworks, no npm dependencies
- IIFE module pattern exposing globals on
window - Strict mode (
"use strict") in all files - CSS custom properties for theming in
main.css - Chinese is the primary language; English is secondary
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.

