What problem does it solve?
This Skill provides a quick-reference guide for Quantum Skincare's Prisma-based data-access layer, helping teams design robust schemas, implement DAO patterns, enforce UUID primary keys, apply RBAC with PostgreSQL, manage migrations, and write type-safe queries. It reduces complexity and mental load when building or evolving database access layers.
Core Features & Use Cases
- Type-safe DB Operations: Enforces UUID primary keys, timestamp fields, and safe query patterns across models.
- DAO Patterns & Exports: Encourages encapsulated data access with clear public APIs.
- Migration Workflows: Standardizes how migrations are created, applied, and tested.
- RBAC & Security: Guides role-based access controls and secure data access practices.
- Testing Strategies: Provides approaches for unit tests and integration tests for DAOs.
Quick Start
- Add a new model to
prisma/schema.prisma and ensure UUID primary keys with @id @default(uuid()) @db.Uuid.
- Implement a DAO in
src/lib/dao/ and export it via src/index.ts.
- Run
npx prisma migrate dev --name <descriptive_name> and npx prisma generate.
- Write unit tests for DAO functions and ensure soft-delete handling where applicable.