About spacetimedb-clients
A cross-language SpacetimeDB client skill covering shared SDK concepts and client workflows. It helps developers manage connections, subscriptions, local caches, generated bindings, and reducer calls across SDKs.
Key features
- 01Shared client connection lifecycle
- 02Binding generation and naming guidance
- 03Subscription and cache behavior
- 04Reducer invocation guidance
- 05Cross-SDK implementation references
Use cases
- 01Building a SpacetimeDB client
- 02Debugging empty subscription caches
- 03Choosing and managing subscriptions
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ danmossa/ spacetimedb-skills --skill spacetimedb-clientsAfter installing, type/spacetimedb-clientsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/clients-api.mdclients-codegen.mdclients-connection.mdclients-subscriptions-semantics.mdclients-subscriptions.mdclients.mdDetails
From the project READMEUse this skill for SDK concepts shared across languages.
Core client flow
- Generate module bindings from the current module, not stale checked-in examples.
- Build a
DbConnectionwith the host URI, database name or identity, optional auth token, and connection callbacks. - Start or tick the connection according to the SDK. Some SDKs do not process callbacks until advanced.
- Register row/reducer/subscription callbacks before relying on them.
- Subscribe to tables or queries; subscribed rows appear in the local cache after the subscription is applied.
- Read data from the local cache through generated table handles.
- Invoke reducers through generated reducer handles; observe reducer outcomes through SDK-specific events or event tables.
Cross-SDK rules
- The subscription handle manages lifecycle, not row data. Rows live in the connection's local cache.
subscribeToAllTablesis convenient but hard to cancel or optimize. Prefer specific typed queries for production clients.- Subscribe before reading from the cache. Empty cache usually means no applied subscription, not no rows in the database.
- Unsubscribe is asynchronous; rows may remain until the server confirms the unsubscribe.
- Public tables and public reducers/procedures are generated for normal clients. Use
--include-privateonly for trusted tooling. - Generated names follow the module schema. Do not guess accessors when local bindings are available.
- Subscriptions that join tables need indexes on join columns; overlapping subscriptions can duplicate work and complicate cache expectations.
Reference map
| Need | Open |
|---|---|
| SDK overview and choosing a language | references/clients.md |
| General API concepts | references/clients-api.md |
| Code generation | references/clients-codegen.md |
| Connection lifecycle | references/clients-connection.md |
| Subscriptions and semantics | references/clients-subscriptions.md, references/clients-subscriptions-semantics.md |
Guidance
- Load a language-specific client skill when writing concrete SDK code.
- Subscribe before reading from the local cache unless the selected SDK reference says otherwise.
- Keep reducer call patterns consistent with the generated binding names and the SpacetimeDB version.
Comments
Markdown supported