spacetimedb-databases

Use when creating, developing, building, publishing, migrating, or reasoning about SpacetimeDB database modules. Covers local development, module build/publish flow, transactions, automatic migrations, incremental migrations, and the database cheat sheet. Triggers on: database module, spacetime publish, build module, migration, transaction, atomicity, developing module.

danmossa/spacetimedb-skills44 installsMITSynced Aug 22

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI
---
name: spacetimedb-databases
description: Use when creating, developing, building, publishing, migrating, or reasoning about SpacetimeDB database modules. Covers local development, module build/publish flow, transactions, automatic migrations, incremental migrations, and the database cheat sheet. Triggers on: database module, spacetime publish, build module, migration, transaction, atomicity, developing module.
license: MIT
---

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

| Need                       | Open                                                                                                                                                                                           |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Overview and learning path | [references/databases.md](references/databases.md)                                                                                                                                             |
| Local development          | [references/databases-developing.md](references/databases-developing.md)                                                                                                                       |
| Build and publish          | [references/databases-building-publishing.md](references/databases-building-publishing.md)                                                                                                     |
| Migration rules            | [references/databases-automatic-migrations.md](references/databases-automatic-migrations.md), [references/databases-incremental-migrations.md](references/databases-incremental-migrations.md) |
| Transaction behavior       | [references/databases-transactions-atomicity.md](references/databases-transactions-atomicity.md)                                                                                               |
| Dense syntax examples      | [references/databases-cheat-sheet.md](references/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](../spacetimedb-tables/SKILL.md).
- For reducer transaction behavior, load [spacetimedb-reducers](../spacetimedb-reducers/SKILL.md).

More Database skills

supabase-postgres-best-practices

supabase/agent-skills

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

372.5k

prisma-database-setup

prisma/skills

Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup".

241.5k

prisma-postgres

prisma/skills

Prisma Postgres setup and operations guidance across Console, create-db CLI, Management API, and Management API SDK. Use when creating Prisma Postgres databases, working in Prisma Console, provisioning with create-db/create-pg/create-postgres, or integrating programmatic provisioning with service tokens or OAuth.

235.0k

← All Database skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY