mcpField
S
spacetimedb-databases

spacetimedb-databases

github.com/danmossaData & databases2168 installsUpdated 19w ago
Repository

About spacetimedb-databases

A skill for SpacetimeDB database module lifecycle and migration work. It guides developers through publishing, migration safety, transaction behavior, and references for related tasks.

Key features

  1. 01Explain module and database lifecycle
  2. 02Guide build and publish workflows
  3. 03Classify automatic migration changes
  4. 04Recommend additive production migrations
  5. 05Link to development and transaction references

Use cases

  1. 01Check schema changes before publishing
  2. 02Plan migrations that automatic migration disallows
  3. 03Reset development data safely
  4. 04Find guidance on transactions and module publishing

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/danmossa/spacetimedb-skills --skill spacetimedb-databases

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

Bundled files

References and scripts installed along with SKILL.md.

references/
databases-automatic-migrations.md
databases-building-publishing.md
databases-cheat-sheet.md
databases-developing.md
databases-incremental-migrations.md
databases-transactions-atomicity.md
databases.md

Details

From the project README

Use this skill for database module lifecycle and migration work.

Core patterns

  • A module is the code and schema; a database is a published instance identified by name or identity.
  • spacetime publish <DATABASE_NAME> builds, uploads, runs init if present, and starts serving the module.
  • Publishing an existing database attempts an automatic migration and hot-swaps the module atomically while maintaining active client connections.
  • Regenerate and ship client bindings after public schema, reducer, procedure, or view surface changes.
  • Reducers run in automatic transactions; procedures open transactions manually when they need database writes.

Migration checklist

  • Safe: add tables, add indexes, add or remove auto-increment annotations, make private tables public, add reducers, remove unique constraints.
  • Potentially breaking: add a column at the end with a default, change or remove reducers, make a public table private, remove primary keys, remove indexes used by subscriptions.
  • Forbidden by automatic migration: remove tables, remove/rename/reorder/change existing columns, add columns without defaults, add columns in the middle, change schedule-table status, add unique or primary-key constraints.
  • During development, --delete-data can reset data. Do not use it for production unless permanent data loss is intended.
  • For forbidden production changes, use an additive migration strategy: add new shape, dual-write/backfill, move clients, then retire old shape later.

Reference map

NeedOpen
Overview and learning pathreferences/databases.md
Local developmentreferences/databases-developing.md
Build and publishreferences/databases-building-publishing.md
Migration rulesreferences/databases-automatic-migrations.md, references/databases-incremental-migrations.md
Transaction behaviorreferences/databases-transactions-atomicity.md
Dense syntax examplesreferences/databases-cheat-sheet.md

Guidance

  • Check migration safety before changing table shape, names, indexes, constraints, or public/private visibility.
  • For schema definitions, load spacetimedb-tables.
  • For reducer transaction behavior, load spacetimedb-reducers.

Comments

Markdown supported