detour-onboarding
Complete onboarding guide for developers who are new to Detour, the open-source deferred deep…
TypeGPU is type-safe WebGPU in TypeScript. Use whenever the user writes, debugs, or designs TypeGPU code: 'use gpu' shader functions, tgpu.fn, buffers, textures, bind groups, compute and render pipelines, command encoders, render passes, render bundles, vertex layouts, slots,
$ npx -y skills add software-mansion-labs/skills --skill typegpu --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/typegpuContext preview
The summary Claude sees to decide when to auto-load this skill.
TypeGPU is type-safe WebGPU in TypeScript. Use whenever the user writes, debugs, or designs TypeGPU code: 'use gpu' shader functions, tgpu.fn, buffers, textures, bind groups, compute and render pipelines, command encoders, render passes, render bundles, vertex layouts, slots,
name: typegpu description: >- TypeGPU is type-safe WebGPU in TypeScript. Use whenever the user writes, debugs, or designs TypeGPU code: 'use gpu' shader functions, tgpu.fn, buffers, textures, bind groups, compute and render pipelines, command encoders, render passes, render bundles, vertex layouts, slots, accessors, @typegpu/react hooks (useRoot, useFrame, useUniform), React Native worklet rendering, and any TypeGPU API. Shader logic and CPU-side resources are tightly coupled - handle both sides here even if the user only mentions one (e.g. "how do I write a shader", "how do I create a buffer"). Trigger on any mention of typegpu, tgpu, "use gpu", TypedGPU, or WebGPU code written using TypeGPU's schema API (d.*, tgpu.*, std.*). Do NOT trigger for raw WebGPU (using GPUDevice/GPURenderPipeline directly without tgpu), WGSL-only questions, Three.js, Babylon.js, or WebGL.
A single schema (`d.*`) defines a GPU type, CPU buffer layout, and TypeScript type at once - no manual alignment, type mapping, or casting. The build plugin `unplugin-typegpu` transforms `'use gpu'`-marked TypeScript for runtime WGSL transpilation, enabling type inference and polymorphism across the CPU/GPU boundary.
This skill targets TypeGPU `0.12`. If the user's project is on an older release, verify API availability before relying on examples or recommended patterns here.
---
**Read before writing virtually any shader or GPU function** — these two cover the rules that trip people up most:
**Read when the task specifically involves:**
---
import { tgpu, d, std, common } from 'typegpu';
const root = await tgpu.init(); // request a GPU device
const root = tgpu.initFromDevice({ device }); // or wrap an existing GPUDevice
const context = root.configureContext({ canvas, alphaMode: 'premultiplied' });Create one root at app startup. Resources from different roots cannot interact. Teardown: `root.destroy()` destroys all resources created through the root, plus the device itself if the root came from `tgpu.init` (not `initFromDevice`).
---
A schema defines memory layout and infers TypeScript types; the same schema is used for buffers, shader signatures, and bind group entries.
d.f32 d.i32 d.u32 d.f16 // f16 needs the 'shader-f16' device feature (references/setup.md) // d.bool is NOT host-shareable - use d.u32 in buffers
d.vec2f d.vec3f d.vec4f // f32 d.vec2i d.vec3i d.vec4i // i32 d.vec2u d.vec3u d.vec4u // u32 d.vec2h d.vec3h d.vec4h // f16 d.vec2b d.vec3b d.vec4b // bool - shader-side only (not host-shareable) d.mat2x2f d.mat3x3f d.mat4x4f
Instance types: `d.vec3f()` -> `d.v3f`, `d.mat4x4f()` -> `d.m4x4f`.
**Vector constructors are richly overloaded** — they compose from any mix of scalars, smaller vectors, and swizzles that adds up to the right component count (`d.vec4f(rgb, 1)`, `d.vec3f(v.xy, newZ)`). Prefer them over manual component decomposition; full overload listing in `references/types.md`.
const Particle = d.struct({
position: d.vec2f,
velocity: d.vec2f,
color: d.vec4f,
});
const ParticleArray = d.arrayOf(Particle, 1000); // fixed-size**Runtime-sized schemas.** `d.arrayOf(Element)` without a count returns a *function* `(n: number) => WgslArray<Element>`. This dual nature is the key: pass the function itself (unsized) to bind group layouts, call it with a count (sized) for buffer creation.
// Plain array - arrayOf without count is already a factory:
const layout = tgpu.bindGroupLayout({
data: { storage: d.arrayOf(d.f32), access: 'mutable' }, // unsized for layout
});
const buf = rSoftware Mansion's set of skills for AI-assisted React Native development.
Repo: software-mansion-labs/skills
Complete onboarding guide for developers who are new to Detour, the open-source deferred deep…
Use when the user mentions migrating deep links, switching away from Branch or AppsFlyer,…
Software Mansion's guide for migrating Expo SDK apps to Meta Quest using expo-horizon…
Software Mansion's Fishjam — hosted WebRTC platform for video, audio, and one-to-many…
Node.js / TypeScript server SDK for Fishjam — backends that create rooms, mint peer tokens,…
Fishjam platform fundamentals — domain model and auth shared by all SDKs. Covers glossary…