<< All versions

Skill v1.0.1

currentAutomated scan100/100
dannykkh/skill-olympus/database-schema-designer

+12 new

──Details
PublishedOctober 28, 2026 at 01:40 AM
Content Hashsha256:653c3016d5a4c6ee...
Git SHA71f481b8cf17
Bump Typepatch
Compare with v1.0.0
──Files
Files (1 file, 8.7 KB)
SKILL.md8.7 KBactive
SKILL.md · 223 lines · 8.7 KB

name: database-schema-designer description: | Design production-ready database schemas for SQL and NoSQL databases. Use when user asks to "design schema", "create tables", "database design", "ERD", "data model", or when starting a project that needs database structure. Triggers on "normalize", "migration plan", "index strategy", "테이블 설계". license: MIT metadata: version: "1.0.1"


Database Schema Designer

Design production-ready database schemas with best practices built-in.


Quick Start

Just describe your data model:

design a schema for an e-commerce platform with users, products, orders

You'll get a complete SQL schema like:

sql
CREATE TABLE users (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE orders (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id),
total DECIMAL(10,2) NOT NULL
);
-- 인덱스는 CREATE TABLE 밖에 분리 (MySQL/PostgreSQL 모두 동작)
CREATE INDEX idx_orders_user ON orders(user_id);
위 예시는 MySQL 기준입니다(AUTO_INCREMENT). PostgreSQL은 PK를 BIGINT GENERATED ALWAYS AS IDENTITY(또는 BIGSERIAL)로 쓰세요. 인덱스는 CREATE INDEX로 분리하면 양쪽에서 동작합니다(인라인 INDEX ...는 MySQL/MariaDB 전용 → Postgres 문법 에러). 이 스킬은 DB-First라 대상 DB에 맞춰 설계가 달라집니다.

What to include in your request:

  • Entities (users, products, orders)
  • Key relationships (users have orders, orders have items)
  • Scale hints (high-traffic, millions of records)
  • Database preference (SQL/NoSQL) - defaults to SQL if not specified

Triggers

TriggerExample
design schema"design a schema for user authentication"
database design"database design for multi-tenant SaaS"
create tables"create tables for a blog system"
schema for"schema for inventory management"
model data"model data for real-time analytics"
I need a database"I need a database for tracking orders"
design NoSQL"design NoSQL schema for product catalog"

Key Terms

TermDefinition
NormalizationOrganizing data to reduce redundancy (1NF → 2NF → 3NF)
3NFThird Normal Form - no transitive dependencies between columns
OLTPOnline Transaction Processing - write-heavy, needs normalization
OLAPOnline Analytical Processing - read-heavy, benefits from denormalization
Foreign Key (FK)Column that references another table's primary key
IndexData structure that speeds up queries (at cost of slower writes)
Access PatternHow your app reads/writes data (queries, joins, filters)
DenormalizationIntentionally duplicating data to speed up reads

Quick Reference

TaskApproachKey Consideration
New schemaNormalize to 3NF firstDomain modeling over UI
SQL vs NoSQLAccess patterns decideRead/write ratio matters
Primary keysINT or UUIDUUID for distributed systems
Foreign keysAlways constrainON DELETE strategy critical
IndexesFKs + WHERE columnsColumn order matters
MigrationsAlways reversibleBackward compatible first

Process Overview

DB-First: 대상 DB를 먼저 정하고 그 DB의 강점으로 구조를 정한다(PostgreSQL JSONB·RLS, MySQL 정규화, MongoDB 임베딩). DB 감지 순서, DB별 설계 매트릭스, 엔티티 추출·관계 판별, Audit 컬럼, ERD 표기, db-schema.md 출력 형식은 정본인 젭마인 skills/zephermine/references/schema-design-guide.md를 따른다(젭마인은 활성 스킬이라 활성 스킬 루트에서 읽힌다). 이 스킬에는 사본을 두지 않는다.

Your Data Requirements
|
v
+-----------------------------------------------------+
| Phase 1: ANALYSIS |
| * Identify entities and relationships |
| * Determine access patterns (read vs write heavy) |
| * Choose SQL or NoSQL based on requirements |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| Phase 2: DESIGN |
| * Normalize to 3NF (SQL) or embed/reference (NoSQL) |
| * Define primary keys and foreign keys |
| * Choose appropriate data types |
| * Add constraints (UNIQUE, CHECK, NOT NULL) |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| Phase 3: OPTIMIZE |
| * Plan indexing strategy |
| * Consider denormalization for read-heavy queries |
| * Add timestamps (created_at, updated_at) |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| Phase 4: MIGRATE |
| * Generate migration scripts (up + down) |
| * Ensure backward compatibility |
| * Plan zero-downtime deployment |
+-----------------------------------------------------+
|
v
Production-Ready Schema

Commands

CommandWhen to UseAction
design schema for {domain}Starting freshFull schema generation
normalize {table}Fixing existing tableApply normalization rules
add indexes for {table}Performance issuesGenerate index strategy
migration for {change}Schema evolutionCreate reversible migration
review schemaCode reviewAudit existing schema

Workflow: Start with design schema → iterate with normalize → optimize with add indexes → evolve with migration


Core Principles

PrincipleWHYImplementation
Model the DomainUI changes, domain doesn'tEntity names reflect business concepts
Data Integrity FirstCorruption is costly to fixConstraints at database level
Optimize for Access PatternCan't optimize for bothOLTP: normalized, OLAP: denormalized
Plan for ScaleRetrofitting is painfulIndex strategy + partitioning plan

Anti-Patterns

AvoidWhyInstead
VARCHAR(255) everywhereWastes storage, hides intentSize appropriately per field
FLOAT for moneyRounding errorsDECIMAL(10,2)
Missing FK constraintsOrphaned dataAlways define foreign keys
No indexes on FKsSlow JOINsIndex every foreign key
Storing dates as stringsCan't compare/sortDATE, TIMESTAMP types
SELECT * in queriesFetches unnecessary dataExplicit column lists
Non-reversible migrationsCan't rollbackAlways write DOWN migration
Adding NOT NULL without defaultBreaks existing rowsAdd nullable, backfill, then constrain

Verification Checklist

After designing a schema:

  • [ ] Every table has a primary key
  • [ ] All relationships have foreign key constraints
  • [ ] ON DELETE strategy defined for each FK
  • [ ] Indexes exist on all foreign keys
  • [ ] Indexes exist on frequently queried columns
  • [ ] Appropriate data types (DECIMAL for money, etc.)
  • [ ] NOT NULL on required fields
  • [ ] UNIQUE constraints where needed
  • [ ] CHECK constraints for validation
  • [ ] created_at and updated_at timestamps
  • [ ] Migration scripts are reversible
  • [ ] Tested on staging with production data

Deep Dives (References)

주제파일
DB-First Design (DB별 설계·출력 형식) — 정본은 젭마인skills/zephermine/references/schema-design-guide.md
Normalization (SQL 정규화)references/normalization.md
Data Types (타입 선택)references/data-types.md
Indexing Strategy (인덱스 전략)references/indexing-strategy.md
Constraints (제약 조건)references/constraints.md
Relationship Patterns (관계 패턴)references/relationship-patterns.md
Migrations (마이그레이션)references/migrations.md
NoSQL Design (MongoDB)references/nosql-mongodb.md
Performance Optimizationreferences/performance-optimization.md

Related Resources

  • DB별 구현: 네이티브 작업자 + 프로젝트 DB 버전·schema·migration 도구·테스트
  • Supabase Best Practices: skills/supabase-postgres-best-practices/SKILL.md
← v1.0.0All versions