skills/database-design/SKILL.md
Unified PostgreSQL database design skill — schema creation, migrations, indexing, multi-tenancy, connection pooling, seed data, and ORM integration (Prisma/Drizzle). Auto-triages: Quick (single table, add column, create index, simple migration) or Deep (multi-table schema, multi-tenant setup, migration strategy, full data model). MUST use for ANY PostgreSQL schema or database design request. Triggers: "design a schema," "create a table," "Prisma model," "Drizzle schema," "add an index," "migration strategy," "multi-tenant database," "normalize this," "PostgreSQL schema," "foreign key," "RLS policy," "JSONB vs relational," "cursor pagination," "soft deletes," "audit columns," "seed data," "connection pooling," "PgBouncer," "pool sizing," "factory pattern." Do not use for application-layer query optimization (nextjs-backend) or database administration (backups, replication).
npx skillsauth add cuozg/oh-my-skills database-designInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Design PostgreSQL schemas, write safe migrations, choose indexes, and define ORM models. Detect which ORM the project uses (Prisma vs Drizzle), match local conventions, and deliver production-quality database code.
| Signal | Mode | |--------|------| | One table/model, add column, single index, simple migration | Quick | | Multi-table schema, relationships, multi-tenant, migration strategy, full data model | Deep |
State triage: "This is [mode] — [reason]."
Check the project for ORM signals before writing any code:
| Signal | ORM |
|--------|-----|
| prisma/schema.prisma, @prisma/client in package.json | Prisma |
| drizzle.config.ts, drizzle-orm in package.json | Drizzle |
| Raw SQL files, no ORM detected | Raw SQL |
If both are present, ask which to use. If neither is present, ask the user's preference.
Load the relevant reference for the task:
read_skill_file("database-design", "references/schema-design.md")read_skill_file("database-design", "references/indexing.md")read_skill_file("database-design", "references/migrations.md")read_skill_file("database-design", "references/prisma.md")read_skill_file("database-design", "references/drizzle.md")read_skill_file("database-design", "references/seed-data.md")read_skill_file("database-design", "references/connection-pooling.md")prisma migrate dev, drizzle-kit generate, or raw SQL)lsp_diagnostics on changed files; confirm migration SQL is safe (no locks on large tables, no data loss)Load all references relevant to the feature scope.
lsp_diagnostics on all changed files, review migration SQL for safetyTIMESTAMP without timezoneSERIAL/INTEGER (wraps on large tables)created_at TIMESTAMPTZ DEFAULT now(), updated_at via trigger or ORMCREATE UNIQUE INDEX ... WHERE deleted_at IS NULLNOT NULL column without DEFAULT on large tables (causes full table rewrite pre-PG11)CREATE INDEX CONCURRENTLY for non-blocking index creation on production tablesSET lock_timeout = '5s' before DDL in production migrations to avoid lock queue builduplsp_diagnostics after every code change| From | To | When | |------|----|------| | Quick | Deep | Schema change touches 2+ tables or requires relationship design | | Deep | Quick | Analysis reveals single-table scope |
Carry forward context; tell user why.
Load on demand via read_skill_file("database-design", "references/<file>"):
schema-design.md — Naming conventions, data types, constraints, relationships, normalization, JSONB patterns, audit columns, soft deletesmigrations.md — Versioned migrations, zero-downtime DDL, expand-contract, idempotent scripts, data migrations, rollback strategiesmulti-tenancy.md — Shared schema + RLS, schema-per-tenant, tenant resolution, connection pooling, RLS policies with Prisma/Drizzleindexing.md — B-tree, GIN, GiST, partial indexes, expression indexes, covering indexes (INCLUDE), when NOT to index, composite index column orderprisma.md — Schema definition (@map/@db), migrations (dev/deploy), relations, client extensions, cursor pagination, transactions, raw SQLdrizzle.md — pgTable definition, column types, drizzle-kit migrations, relations, query patterns, JSONB/array/full-text search, transactionsseed-data.md — Prisma/Drizzle seed setup, factory pattern with faker.js, idempotent upserts, environment-aware seeding, batch inserts, dependency orderingconnection-pooling.md — Singleton pattern, PgBouncer (transaction/session mode), Neon/Supabase/Vercel serverless drivers, pool sizing, dual connection strings, retry patternstools
Generate Unity raster image assets through Unity MCP: game sprites, item art, backgrounds, UI icons, portraits, concept images, transparent cutouts, image edits, upscales, background removal, and Unity scene or Game View screenshots. Use when a Unity project needs image files imported under Assets or screenshots captured from the editor. Do not use for meshes, audio, animation, materials, gameplay code, UI Toolkit layout, or generic non-Unity image generation.
tools
Create Unity technical solution documents from user requirements, feature ideas, bug goals, specs, or codebase problems. Use when the user asks for a technical approach, architecture, implementation strategy, solution options, feasibility analysis, system design, or "how should we build/fix this" for Unity runtime, Editor, tools, assets, data, UI, WebGL, SDKs, or production pipelines.
tools
Orchestrate Unity Editor via MCP (Model Context Protocol) tools and resources. Use when working with Unity projects through MCP for Unity - creating/modifying GameObjects, editing scripts, managing scenes, running tests, or any Unity Editor automation. Provides best practices, tool schemas, and workflow patterns for effective Unity-MCP integration.
development
Convert a spec document into an implementation TODO list in the same spec folder. U se when the user says goal-todo, todo from spec, generate tasks from spec, turn this spec into todos, create implementation checklist, extract tasks, or asks to read a Docs/Specs design doc and produce what must be implemented. Includes UI/UX review and codebase investigation before writing the checklist. Do not use for implementing the tasks, creating new goal files, writing test cases, or verifying completed work.