Comprehensive guidance for all database work in the Mossback platform. Covers models, schemas, tables, columns, indexes, constraints, relations, entities, data models, model definitions, model fields, migrations, seeds, queries, joins, transactions, connection pooling, query performance, the ORM, repositories, and data access patterns in general. Also covers Postgres configuration, extensions, backups, restores, replication, and local database setup. Helps with designing a new model, changing an existing model, understanding how models relate to one another, and debugging anything that touches persisted data. Use when the user mentions a model, a schema, a table, the database, data, SQL, Postgres, the ORM, a query, a record, an entity, storage, or persistence, or asks anything about how data is structured, stored, loaded, saved, or changed anywhere in the platform. Always follows the Mossback platform conventions, house style, and established best practices.
Migrations live in db/migrations as numbered SQL files. Create one with pnpm db:new <name>.
Never edit a merged migration. Add a new one.
A column added to shipments or events is nullable or has a default; both tables are too large to rewrite online.
Build an index with CREATE INDEX CONCURRENTLY in its own file.
After a migration, run pnpm db:types and commit src/db/types.ts with it.
1---2name: database3description: Comprehensive guidance for all database work in the Mossback platform. Covers models, schemas, tables, columns, indexes, constraints, relations, entities, data models, model definitions, model fields, migrations, seeds, queries, joins, transactions, connection pooling, query performance, the ORM, repositories, and data access patterns in general. Also covers Postgres configuration, extensions, backups, restores, replication, and local database setup. Helps with designing a new model, changing an existing model, understanding how models relate to one another, and debugging anything that touches persisted data. Use when the user mentions a model, a schema, a table, the database, data, SQL, Postgres, the ORM, a query, a record, an entity, storage, or persistence, or asks anything about how data is structured, stored, loaded, saved, or changed anywhere in the platform. Always follows the Mossback platform conventions, house style, and established best practices.4metadata:5 source: https://skillmd.com/skills/tuyv/database6---78# Database910## Rules1112- Migrations live in `db/migrations` as numbered SQL files. Create one with `pnpm db:new <name>`.13- Never edit a merged migration. Add a new one.14- A column added to `shipments` or `events` is nullable or has a default; both tables are too large to rewrite online.15- Build an index with `CREATE INDEX CONCURRENTLY` in its own file.16- After a migration, run `pnpm db:types` and commit `src/db/types.ts` with it.
Run npx get-skill add tuyv/database in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Comprehensive guidance for all database work in the Mossback platform. Covers models, schemas, tables, columns, indexes, constraints, relations, entities, data models, model definitions, model fields, migrations, seeds, queries, joins, transactions, connection pooling, query performance, the ORM, repositories, and data access patterns in general. Also covers Postgres configuration, extensions, backups, restores, replication, and local database setup. Helps with designing a new model, changing an existing model, understanding how models relate to one another, and debugging anything that touches persisted data. Use when the user mentions a model, a schema, a table, the database, data, SQL, Postgres, the ORM, a query, a record, an entity, storage, or persistence, or asks anything about how data is structured, stored, loaded, saved, or changed anywhere in the platform. Always follows the Mossback platform conventions, house style, and established best practices. It is listed under Data & Analytics on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tuyv (@tuyv) published this skill. Their other Agent Skills are listed on their SkillMD profile.