prisma-expert

Prisma ORM expert for schema design, migrations, query optimization, relations modeling, and database operations. Use PROACTIVELY for Prisma schema issues, migration problems, query performance, relation design, or database connection issues.

Author

Install

Hot:1

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-prisma-expert&locale=en&source=copy

Prisma Expert - Prisma ORM Expert Assistant

Skill Overview


Prisma Expert is an expert assistant focused on Prisma ORM, providing end-to-end support for schema design, migration management, query optimization, relationship modeling, and database operations.

Use Cases

1. Schema Design & Relationship Modeling


When you need to design or optimize your Prisma schema, including defining model relationships (one-to-one, one-to-many, many-to-many), adding indexes, configuring cascading behavior, or resolving runtime errors caused by incorrect relationship definitions.

2. Migration Issues & Deployment


Handle various problems during the Prisma migration process, such as migration conflicts, failed rollbacks, production deployments, and migration file management when collaborating with multiple people.

3. Query Performance Optimization


Fix N+1 query problems, optimize slow queries, configure connection pools, manage database connections in Serverless environments, and implement efficient transaction handling.

Core Features

1. Progressive Issue Fixing


Provide a three-tier fix strategy: minimal → better → complete. Choose the appropriate level of resolution depth based on your needs, from quickly applying a minimal viable fix to full architecture optimization.

2. Diagnostics Commands & Best Practices


Includes built-in diagnostic commands to quickly locate issues, along with Prisma official best-practice guidance, covering schema conventions, query patterns, and safe migration workflows.

3. Multi-Database Support


Covers Prisma usage scenarios for major databases such as PostgreSQL, MySQL, and SQLite, and provides targeted optimization recommendations.

FAQ

How do I rollback when a Prisma migration fails?


If a migration fails in a development environment, you can reset the database using npx prisma migrate reset. In production, if the migration has been partially applied, use npx prisma migrate resolve --rolled-back "migration_name" to mark the migration status. Remember: never use migrate dev in production.

How does Prisma solve the N+1 query problem?


Use include to preload related data, or use select to query only the fields you need. For complex aggregation queries, consider using $queryRaw to execute raw SQL. The key is to identify relationship dependencies before querying and avoid executing queries inside loops.

What should I do if Prisma schema relationship definition throws an error?


Make sure the @relation directive is configured correctly with the fields and references parameters, and explicitly name relationships to avoid ambiguity. Check that the foreign key field type matches the referenced primary key type, and define appropriate onDelete and onUpdate cascading behaviors.

How do I deploy migrations in a production environment?


Production must use npx prisma migrate deploy instead of migrate dev. Before deploying, validate the migration scripts in a testing environment to ensure backward compatibility and minimize the risk of data loss. It’s recommended to prepare rollback strategies for critical migrations.