spacetimedb-client-rust
Use when writing SpacetimeDB Rust clients, generated Rust bindings, connection code, subscriptions, cache access, reducer invocation, callbacks, or identity handling. Triggers on: Rust client, Rust SDK, generated Rust bindings, Rust subscription, Rust reducer call, Rust callbacks.
How do I install this agent skill?
npx skills add https://github.com/danmossa/spacetimedb-skills --skill spacetimedb-client-rustIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides comprehensive documentation and standard code templates for developing SpacetimeDB client applications using the Rust SDK. No security issues or malicious patterns were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Use this skill for Rust client implementation.
Core Rust patterns
Generate Rust bindings and import generated names from the local module:
spacetime generate --lang rust --out-dir client/src/module_bindings --module-path spacetimedb
use module_bindings::DbConnection;
let conn = DbConnection::builder()
.with_uri("ws://localhost:3000")
.with_database_name("my-database")
.on_connect(|ctx, identity, _token| {
log::info!("connected: {identity}");
ctx.subscription_builder().subscribe_to_all_tables();
})
.on_connect_error(|_ctx, err| log::error!("connect error: {err}"))
.on_disconnect(|_ctx, err| log::info!("disconnected: {err:?}"))
.build()?;
conn.run_threaded();
Runtime rules
- Advance the connection with
run_threaded,run_async, orframe_tick; callbacks and cache updates require one of these. - Read subscribed rows through
conn.db.<table>().iter(),.count(), and generated unique/index handles. - Register
on_insert,on_delete, andon_updatecallbacks on generated table handles;on_updaterequires a primary key. - Use
conn.reducers.<reducer>(...)orctx.reducers()in trait-generic callback contexts. - Keep generated binding module names and feature flags aligned with the local project.
Reference map
| Need | Open |
|---|---|
| Rust SDK API | references/clients-rust.md |
Guidance
- Match generated module names and binding paths from the local project.
- Keep connection lifecycle, subscription callbacks, and reducer calls aligned with the Rust SDK reference.
- Route Rust server module schema or reducer code to table and reducer skills rather than this client skill.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/danmossa/spacetimedb-skills/spacetimedb-client-rust">View spacetimedb-client-rust on skillZs</a>