prisma-crud Skill
Generate database CRUD operations with Prisma including queries, transactions, and Server Actions.
Overview#
The prisma-crud skill generates production-ready database operations using Prisma ORM, including proper client initialization, common query patterns, and transactional operations.
Usage#
Use the prisma-crud skill to create CRUD operations for a Post model.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Prisma model name |
operations | array | No | Operations: create, read, update, delete, list |
relations | array | No | Related models to include |
softDelete | boolean | No | Enable soft delete pattern |
serverActions | boolean | No | Generate as Server Actions |
Generated Output#
Prisma Client Singleton#
Loading code block...
Create Operation#
Loading code block...
Read Operations#
Loading code block...
Update Operations#
Loading code block...
Delete Operations#
Loading code block...
Transactions#
Loading code block...
Credit Transfer Transaction#
Loading code block...
Server Action Pattern#
Loading code block...
Optimistic Locking#
Loading code block...
Schema Example#
Loading code block...
Features Included#
- Singleton client pattern
- CRUD operations with relations
- Pagination support
- Transaction handling
- Soft delete pattern
- Server Actions integration
- Optimistic locking
Migration Commands#
Loading code block...
Customization Options#
Use the prisma-crud skill with:
- model: "Post"
- operations: ["create", "read", "update", "list"]
- relations: ["author", "comments"]
- softDelete: true
- serverActions: true
Best Practices#
Singleton Pattern#
Always use the singleton pattern to prevent connection exhaustion during development hot reloads.
Select Only What You Need#
Loading code block...
Use Transactions for Related Operations#
Loading code block...
Index Frequently Queried Fields#
Loading code block...
Related Skills#
- api-endpoint - API routes with database
- validation - Input validation before database
- test-suite - Testing database operations