db-enforcer

Installation
SKILL.md

DB Enforcer

Overview

Enforces data integrity and architectural consistency between the TypeScript application layer and the PostgreSQL persistence layer. Prevents type drift by ensuring CHECK constraints mirror TypeScript types, migrations are generated before applying changes, and Row-Level Security protects every table.

When to use: Schema design, migration planning, RLS policy authoring, Prisma model mapping, constraint auditing, zero-downtime deployments.

When NOT to use: Application-level business logic, frontend state management, non-PostgreSQL databases. For full RLS auditing, performance tuning, and compliance validation, use the database-security skill instead.

Quick Reference

Pattern API/Tool Key Points
Type-to-DB sync prisma migrate dev --create-only Generate SQL before applying changes
Naming alignment @map / @@map snake_case in SQL, camelCase in TS
Primary keys DEFAULT uuidv7() Sequential, globally unique, fast indexing (PG 18+)
Virtual columns GENERATED ALWAYS AS (...) VIRTUAL Zero disk cost, computed on read (PG 18+)
Temporal uniqueness EXCLUDE USING gist Prevent overlapping ranges natively
Related skills
Installs
31
GitHub Stars
11
First Seen
Feb 24, 2026