Agent skill
db-enforcer
Guardian of Database Integrity. Architect of High-Performance PostgreSQL & Prisma 7 Systems. Expert in PostgreSQL 18, TypedSQL, and Zero-Trust RLS.
Install this agent skill to your Project
npx add-skill https://github.com/YuniorGlez/gemini-elite-core/tree/main/skills/db-enforcer
SKILL.md
💎 Skill: DB Enforcer (v2.1.0)
Executive Summary
The db-enforcer is the supreme guardian of data integrity and architectural consistency. In 2026, where data is the lifeblood of AI-driven applications, the Sentinel ensures that no "Type Drift" occurs between the TypeScript application layer and the PostgreSQL persistence layer. This skill leverages the latest features of PostgreSQL 18 and Prisma 7 to build databases that are self-validating, ultra-fast, and secure by default.
📋 Table of Contents
- The Synchronization Protocol
- The "Do Not" List (Anti-Patterns)
- PostgreSQL 18 Excellence
- Prisma 7 Elite Patterns
- Zero-Trust Data Security (RLS)
- Migration Safety & Zero-Downtime
- Reference Library
🛠️ The Synchronization Protocol
Every schema modification MUST follow these 4 steps:
- Type-to-DB Verification: When adding an
enumorunionin TS, verify the equivalentCHECKconstraint in SQL. - Migration-First Generation: Generate SQL migrations using
prisma migrate dev --create-onlyBEFORE applying changes. - Naming Alignment: Enforce
snake_casein SQL andcamelCasein TS via explicit mappings (@map,@@map). - Integrity Audit: Run
bun x prisma validateand check for missing indices on relation scalars.
🚫 The "Do Not" List (Anti-Patterns)
| Anti-Pattern | Why it fails in 2026 | Modern Alternative |
|---|---|---|
| Manual SQL execution | Unrecorded changes lead to drift. | Use Numbered Migrations. |
| Exposing raw IDs | Vulnerable to enumeration. | Use Native UUIDv7. |
| Missing CHECK constraints | Invalid data corrupts AI models. | Use Database-level Validation. |
| Foreign Keys in Edge DBs | PlanetScale/Vitess limitations. | Use Prisma Relation Mode. |
select * Queries |
High latency and over-fetching. | Use Explicit Typed Selection. |
🐘 PostgreSQL 18 Excellence
We prioritize native 2026 features for performance:
- UUIDv7: Sequential, globally unique IDs for faster indexing.
- Virtual Columns: Zero-cost calculated fields.
- Temporal Constraints: Range-based uniqueness for scheduling.
- AIO Subsystem: Faster reads for massive datasets.
💎 Prisma 7 Elite Patterns
- TypedSQL: High-performance, type-safe raw SQL integration.
- TypeScript Engine: Native WASM execution for Edge compatibility.
- Prisma Extensions: Clean orchestration of soft deletes and audit logs.
- Relation Emulation: Integrity in FK-less environments.
🔒 Zero-Trust Data Security (RLS)
Every table MUST be protected by Row-Level Security.
- Standard:
auth.uid() = user_idfor personal data. - Advanced:
EXISTSchecks for team and project permissions. - CLS: Use PostgreSQL Views to hide sensitive columns from public APIs.
📖 Reference Library
Detailed deep-dives into Database Integrity:
- PostgreSQL 18 Integrity: Advanced constraints and UUIDv7.
- Prisma 7 Architecture: TypedSQL and Edge-first patterns.
- Migration Safety: Zero-downtime deployment rules.
- RLS & Security: Building a zero-trust database.
Updated: January 22, 2026 - 18:10
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
filesystem-context
Uso del sistema de archivos como extensión de la ventana de contexto, persistencia de planes, comunicación entre sub-agentes y carga dinámica de habilidades.
git-flow
Senior Workflow Architect. Master of Trunk-Based Development, Stacked Changes, and 2026 Branching Strategies.
track-master
Senior Progress Analyst & Conductor Strategist. Expert in Predictive Project Tracking and Agentic Milestone Management for 2026.
artifact-janitor
Senior Build Cleanup & System Optimization Specialist. Expert in reclaiming disk space and resolving build corruption in 2026 ecosystems.
openapi-pro
Senior API Architect & Integration Engineer for 2026. Specialized in Type-Safe API contracts using OpenAPI 3.1, Zod-First schema derivation, and automated TypeScript client generation. Expert in bridging the gap between Hono backends and Next.js 16 frontends using `openapi-fetch`, `orval`, and unified monorepo type-sharing.
seo-pro
Senior SEO Architect & Content Strategist. Expert in SGE Optimization, E-E-A-T Standards, and Semantic Entity SEO for 2026.
Didn't find tool you were looking for?