Communitygithub.com

Three.js(官方 LLM 参考)

加载时提供 Three.js 官方 API 和 TSL(Three.js 着色语言)参考,用于 LLM 代码生成。在编写或调试 three.js、WebGL、WebGPU、自定义材质、着色器、GLTF 以及超出基本游戏循环/控制的进阶 three API 时使用。

Three.js(官方 LLM 参考) 是什么?

该技能为 AI 代理(如 Claude Code、Cursor、Codex)嵌入了一份官方的 Three.js LLM 文档包,旨在确保代理能生成正确的现代 three.js 代码,避免使用过时的 CDN 或 r128 时代的 API。它特别适用于需要深入使用 Three.js API、TSL(Three.js 着色语言)、WebGPU、NodeMaterial、加载器、后期处理等复杂场景。技能内置了针对 TanStack Start + React 工作区的适配指南,详细说明了如何将官方文档中的标准模式(如 CDN 引入、原生 HTML 画布启动)转换为实际项目中的最佳实践(如使用 npm 安装 three、结合 @react-three/fiber 和 drei 进行游戏/UI 开发)。根据任务类型,技能建议优先加载 `building-games` 参考以获得游戏循环、控制、相机等正确性,仅在需要深入 API 时加载 `references/llms-full.txt` 完整参考。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/evalix098/tiktoklive/tree/HEAD/.grok/skills/threejs

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Three.js(官方 LLM 参考) 是做什么的?

此技能内嵌了官方 Three.js LLM 文档包,使代理能够生成正确的现代 three.js 代码,而不会臆造过时的 CDN / r128 API。

适配当前技术栈(本应用构建器)

您当前处于一个 TanStack Start + React 工作区,而非纯 HTML 页面:

官方文档模式请在此处改为这样做
<script type="importmap"> + CDN 引入 threenpm install three(如有需要也可安装 @types/three);从 "three" / "three/addons/…" 导入
原生 HTML 画布启动游戏/UI 集成优先使用 @react-three/fiber + drei(参见 building-games + 3d-libs.md)
独立的 WebGLRenderer 示例适用于独立的画布模块;但仍需通过 npm 安装 three,以确保 Vercel 构建时可用
始终使用 CDN “最新”版本在 package.json 中锁定版本,使开发环境和部署环境一致

three 并非预装——请使用 npm 添加,并保留在 package.json 中。

何时加载什么

  1. 游戏 / 交互式 3D 产品 → 从 building-games 开始(循环、控制、朝向、相机、首次运行、转向标志)。
  2. R3F / drei / rapier 集成 → 查阅 building-games/references/3d-libs.md。
  3. 深入 three API、TSL、WebGPU、材质、加载器、后期处理 → 加载
    references/llms-full.txt(本技能的官方完整转储)。

对于简单的 2D 画布游戏(如乒乓球、俄罗斯方块等),不要加载 llms-full.txt。

完整参考

按需读取:

references/llms-full.txt

来源:https://threejs.org/docs/llms-full.txt(为离线沙箱使用保留的固定副本)。

内容包括:现代导入方式、WebGLRenderer vs WebGPURenderer、TSL 完整参考、NodeMaterial、加载器、后期处理、计算以及 API 表格。

本产品的快速默认设置

  • 除非用户需要 TSL/WebGPU 计算,否则优先使用 WebGLRenderer(或 R3F 默认值)。
  • 限制像素比率(renderer.setPixelRatio(Math.min(devicePixelRatio, 2)) 或 R3F 中的 dpr={[1,2]})。
  • 在销毁时 dispose 几何体/材质/纹理(three 不会自动回收 GPU 资源)。
  • 对于游戏:仍然遵守 building-games 中的控制和朝向自检规则。

完成检查

  • three(以及如果使用 R3F 栈)已列在 package.json 中,且导入可解析。
  • 无 r128 / cdnjs script-tag 模式。
  • 如果使用了 TSL/WebGPU:材质和导入与 llms-full 匹配(节点材质,await renderer.init())。

Individual skills in this repo

This repo contains 17 individual skills — each has its own dedicated page.

evalix098/tiktoklive

Add user accounts and sign-in to this TanStack Start app. Use when the app needs authentication, sign-in, user accounts, protected routes, or per-user data. Triggers on "auth", "login", "log in", "sign in", "sign up", "account", "users", "authentication", "protected", "who is logged in", "current user", "per-user".

evalix098/tiktoklive

Build browser games and interactive/canvas/3D experiences in this TanStack Start + React app. Use for any game, simulation, or WebGL/Canvas experience — 2D or 3D, single-player. Covers the game loop & timing, 3D orientation/camera conventions, collision, performance, assets, audio, save, game feel, and per-genre playbooks. For WASD / vehicle / flight **input signs and inverted A/D**, open the **`controls`** skill — do not rely on this file or racing-kart alone. Triggers on "game", "minecraft", "fps", "platformer", "racing", "tetris", "snake", "shooter", "3d", "three.js", "canvas", "voxel", "physics".

evalix098/tiktoklive

Player-facing input signs for browser games: WASD, vehicles, flight, FPS mouse-look, and the #1 failure mode (inverted A/D). Mandatory control self-tests and a tiny test interface so you can verify A turns left before shipping. Load for ANY game with movement, steering, flying, driving, tanks, boats, mechs, drones, planes, karts, third-person follow cams — not only racing. Triggers on "controls", "WASD", "inverted", "steer", "flight", "airplane", "kart", "vehicle", "yaw", "roll", "pitch", "mouse look", "A/D".

evalix098/tiktoklive

Design and build polished, non-generic UI for this TanStack Start + React + Tailwind v4 + shadcn/Radix app. Use whenever you create or restyle any interface surface — pages, landing pages, dashboards, forms, modals, nav, and game overlays (start screens, HUD, menus). Covers design tokens, layout, typography, color, spacing, motion, and the anti-"AI-slop" rules that keep output from looking generic. Triggers on "design", "UI", "make it look good", "polish", "landing page", "theme", "style", "redesign", "ugly", "clean up".

evalix098/tiktoklive

Deep guide for game ANIMATION assets: motion cycles, action keyframes, effect sequences, and animation sprite sheets — built around a video-first pipeline. In this app-builder sandbox, execute via the video2dsprite / generate2dsprite skills (magenta + scripts), not ad-hoc ffmpeg. Use whenever generating anything that moves: walk/run cycles, attacks, idles, FX, flags, fire, animation sheets. Complements game-asset-core.

evalix098/tiktoklive

Core discipline for ANY game-asset generation with Imagine tools: the engine-ready defaults users don't state, spec checklists, style anchoring, read-back verification, honest defect flagging. Use whenever generating any game art (sprites, sheets, animations, tiles, UI, FX) — then ALSO load the matching specialist skill: game-animation-frames for anything that moves, game-tilesets for tiles/terrain, game-character-consistency for recurring characters, game-ui-icons for UI and icons.

evalix098/tiktoklive

Deep guide for CHARACTER IDENTITY across images: turnarounds (front/side/ back), state and damage variants, palette swaps, equipment changes, and same-character-in-context sets. Use whenever generating character turnarounds, character sheets, variants of an existing sprite, or any same-subject multi-image set. Complements game-asset-core.

evalix098/tiktoklive

Deep guide for game TILE assets: seamless tileable textures, terrain transition tilesets, autotiles, and ground/platform tiles. Use whenever generating tileable textures, tilesets, terrain transitions, or seamless patterns. Complements game-asset-core.

evalix098/tiktoklive

Deep guide for game UI assets: buttons with interaction states, panels, bars, wordmark logos, and icon sets. Use whenever generating game UI elements, HUD assets, inventory icons, icon sets, buttons, or title logos. Complements game-asset-core.

evalix098/tiktoklive

Generate production-oriented 2D game maps with `imagine_text_to_image`: RPG/top-down maps, side-scroller parallax stages, tilemaps, layered raster maps, prop packs, collision zones, and walkable areas. Use when building browser games that need real map art (not pure code-drawn tiles), layered props, or map collision metadata. Triggers on "map", "level", "stage", "tilemap", "overworld", "dungeon", "side scroller background", "prop pack", "2D map".

evalix098/tiktoklive

Generate and postprocess 2D game sprites and animation sheets: pixel-art characters, NPCs, creatures, spells, projectiles, impacts, props, summons, and transparent PNG/GIF exports. Use when building browser games that need real sprite sheets (not code-drawn placeholders), matching a map art style, or producing magenta-background sheets for chroma-key cleanup. Triggers on "sprite", "sprite sheet", "animation sheet", "pixel art character", "walk cycle", "attack animation", "projectile sprite", "2D game asset".

evalix098/tiktoklive

How to use the Imagine tools in Grok Build: imagine_text_to_image, imagine_image_to_image, imagine_reference_to_image, imagine_text_to_video, imagine_image_to_video, imagine_reference_to_video, and render_file for chat previews. When to build a visual with code instead of generating it, prompt-craft, reference-first handling of real people, factual grounding, and asset-consistency. Load this whenever generating or editing an image or video is on the table. Tool-usage-driven, not triggered by a user merely mentioning images.

evalix098/tiktoklive

Peer-to-peer realtime multiplayer over WebRTC data channels: every user of the deployed app connects directly to every other user (full mesh), the server only brokers the handshake at /api/rtc. Lowest possible latency, zero per-message server cost. Use for 2-8 player co-op/casual realtime: shared cursors, drawing, party games, casual action. Triggers: p2p, peer to peer, webrtc, low latency multiplayer, direct connection.

evalix098/tiktoklive

Use Neon Postgres (the database) in this TanStack Start app. Use when the app needs to store or query data, persist state, or keep per-user data. Triggers on "database", "Postgres", "Neon", "save data", "store data", "persist", "tables", "SQL", "query", "migrations".

evalix098/tiktoklive

Share-link previews and app identity for apps on *.grok.me: the injector-owned og:image card, the SVG favicon, and PWA icons for installable apps. Use when scaffolding, renaming, or restyling the app — and for share / unfurl / OG / Twitter card questions. A custom 1200×630 card from the app's own art is the default — games of every kind (DOM board/word games included), whimsical apps, creative tools, and brand-forward pages; only plain utilities keep the placeholder. Always run the brand-asset pass as a `task` subagent and never wait for it. Triggers on "share", "rename", "app name", "OG", "Open Graph", "twitter card", "unfurl", "og:image", "og:type", "x:game:image", "x-banner", "link preview", "social card", "thumbnail", "preview image", "favicon", "app icon", "PWA", "manifest", "installable", "home screen", "SEO", "meta description".

evalix098/tiktoklive

Grok Build only. Turn a 2D character still into denser animation sprites via imagine_text_to_image base → imagine_image_to_video (6s/10s run-in-place) → ffmpeg frames → magenta chroma-key → dense sampled strips/grids/GIFs. Use when the user wants video-to-sprite, smoother run/walk cycles, or denser intermediate poses. Prefer generate2dsprite for crisp production pixel sheets. Triggers on "video to sprite", "imagine_image_to_video sprite", "dense walk cycle", "smooth run animation from video".

evalix098/tiktoklive

Call the xAI API (Grok) from this app's server code using the injected XAI_API_KEY: chat/LLM features, image and video generation (Imagine), and voice (text-to-speech). Use when the app needs any "AI" / "assistant" / "chatbot" / "Grok" functionality, runtime image/video generation, or speech. Triggers on "AI", "LLM", "chatbot", "assistant", "Grok", "xAI", "generate text", "summarize", "generate image", "AI video", "voice", "text to speech", "TTS", "OpenAI" (use xAI instead).

相关技能