- Home
- Skills
- Yuniorglez
- Gemini Elite Core
- Db Enforcer
db-enforcer_skill
- Python
7
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill yuniorglez/gemini-elite-core --skill db-enforcer- SKILL.md3.8 KB
Overview
This skill is the DB Enforcer: a guardian of database integrity and high-performance PostgreSQL + Prisma 7 architectures. It enforces type alignment, migration discipline, and zero-trust Row-Level Security to prevent type drift and protect AI-driven systems. The goal is resilient, audit-friendly schemas that scale with modern PostgreSQL 18 features.
How this skill works
DB Enforcer inspects TypeScript schema and Prisma models to verify parity with PostgreSQL constraints and indices. It enforces a four-step synchronization protocol: type-to-DB verification, migration-first generation, naming alignment, and integrity audits. It also recommends PostgreSQL 18 features (UUIDv7, virtual columns, temporal constraints) and Prisma 7 patterns (TypedSQL, relation emulation) to optimize performance and safety.
When to use it
- When you must prevent runtime type drift between TS application types and persisted data.
- During review or CI to validate generated migrations before they are applied.
- When adopting PostgreSQL 18 features like UUIDv7 or virtual columns safely.
- When building zero-trust databases that require Row-Level Security by default.
- When migrating or scaling Prisma-backed apps and you need zero-downtime guarantees.
Best practices
- Always generate migrations first (prisma migrate --create-only) and review SQL before applying.
- Map naming: use snake_case in SQL and camelCase in TypeScript with explicit @map/@@map annotations.
- Express enums and unions as SQL CHECK constraints so the DB enforces type invariants.
- Protect every table with RLS; prefer auth.uid() checks and EXISTS-based permission clauses for teams/projects.
- Use typed selection instead of select * and add missing indices for relation scalar fields.
Example use cases
- CI pipeline validation: fail builds on schema drift or missing constraints before deploy.
- Hardening a user table with RLS and UUIDv7 to prevent ID enumeration and enforce per-user access.
- Adding virtual columns for computed values to offload runtime calculations to the DB.
- Safe Prisma upgrades: validate TypedSQL raw queries and migration SQL before switching runtime.
- Implementing temporal uniqueness for scheduling systems using PostgreSQL 18 range constraints.
FAQ
It verifies TypeScript enums/unions against SQL CHECK constraints, requires migration-first workflows, and runs integrity audits to detect missing indices or mismatched mappings.
Do I have to enable RLS on every table?
Yes: the default stance is zero-trust. Enable RLS and implement clear policy functions (auth.uid(), EXISTS checks) to minimize accidental data exposure.