Skip to content

majiayu000/spellbook / skills/code-built-3d

code-built-3d

Unverified

用代码从零件搭 3D 场景并能反过来拆开:每个物件是一个往 Assembly 里加零件的函数(盒子、圆柱、球、线),渲染成技术插画(白灰三档面、细黑描边、白雾),正交等距相机在镜头之间连续运镜,外壳可以降下去露出内部,选中的部分能爆炸成零件并列出零件清单,场景按块无限生成。零图片、零外部资源,three.js 已内置。演示是「无尽楼」:向上无尽的公寓楼,电梯一直往上走,点任意一层进去看、拆开。当用户说「用代码搭一个 3D 场景」「等距 3D 城市」「做成 Train of Thoughts 那种」「全程代码生成不要图片」「能剖开 / 去壳 / 爆炸的 3D」「无限生成的场景」「three.js 做构造」时使用。只在明确请求时触发,忽略顺带提及。

FileKindSize
SKILL.mdskill md7.0 KB
assets/demo.htmlother14.8 KB
assets/kit.jsscript14.9 KB
assets/tower.jsscript21.4 KB
scripts/check.mjsscript7.6 KB
scripts/lib/env.mjsscript3.5 KB
scripts/package.jsonmanifest289 B
scripts/serve.mjsscript1.5 KB

scripts/serve.mjs

View on GitHub
#!/usr/bin/env node
// Static file server for a scene folder (ES modules do not load from file://).
//   node serve.mjs <dir> [port]      → http://localhost:<port>/
// Also importable: const { url, close } = await serve(dir).
import http from 'http';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const TYPES = { '.html': 'text/html; charset=utf-8', '.js': 'text/javascript', '.mjs': 'text/javascript', '.css': 'text/css', '.json': 'application/json', '.svg': 'image/svg+xml', '.png': 'image/png' };
export function serve(dir, port = 0) {
  const root = path.resolve(dir);
  const server = http.createServer((req, res) => {
    const p = path.join(root, decodeURIComponent(new URL(req.url, 'http://x').pathname));
    if (!p.startsWith(root)) { res.writeHead(403).end(); return; }
    const f = fs.existsSync(p) && fs.statSync(p).isDirectory() ? path.join(p, 'demo.html') : p;
    fs.readFile(f, (err, buf) => {
      if (err) { res.writeHead(404).end('not found'); return; }
      res.writeHead(200, { 'content-type': TYPES[path.extname(f)] || 'application/octet-stream', 'cache-control': 'no-store' }).end(buf);
    });
  });
  return new Promise(ok => server.listen(port, '127.0.0.1', () => ok({ url: `http://127.0.0.1:${server.address().port}/`, close: () => server.close() })));
}
if (process.argv[1] === fileURLToPath(import.meta.url)) {
  const { url } = await serve(process.argv[2] || '.', +(process.argv[3] || 8765));
  console.log(`serving ${path.resolve(process.argv[2] || '.')} at ${url}`);
}
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall