What problem does it solve?
This Skill guides developers to author correct, deterministic WebAssembly server modules for SpacetimeDB using Rust, reducing runtime errors and misuses of the SpacetimeDB 2.0 API surface such as incorrect table attributes, mutable reducer contexts, or unsafe side effects.
Core Features & Use Cases
- Table and Index Patterns: Clear guidance for declaring tables, primary keys, auto-increment, and single- or multi-column indexes so data is stored and queried correctly.
- Reducer and Procedure Rules: Rules for writing reducers with an immutable ReducerContext, deterministic RNG usage via ctx.rng(), safe error handling via Result, and when to use procedures for network I/O.
- Lifecycle, Scheduled, and Event Patterns: Examples for init, client connect/disconnect, scheduled reducers, and event tables with on_insert subscription patterns.
- Operational Best Practices: Transactional semantics, no global state, no filesystem/network in reducers, CLI build/publish commands, and common pitfalls to avoid.
Quick Start
Create a new Rust module that defines a public table and at least one reducer, build it with the spacetime CLI, and publish it to your target database.