mcpField
S
spacetimedb-clients

spacetimedb-clients

github.com/danmossaDevelopment2167 installsUpdated 19w ago
Repository

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

  1. 01Shared client connection lifecycle
  2. 02Binding generation and naming guidance
  3. 03Subscription and cache behavior
  4. 04Reducer invocation guidance
  5. 05Cross-SDK implementation references

Use cases

  1. 01Building a SpacetimeDB client
  2. 02Debugging empty subscription caches
  3. 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-clients

After installing, type/spacetimedb-clientsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
clients-api.md
clients-codegen.md
clients-connection.md
clients-subscriptions-semantics.md
clients-subscriptions.md
clients.md

Details

From the project README

Use this skill for SDK concepts shared across languages.

Core client flow

  1. Generate module bindings from the current module, not stale checked-in examples.
  2. Build a DbConnection with the host URI, database name or identity, optional auth token, and connection callbacks.
  3. Start or tick the connection according to the SDK. Some SDKs do not process callbacks until advanced.
  4. Register row/reducer/subscription callbacks before relying on them.
  5. Subscribe to tables or queries; subscribed rows appear in the local cache after the subscription is applied.
  6. Read data from the local cache through generated table handles.
  7. 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.
  • subscribeToAllTables is 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-private only 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

NeedOpen
SDK overview and choosing a languagereferences/clients.md
General API conceptsreferences/clients-api.md
Code generationreferences/clients-codegen.md
Connection lifecyclereferences/clients-connection.md
Subscriptions and semanticsreferences/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