Agent Skillsjasonkneen/tiny-world-builder › tinyworld-single-file

tinyworld-single-file

GitHub

规范 Tiny World Builder 单文件开发工作流,确保 Three.js 应用保持内联无构建状态,指导本地编辑、验证及生产发布流程。

.codex/skills/tinyworld-single-file/SKILL.md jasonkneen/tiny-world-builder

Trigger Scenarios

编辑 tiny-world-builder.html 维护 Three.js r185 依赖 执行本地调试或发布

Install

npx skills add jasonkneen/tiny-world-builder --skill tinyworld-single-file -g -y
More Options

Non-standard path

npx skills add https://github.com/jasonkneen/tiny-world-builder/tree/main/.codex/skills/tinyworld-single-file -g -y

Use without installing

npx skills use jasonkneen/tiny-world-builder@tinyworld-single-file

指定 Agent (Claude Code)

npx skills add jasonkneen/tiny-world-builder --skill tinyworld-single-file -a claude-code -g -y

安装 repo 全部 skill

npx skills add jasonkneen/tiny-world-builder --all -g -y

预览 repo 内 skill

npx skills add jasonkneen/tiny-world-builder --list

SKILL.md

Frontmatter
{
    "name": "tinyworld-single-file",
    "description": "Use when editing the Tiny World Builder repo, especially tiny-world-builder.html, to preserve the static classic-script Three.js r185 app structure and local edit\/reload workflow."
}

Tiny World Single-File Workflow

Work mainly in tiny-world-builder.html; also update index.html, vendor/three/, publish.sh, checks, docs, or skills when a change affects those durable contracts.

Core rules:

  • Keep the builder app single-file at runtime: inline CSS, inline JS, no bundler, no npm runtime packages.
  • Root index.html is a static landing page entry point; the builder remains available at /tiny-world-builder and /tiny-world-builder.html.
  • random-island-preview.html is a standalone local-dev control shell for random-island reveal/card iteration. It embeds /tiny-world-builder?randomIslandPreview=1 so the visible island is the real Three.js game renderer, then talks to the app by postMessage to generate, load, and export reveal/game JSON. Production Netlify shares it through the private netlify/functions/random-island-preview.mjs route instead of copying the HTML as a public static file.
  • Do not touch tiny-world-builder BACKUP.html if present.
  • Preserve style: 2-space indent, semicolons, single-quoted strings, section comments like // -------- tools --------.
  • Mutate board state through setCell(x, z, opts), not direct world[x][z] writes outside initialization.
  • Keep Three.js pinned to r185 and self-hosted under vendor/three/; do not reintroduce CDN runtime scripts. The app consumes vendor/three/tinyworld-three.r185.min.js, a generated classic-global bundle made from three@0.185.0; regenerate it with npm run vendor:three after changing three or loader wiring.
  • If browser stack traces point at tiny-world-builder / dist/LandscapeEngine.js line numbers after source edits, run npm run build so dist/index.html, dist/tiny-world-builder.html, and dist/LandscapeEngine.js are regenerated before judging the runtime.
  • Cluso's in-page embed is allowed in LOCAL DEV ONLY, injected at runtime by tools/dev-server.js (never written into the committed HTML or dist/). The assets live under gitignored cluso/ and publish.sh excludes that dir, so tools/check.js / tools/smoke-static.js (which scan the shipped HTML) stay green. Do NOT add cluso/cluso-embed.{js,css} references to tiny-world-builder.html or any committed/shipped HTML — production must never load it. (Owner-approved override of the prior "no Cluso, even local" rule.)
  • Shared materials in M.* must not be mutated per instance; clone first for unique opacity/material behavior and dispose cloned materials in disposeGroup.

Validation:

  • Run npm test (syntax-checks the inline app script, parses world.schema.json, verifies embedded schema parity, checks local script/link assets, and runs the no-browser smoke guard).
  • For targeted parser checks, run perl -0ne 'print $1 if m#<script>\s*(.*?)\s*</script>#s' tiny-world-builder.html | node --check.
  • Prefer browser validation at http://localhost:3000/tiny-world-builder.
  • Check console errors after visual/UI changes.

Inline <script> gotcha (has burned us twice)

tools/check.js extracts the main app script with this regex:

html.match(/<script>([\s\S]*?)<\/script>\s*<\/body>/);

It greedily matches from the first plain <script> through to the last </script></body>. If you add another inline <script> block above the main app (e.g. a defaults bootstrap), it MUST carry an HTML attribute or check.js conflates the two scripts plus the literal </script><script> separator into one parse target and throws Unexpected token '<'.

<script id="my-bootstrap">...</script>   <!-- ✓ regex skips this -->
<script>...</script>                     <!-- ✗ becomes part of main app -->

Related durable systems

For persisted runtime state (defaults pipeline, audio, camera, panel positions, feature flags) see .codex/skills/tinyworld-runtime-state. For island layout, sponsor banner, plane/crop-duster flight paths see .codex/skills/tinyworld-island-and-planes.

Version History

  • 2ffaf91 Current 2026-07-06 00:20

Same Skill Collection

.agents/skills/lightweight-3d-effects/SKILL.md
.agents/skills/threejs-primitive-reconstructor/SKILL.md
.agents/skills/tinyworld-i18n/SKILL.md
.claude/skills/tinyworld-i18n/SKILL.md
.codex/skills/threejs-primitive-reconstructor/SKILL.md
.codex/skills/tinyworld-25d-template-sprites/SKILL.md
.codex/skills/tinyworld-asset-editing/SKILL.md
.codex/skills/tinyworld-auto-batching/SKILL.md
.codex/skills/tinyworld-block-button-style/SKILL.md
.codex/skills/tinyworld-cctv-truman/SKILL.md
.codex/skills/tinyworld-ghost-world-gen/SKILL.md
.codex/skills/tinyworld-integrations/SKILL.md
.codex/skills/tinyworld-island-and-planes/SKILL.md
.codex/skills/tinyworld-island-viewer/SKILL.md
.codex/skills/tinyworld-lowpoly-stylized-3d/SKILL.md
.codex/skills/tinyworld-lowpoly-world-prompt/SKILL.md
.codex/skills/tinyworld-mesh-terrain/SKILL.md
.codex/skills/tinyworld-opacity-torch/SKILL.md
.codex/skills/tinyworld-render-performance/SKILL.md
.codex/skills/tinyworld-runtime-state/SKILL.md
.codex/skills/tinyworld-settings/SKILL.md
.codex/skills/tinyworld-shader-fx/SKILL.md
.codex/skills/tinyworld-tile-variation/SKILL.md
.codex/skills/tinyworld-tinyverse-collectibles/SKILL.md
.codex/skills/tinyworld-tinyverse-race-track/SKILL.md
.codex/skills/tinyworld-tool-icons-and-modes/SKILL.md
.codex/skills/tinyworld-visual-qa/SKILL.md
.codex/skills/tinyworld-webxr/SKILL.md
.agents/skills/3d-modeling/SKILL.md
.agents/skills/fractal/SKILL.md
.agents/skills/poly-pizza-api/SKILL.md

Metadata

Files
0
Version
8afdf00
Hash
9fda433c
Indexed
2026-07-06 00:20

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 15:07
浙ICP备14020137号-1 $Гость$