1仕組みと動作原理
SKILL.md 自体はわずか 93 行 / 3.2KB のルーティングテーブルとして機能します。本文の「Skill Contents」で 7 つの docs、5 つの examples、2 つの templates、1 つの cheatsheet を一覧化し、コンテキストに 50KB 以上のドキュメントを一度に流し込むのではなく、エージェントがタスクに応じて該当ファイルをロード(段階的開示)します。
- `docs/compute-shaders.md` - GPU compute with instanced arrays
Cursor 側では同様の開示戦略を明示的な記述に落とし込んでいます。.mdc の本文には 3〜5 行の要約のみを残し、@file 参照で skills/ 配下の元ドキュメントを指し示しています(5 つの .mdc は合計わずか 5.9KB ですが、10 本の @ 参照が含まれています)。
The source-of-truth documentation lives under `skills/webgpu-threejs-tsl/`. Reference these files directly when deeper guidance is needed:
「正しいコードを書ける」ための真の要は、ドキュメントで繰り返し強調されている TSL のセマンティクストラップです。TSL はノードプロパティの代入のみをインターセプトし、JS 変数の再代入は検知できません。そのため、If() 内で value = value.add(1.0) と記述しても暗黙的に無視されます(エラーを出さず古いノードを返します)。
**TSL can intercept property assignments on nodes, but NOT JavaScript variable reassignment.**
単にルールを与えるだけでなく失敗のメカニズムも説明することで、モデルが別の書き方で同じ過ちを繰り返すのを防ぎます。ドキュメントでは、JS 変数の再代入が新しいノードを作成し TSL がその代入を認識できないこと、およびスカラーは .x/.y プロパティを持たないためプロパティ代入で回避できないことを解説しています。
**Why it fails:** `value = value.add(1.0)` creates a new TSL node and reassigns the JavaScript variable to point to it.
バージョンの差異は実行時の検出ではなく、ドキュメントの記載項目として固定化されています。スキルはユーザープロジェクトの three バージョンを読み取るのではなく、r17x〜r18x の破壊的変更を対照項目としてまとめ、モデル自身に照合させます。
> **Note:** `PostProcessing` was renamed to `RenderPipeline` in r183. `PostProcessing` still works as a compatibility wrapper but is deprecated.
テンプレートは擬似コードではなく、そのまま利用可能なファイル全体のスケルトンです。セクション構成(CONFIG/GLOBALS/INITIALIZATION/SCENE/ANIMATION/EVENT)、挿入ポイントの明示、外部デバッグ用に内部オブジェクトを export する設計となっています。
// Export for external access if needed
WGSL エスケープハッチ: TSL で表現できない場合や既存の WGSL を移植する必要がある場合、wgslFn() を使って WGSL 関数全体を TSL ノードグラフに埋め込むことができます。またドキュメントには WGSL の型、構文、組み込み関数のリファレンスも付属しており、モデルが TSL から離れても正しい WGSL を記述できるよう配慮されています。
TSL allows embedding raw WGSL (WebGPU Shading Language) code when you need direct GPU control.
WebGPU 特有の実行時障害(デバイスロスト、limits/features)もコーディング指針に組み込まれており、単に動作するだけでなく GPU のクラッシュやバッファ上限にも配慮したコードを生成します。
Three.js accepts `requiredLimits` as a renderer constructor option, which gets passed through to `requestDevice()`:
2コア機能
3外部依存関係
| Kind | Dependency / Endpoint |
|---|---|
| package | three(npm 包,生成项目需自装) |
| package | three/addons 子路径(OrbitControls、BloomNode 等 addons 模块) |
| network | 文档引用链接(仅 markdown 里的参考资料链接,仓库内无任何抓取/请求代码,不被 skill 调用) |
4推奨統制措置と判定根拠
- SKILL.md: スクリプト実行や外部への影響を伴わない、純粋なプロンプト指示およびルールテキストです。
5二重目の独立検証
- [ok] pin commit 与工作副本一致 — git rev-parse HEAD 输出 af2319bd01bb7cc881267a9ef42cafdaf5e9029d,与 .git/shallow 首行相同,等于任务 pin commit;结论只对该 commit 有效。
- [ok] skill 目录定位 — skills/webgpu-threejs-tsl/SKILL.md 存在且 frontmatter name: webgpu-threejs-tsl 与 slug 对应;同目录含 REFERENCE.md、docs/×7、examples/×5、templates/×2,路径写入 skill.path。
- [discrepancy] license 声明与仓库实际文件 — README.md 有『## License』段声明 MIT License,.claude-plugin/plugin.json 也写 "license": "MIT";但 git ls-tree -r 全量清单里没有 LICENSE / LICENSE.md 文件,全仓 grep -il license 只命中 plugin.json、README.md 与 5 个 examples 的注释,与 GitHub API license=null 一致。即:许可为『源码内声明』而非仓内标准许可文件。
- [discrepancy] README 自述的 skill 结构图 vs 实际文件 — README『## Skill Structure』的 docs/ 分支只列 core-concepts / materials / compute-shaders / post-processing / wgsl-integration / device-loss 六篇(以 `└── device-loss.md` 收尾),而 docs/ 实有 7 篇——漏列 limits-and-features.md;SKILL.md 的 Skill Contents 则完整列出七篇。属 README 文档漂移。
- [discrepancy] Cursor 摘要与 docs 的 API 世代是否一致(后处理) — .cursor/rules/post-processing.mdc 仍教 `import { PostProcessing } from 'three/webgpu';` 并说 postProcessing.renderAsync(),而 docs/post-processing.md 开篇即注明 r183 已改名 RenderPipeline、旧名仅为兼容包装,examples/post-processing.js 实际用的是 `new THREE.RenderPipeline(renderer)`。README 自称 shim 会『edits flow through automatically』——该说法对手写摘要句不成立。
- [discrepancy] Cursor 摘要与 docs 的 API 世代是否一致(compute 派发) — .cursor/rules/compute-shaders.mdc 写『dispatched via `renderer.computeAsync()`』与『- `renderer.computeAsync(kernel)` to dispatch』,而 docs/compute-shaders.md『Execution Methods』明确『// Note: computeAsync() is deprecated since r181.』并给出『await renderer.init() at startup, then renderer.compute() synchronously』;templates/compute-shader.js 与 examples/particle-system.js 用的都是 renderer.compute(...)。同一漂移问题的第二例。
- [ok] 外部依赖反查:是否存在 CDN/网络调用 — 全仓 grep -riE 'unpkg|jsdelivr|cdn\.|importmap|import-map' 零命中;templates/examples 的 import 全部是裸包名(three、three/webgpu、three/tsl、three/addons/...),无 URL 形式的模块来源。故 external_deps 只列 npm 包,security.network_calls 为空。
- [ok] 脚本/凭证面反查 — git ls-tree 全清单只有 .md/.mdc/.json/.js;无 package.json(因此无 npm scripts、无依赖安装钩子)、无 scripts/、无 .sh/.py;危险 token 扫描对 child_process/eval/new Function/process.env/.env/token/secret/document.cookie/credentials 均无命中。scripts_executed 与 credential_reads 为空有据。
6結論
afb594cdc14fec2b…