원클릭으로
database-standards
PostgreSQL database standards for migrations, seeds, and schema management.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
PostgreSQL database standards for migrations, seeds, and schema management.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Orchestrates SDD project initialization — version detection, environment verification, scaffolding, and git setup.
Manage project settings in sdd/sdd-settings.yaml including component settings that drive scaffolding.
Single gateway for all core↔tech-pack interactions. Reads manifests, resolves paths, loads skills/agents, routes commands.
Manage tasks and plans using the .tasks/ directory.
Standards for authoring SDD plugin agents — frontmatter, self-containment, skill references, and no-user-interaction rules.
Standards for authoring SDD plugin commands — frontmatter, user interaction, skill/agent invocation, CLI integration, and output formatting.
| name | database-standards |
| description | PostgreSQL database standards for migrations, seeds, and schema management. |
Standards for PostgreSQL database components with migrations, seeds, and schema management.
Database components manage schema evolution and seed data:
components/database[-{name}]/
├── package.json # Component package metadata
├── migrations/ # Schema migrations (numbered)
│ ├── 001_initial_schema.sql
│ ├── 002_add_users_table.sql
│ └── 003_add_indexes.sql
└── seeds/ # Seed data (numbered)
├── 001_lookup_data.sql
└── 002_test_users.sql
Database components require connection configuration from components/config/. The database-scaffolding skill generates the initial database structure including a minimal config schema with host, port, database, user, and password fields.
migrations/
├── 001_initial_schema.sql
├── 002_add_users_table.sql
├── 003_add_orders_table.sql
└── 004_add_indexes.sql
Rules:
001_, 002_, etc..sql extension-- migrations/002_add_users_table.sql
BEGIN;
CREATE TABLE IF NOT EXISTS users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) NOT NULL UNIQUE,
name VARCHAR(255),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
COMMIT;
Required Patterns:
| Pattern | Why |
|---|---|
BEGIN/COMMIT | Atomic transaction |
IF NOT EXISTS | Idempotent (safe to re-run) |
TIMESTAMPTZ | Timezone-aware timestamps |
gen_random_uuid() | PostgreSQL native UUIDs |
| Type | When | Example |
|---|---|---|
| Schema creation | New tables | CREATE TABLE IF NOT EXISTS |
| Schema modification | Add/modify columns | ALTER TABLE ... ADD COLUMN IF NOT EXISTS |
| Index creation | Performance | CREATE INDEX IF NOT EXISTS |
| Data migration | Transform existing data | UPDATE ... WHERE ... |
| Constraint addition | Add validation | ALTER TABLE ... ADD CONSTRAINT |
| Type | PostgreSQL Type | Notes |
|---|---|---|
| Primary key | UUID | Use gen_random_uuid() |
| Timestamps | TIMESTAMPTZ | Always timezone-aware |
| Money | NUMERIC(19,4) | Never FLOAT or MONEY |
| Enums | VARCHAR + CHECK | Or PostgreSQL ENUM type |
| JSON | JSONB | Never JSON |
Migrations are forward-only. If you need to undo:
DROP TABLE without careful consideration-- migrations/005_remove_legacy_column.sql
BEGIN;
ALTER TABLE users DROP COLUMN IF EXISTS legacy_field;
COMMIT;
seeds/
├── 001_lookup_data.sql
├── 002_admin_users.sql
└── 003_sample_data.sql
Rules:
-- seeds/001_lookup_data.sql
BEGIN;
INSERT INTO status_types (code, label) VALUES
('pending', 'Pending'),
('active', 'Active'),
('completed', 'Completed')
ON CONFLICT (code) DO NOTHING;
COMMIT;
Required Patterns:
| Pattern | Why |
|---|---|
BEGIN/COMMIT | Atomic transaction |
ON CONFLICT DO NOTHING | Idempotent |
ON CONFLICT DO UPDATE | Upsert when updates needed |
| Category | Purpose | Example |
|---|---|---|
| Lookup data | Reference tables | Status codes, countries |
| Admin data | Initial admin users | System accounts |
| Test data | Development/testing | Sample users, orders |
Seeds run in all environments. For test-only data:
-- seeds/003_test_data.sql
-- Only populate if specific flag table exists
BEGIN;
DO $$
BEGIN
-- Check if we should seed test data
-- This is controlled by a flag in the environment's config
INSERT INTO users (email, name)
SELECT 'test@example.com', 'Test User'
WHERE NOT EXISTS (SELECT 1 FROM users WHERE email = 'test@example.com');
END $$;
COMMIT;
When adding database changes:
BEGIN/COMMITIF NOT EXISTS for idempotency<plugin-root>/fullstack-typescript/system/system-run.sh database migrate <component-name>
<plugin-root>/fullstack-typescript/system/system-run.sh database psql <component-name> # Verify schema
ON CONFLICT for idempotencyThe backend DAL layer must follow backend-standards — it defines CMDO architecture with strict layer separation, including repository patterns for database queries, connection pooling rules, and typed result mapping.
<plugin-root>/fullstack-typescript/system/system-run.sh database setup <component-name> # Deploy PostgreSQL to k8s
<plugin-root>/fullstack-typescript/system/system-run.sh database teardown <component-name> # Remove PostgreSQL from k8s
<plugin-root>/fullstack-typescript/system/system-run.sh database migrate <component-name> # Run all migrations
<plugin-root>/fullstack-typescript/system/system-run.sh database seed <component-name> # Run all seeds
<plugin-root>/fullstack-typescript/system/system-run.sh database reset <component-name> # Full reset: teardown + setup + migrate + seed
<plugin-root>/fullstack-typescript/system/system-run.sh database port-forward <component-name> # Port forward to local
<plugin-root>/fullstack-typescript/system/system-run.sh database psql <component-name> # Open psql shell
When a project has multiple databases:
components/
├── database-orders/ # Orders domain
│ └── migrations/
└── database-analytics/ # Analytics domain
└── migrations/
Each database:
database-orders, database-analytics)Before committing database changes:
BEGIN/COMMITIF NOT EXISTS or IF EXISTS for idempotencyTIMESTAMPTZ for all timestampsUUID for primary keysON CONFLICT for idempotencyDROP TABLE without explicit approvalThis skill defines no input parameters or structured output.
backend-standards — Delegate to this for DAL implementation patterns. Defines CMDO repository layer for database queries, connection pooling, and typed result mapping.config-standards — Delegate to this for database connection configuration. Defines how host, port, database, user, and password fields are structured in the config component.helm-standards — Delegate to this for Kubernetes deployment of database components. Defines how database secrets and connection strings are injected via Helm values.