Living Diorama
ASecurityBuild a self-running, stylish low-poly 3D miniature world ("living diorama") in three.js + Vite + TypeScript: an isometric scene outdoors or as a cutaway interior, with day/night, weather or a human calendar (shifts, weekends), and simulated vehicles, people, animals or machines with schedules, maintenance and random events. It can be ambient, educational or instructive (tours, training scenarios), in one or more languages. Built by a phased multi-agent Workflow (contracts first, parallel bui...
- 2 stars
- 0 votes
- 0 copies
- 0 views
- Added November 7, 2026
Works with
Security analysis
100/100Pro scans all 20 files and shows the line behind each finding
npx -y skills add joonsp/threejs-skills --skill living-diorama --agent claude-codeAre you the author of Living Diorama?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/joonsp-living-diorama)---
name: living-diorama
description: Build a self-running, stylish low-poly 3D miniature world ("living diorama") in three.js + Vite + TypeScript: an isometric scene outdoors or as a cutaway interior, with day/night, weather or a human calendar (shifts, weekends), and simulated vehicles, people, animals or machines with schedules, maintenance and random events. It can be ambient, educational or instructive (tours, training scenarios), in one or more languages. Built by a phased multi-agent Workflow (contracts first, parallel builders, integration, screenshot QA). Use it whenever the user wants an isometric or tilt-shift scene that "lives": a train station, harbour, ski resort, medieval town, farm, zoo, or an office floor, hospital ward, factory, restaurant kitchen, school, etc. Also use it to add life, weather, traffic, residents or events to such a scene, for an interactive onboarding or walkthrough model of a workplace, or when they say "diorama sim", "living world", "model railway"-style or cozy simulation even if they never say "diorama".
---
# Living Diorama
A living diorama is a small, bounded 3D world that runs by itself and looks lovely from a fixed isometric camera. Trains, boats, carts or shuttles keep a timetable. People come and go for reasons. Weather and daylight change the mood. Random events tell little stories. The user watches, pokes, and inspects things; it is not a game with win conditions.
It can also be an interior: a cutaway office floor, hospital ward or factory where shifts, lunch rushes and quiet weekends do the job weather does outdoors. And it can teach: an educational diorama explains how the place works, and an instructive one walks a learner through a procedure. See `references/interiors.md` and `references/purpose-and-language.md`.
This skill captures a method proven on a Victorian railway junction. That build produced about 17k lines in v1 and about 30k after a "living world" pass. There were 9 agents in v1 and 21 in v2. It ended with 60 fps on a desktop GPU and zero visible pop-ins in 3-day soak tests. The two workflow scripts from that build are in `examples/` as worked references.
## Why it is structured this way
A diorama like this is too big for one context and falls into natural subsystems: world, atmosphere, vehicles, people, events, and interface. Parallel agents can build those at the same time, but only if they share **precise contracts before anyone writes a line of subsystem code**. Otherwise six agents invent six incompatible APIs. So the whole method is organised around three rules:
1. A single foundation or core phase lands every shared type, the layout, and stubs, so the project compiles.
2. Builders own disjoint directories.
3. One integrator reconciles the result.
Visual quality comes from agents *looking at screenshots* of their own work. Simulation health comes from *fast-forward soak tests* with numeric targets.
## Process
### 1. Scout and clarify (keep it short)
- Check the tooling: `node`, `pnpm` (it may need pinning via mise), a Chromium (`/usr/bin/chromium` or `~/.cache/ms-playwright/chromium-*`), whether the directory is empty, and whether it is a git repo.
- Ask at most about 4–5 questions, each with a recommended default. **Always ask these two**, because they change the build more than the theme does (see `references/purpose-and-language.md`):
- **Purpose:** ambient (just watch it live) is the default, versus educational (explains how the place works: hotspots, a guided tour) or instructive (teaches a procedure: scenarios, decision points, a debrief). If it is educational or instructive, also ask about the audience and for source material.
- **Languages:** which UI languages, which is the default, and whether signs in the world follow the UI or the setting's own language. Suggest the user's language plus English.
- Ask the rest only when they are unclear:
- **Setting:** exterior, exterior with cutaway buildings, or interior. Usually the theme answers this. An interior drops weather and seasons; see `references/interiors.md`.
- **Stack:** Vite + TS is the default. It splits cleanly across parallel agents.
- **Interaction level:** "living sim with light control" is the default, versus a management game.
- **Procedural WebAudio:** yes or no.
- Don't ask about things you can decide yourself.
- Interpret the theme into a **signature composition** and say it in the plan. Examples: a V-shaped junction with the station in the wedge; a harbour mouth with a lighthouse; a valley with a gondola; an open-plan office wrapped around its break room; a ward cut away with the nurses' station at the centre. This choice drives everything else, and an interesting silhouette in isometric view matters more than realism.
### 2. Plan
Write a plan covering:
- the layout interpretation
- a systems table (directory → contents)
- the core contract outline
- the workflow phases and agent count
- verification targets
If plan mode is active, get approval first. Read `references/contract.md` before writing the plan: it lists everything the core contract must pin down. For an interior, also read `references/interiors.md`. For an educational or instructive build, or more than one language, read `references/purpose-and-language.md`. State the purpose and the languages in the plan.
**Let the setting choose the cycles.** Outdoors, weather and seasons give the variety. Indoors, drop them entirely, and design the human calendar instead: shifts per role, the shape of a workday, and weekends and holidays where the setting has them (an office empties at the weekend, a hospital never closes, a restaurant peaks on Saturday). Use the setting's local customs for lunch hours, weekend days and holidays.
**Match scope to the ask.** Blind reviews of plans made with this skill kept flagging scope creep: 13–15 events, extra lifts and economies with 15 goods, for requests like "cozy harbour". The embedded contract is what makes parallel builders fit together, so a long contract is fine. What bloats builder prompts is feature lists and rules repeated in every prompt; keep each builder's task section to a few KB. Big scope means shallow subsystems and long, expensive runs. So:
- Build every feature the user named in depth.
- Keep the v1 extras small: about 6–8 events and one supporting population.
- List everything else in the plan under "v2 ideas", so the user can pull those in later.
A small world that is fully alive beats a big one that is half-finished.
**Pace the headline cycles for watching.** Whatever the theme's signature cycle is (seasons, tides, grooming nights, market days, shift changes, the working week), it should visibly turn within a 10–20 minute watch at 1×, or have a jump parameter (for example `?season=` or `?day=sat`). A year that takes 4.8 real hours at 1× defeats the point.
**Bake the "living" rules into v1.** In the train-station build, the no-pop-in origins registry, quality tiers, wind, and idle animations were only added in v2. Retrofitting them cost a whole second workflow. Put them in the first foundation contract. See `references/lessons.md`.
### 3. Run the build workflow
**In opencode** (or any harness without a `Workflow` tool), run the same phases as `task` subagents that you orchestrate yourself. Follow `references/opencode.md` for how; everything else below still applies.
In Claude Code, load the `workflow-authoring` skill, then author the script. Use `examples/trainstation-v1.workflow.js` as a template for the shape (read it; adapt it, don't copy the station specifics). The phases:
1. **Foundation (1 agent).** It does the following:
- scaffolds the project;
- implements `src/core/**` exactly per a contract string embedded in the script;
- writes `main.ts` and a stub `create<Name>(ctx)` for every subsystem;
- installs `scripts/shot.mjs` (copy it from this skill's `scripts/`);
- writes `CONTRACTS.md`;
- adds a `?debug=layout` overlay and verifies the geometry from top-down screenshots.
The exit gate is a clean `tsc` and `build`, plus non-black screenshots. Give Foundation a result schema such as `{ok, tscClean, buildClean, layoutIssues, deviations}`, and **abort the workflow** (return early with the report) if it isn't ok. A broken scaffold fanned out to 6–8 builders wastes the whole run.
Optionally, add one cheap **contract reviewer** before the fan-out. It reads `CONTRACTS.md` and the core files from each builder's point of view and lists missing hand-offs, which Foundation fixes in one pass.
2. **Build (about 6 parallel agents)** on disjoint directories, each with its own screenshot port:
- world
- atmosphere
- primary vehicles (trains, ships, …)
- people
- maintenance + events
- camera + UI + audio
For an interior, world becomes the building (rooms, furniture, cutaway walls), atmosphere becomes lighting and building services, and vehicles become the theme's flows and machines (lifts, conveyors, carts, beds); see `references/interiors.md` §6. For an educational or instructive build, add a learning builder that owns `src/learning/**` and `content/**`, unless the layer is small enough for the UI builder.
Each agent returns structured output: `summary`, `files`, `coreRequests`, `dependsOn`, `knownIssues`. Builders never edit core. They work around gaps and report them as `coreRequests`.
3. **Integrate (1 agent).** It applies the `coreRequests` and checks every `dependsOn` claim in the code. It runs a time × weather screenshot matrix (for interiors, calendar states × floors) plus every event, and every language for the UI-heavy shots. It fixes all console errors and runs a multi-day soak (a full week when weekdays differ).
4. **Review & Fix loop.** Reviewers with separate lenses (liveliness rules, simulation correctness, visuals + performance, and a didactic lens that plays every tour and scenario when the build teaches) report only *verified* findings with evidence. Dedupe the findings in plain code by a stable key before the fixer sees them. A fixer then applies them. Stop when no major findings remain, or after 2 rounds. The last fixer's work must still be re-checked, either by one more review pass or by giving Polish the open findings list to confirm.
5. **Polish (1 agent).** It runs showcase screenshot rounds, critiques them, fixes the top issues, tunes performance, and writes the README.
Script hygiene:
- Read `projectDir` and `seed` from `args`, with defaults, and never hard-code absolute paths.
- Builders never `git commit`, because parallel commits in one repo collide.
- Only one agent at a time runs `pnpm build` into `dist`. Screenshot runs use the Vite dev server on per-agent ports instead.
- Unit-test pure logic (timetable, economy, pathfinding) where it is cheap.
- Resolve paths to absolute form: `~` is not expanded by agents' file tools.
- Gate Integrate with a pass/fail schema too, not only Foundation.
- When tagging results from `parallel()`, index into the original array *before* `.filter(Boolean)`. Filtering first shifts the indices when an agent fails, so findings get the wrong lens.
**Check that the plan is internally consistent before launching it.** The blind reviews' remaining findings were contradictions inside plans:
- **Infeasible targets:** do a back-of-envelope check that each numeric target is reachable. A gondola doing about 70 riders an hour can't meet a queue target for 300 skiers, and three snowcats need enough night hours to groom every piste.
- **Jump parameters must also set built-up state.** For example, `?season=lateWinter` must also set the river ice, not just the season.
- **Order of `?event` and `advance`:** fast-forwarding can jump past an event that only triggers after load, so check which runs first.
- **Motion scale:** fix slow walks by compressing distances, not by speeding up on-screen movement. People crossing the screen at 5 m/s kills the cozy feel.
- **Scheduled conflicts:** events and schedules that use the same space need a reservation (for example torchlight descent vs grooming, or a night event vs cabins garaged).
Scale follows the user's ask:
- **Default:** about 9 agents, as in v1.
- **With "ultracode", or "make it comprehensive":** add a parallel Audit & Design phase (issue analyst, world designer, tech/performance architect) feeding a Core phase, as in `examples/trainstation-v2.workflow.js`.
### 4. After the workflow
- Read the final screenshots yourself before reporting. Check that trains stop at the platforms, the night is lit, and the UI doesn't cover the scene. The agents' self-reports can be optimistic.
- Re-run `tsc` and the build.
- Report to the user:
- what exists
- the measured numbers against targets
- honest remaining issues
- which issues you'd fix next
- Offer git init/commit/push. Do it only when asked.
### 5. Follow-up "more life" passes
Treat each user request for more life (rivers, towns, traffic, wildlife) as a new workflow:
- Snapshot the source first: a tarball in the scratchpad, or a commit.
- Decide yourself which known issues deserve fixing, give each a numeric target, and fold them into the pass.
- Use the v2 example for the shape.
## Non-negotiables for "living"
Explain these to every agent, because they are what make it feel alive rather than like a screensaver:
- **No pop-in.** Living things spawn or despawn only at legitimate origins: a map-edge portal, a building door, a stopped vehicle, a moored boat, a train door, or a tunnel. Indoors: an entrance, the loading dock, a lift, a stairwell or an off-screen floor, never a desk. Enforce this with an origins registry and an audit counter (`stats().popIns` must stay 0). The reference implementation is `examples/core-reference/origins.ts`.
- **No stationary life.** Every person, animal and vehicle always shows some motion: breathing bob, weight shift, head turns, watch checks, tail swish, horses stamping. Parked vehicles leave eventually. Static props must never be living things.
- **Everything has a reason and a route.** People arrive by vehicle, footpath or train and leave the same ways. Staff commute. Event actors walk in from somewhere sensible.
- **Every mood works.** Dawn, noon, golden hour, blue hour and midnight, in every weather. Night must be lit (windows, lamps, bloom), never black. Indoors, every calendar state works instead: morning rush, lunch, shift change, after hours and weekend. An empty building still has a cleaner, a guard or blinking equipment, and its dark zones stay readable.
## Verification targets (adapt to the theme)
Expose `window.__sim` with `stats()`, `advance(simMinutes)`, `setHour`, `setWeather` (or `setDay` for interiors), `setLang`, `trigger(eventId)` and `setSpeed`. Put targets in the prompts. Interiors add wall-crossing, double-booking, shift-coverage and closing targets (`references/interiors.md` §7). Multilingual builds add a missing-key check (`references/purpose-and-language.md` §4). From the station build:
- **Clean:** `tsc` and `build` pass, with zero console or page errors in any screenshot.
- **Soak:** a 3-sim-day soak on 2+ seeds keeps every line or route cycling, with no stuck agents or leaks and bounded counts.
- **Service quality:** for example, mean lateness under 5 min and give-ups under 7%. Instrument this in `stats()` from the start.
- **Liveliness:** `popIns` = 0.
- **Performance:** quality tiers (auto: software GL goes to low; `?q=` override), measured as draw calls and triangles per tier. Low should stay near 200–260 draw calls.
## Bundled resources
- `references/contract.md`: what the core contract must define (types, bus, clock/time, layout, APIs, main loop, debug API, quality, origins, wind). Read it before writing the Foundation prompt.
- `references/lessons.md`: pitfalls and fixes from the station build. Read it when planning and when writing agent prompts.
- `references/interiors.md`: cutaway interiors, where the human calendar (shifts, workdays, weekends) replaces weather. It covers layout for rooms and floors, the camera, living rules and targets. Read it for any indoor scene.
- `references/purpose-and-language.md`: the ambient, educational and instructive modes (tours, scenarios, content files, didactic review) and i18n (`t()`, locale versus language, text in the world). Read it when planning.
- `references/opencode.md`: how to run the phases in opencode with `task` subagents, prompt files and result files instead of a Workflow script.
- `scripts/shot.mjs`: the headless screenshot and stats harness. It starts Vite on a given port and renders on the host GPU, or with SwiftShader when given `--sw`. Copy it into the project's `scripts/`.
- `examples/trainstation-v1.workflow.js`: 9-agent build workflow (Foundation → 6 builders → Integrate → Polish).
- `examples/trainstation-v2.workflow.js`: 21-agent living-world pass (Audit & Design → Core → 7 builders → Integrate → Review & Fix loop → Polish).
- `examples/core-reference/*.ts`: working core modules from the station (bus, clock, rng, origins, quality, wind, params, registry, main). Hand their paths to the Foundation agent as reference implementations to adapt.
Files in this skill
- README.md
- SKILL.md
- evals/evals.json
- examples/core-reference/bus.ts
- examples/core-reference/clock.ts
- examples/core-reference/main.ts
- examples/core-reference/origins.ts
- examples/core-reference/params.ts
- examples/core-reference/quality.ts
- examples/core-reference/registry.ts
- examples/core-reference/rng.ts
- examples/core-reference/wind.ts
- examples/trainstation-v1.workflow.js
- examples/trainstation-v2.workflow.js
- references/contract.md
- references/interiors.md
- references/lessons.md
- references/opencode.md
- references/purpose-and-language.md
- scripts/shot.mjs
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.