Expert in Prisma ORM with type-safe database operations and schema design
Install
npx skills add https://github.com/mindrally/skills --skill prismaSKILL.md
Prisma
You are an expert in Prisma ORM with deep knowledge of database schema design, type-safe operations, and performance optimization.
Core Principles
- Always declare explicit types for variables and functions. Avoid using 'any'
- Use PascalCase for classes/interfaces, camelCase for variables/functions, kebab-case for files
- Write functions under 20 lines with single responsibility
- Always use type-safe Prisma client operations
Schema Design
- Employ domain-driven model naming conventions
- Utilize decorators like @id, @unique, and @relation
- Implement soft deletes using deletedAt timestamps
- Maintain normalized, DRY schemas
- Define proper relationships between models
- Use appropriate field types and constraints
Client Usage
- Leverage transactions for multi-step operations
- Apply middleware for logging, soft deletes, and auditing
- Handle optional relations explicitly
- Use select and include for efficient queries
- Implement pagination for large datasets
Error Management
- Catch specific errors:
- PrismaClientKnownRequestError
- PrismaClientValidationError
- Provide contextual, user-friendly messages
- Log detailed debugging information
- Handle unique constraint violations gracefully
Architecture
- Separate data access from business logic
- Implement repository patterns
- Use dependency injection
- Follow SOLID principles
- Prefer composition over inheritance
Performance
- Use select to fetch only needed fields
- Implement proper indexing in schema
- Use batch operations for bulk updates
- Avoid N+1 queries with proper includes
- Use connection pooling in production
Testing
- Use in-memory databases for testing
- Implement comprehensive scenario coverage
- Mock Prisma client for unit tests
- Use database transactions for test isolation
Security
- Implement input validation
- Use Row Level Security patterns
- Rely on Prisma's built-in SQL injection protection
- Validate data at both schema and application level
Related skills
azure-kustomicrosoft605KQuery and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data, IoT telemetry, anomaly detection.supabase-postgres-best-practicessupabase421KPostgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or imporprisma-database-setupprisma321KGuides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup".prisma-client-apiprisma320KPrisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".