- Define models in `schema.prisma`. Use `prisma migrate dev` for development, `prisma migrate deploy` for production.
- Use Prisma Client for all database queries — never write raw SQL unless absolutely necessary.
- Use `prisma.$transaction()` for multi-step operations that must succeed or fail atomically — prevents partial data corruption.
- Use `include` and `select` to control query shape — avoid over-fetching related data.
- Use transactions (`prisma.$transaction`) for multi-step operations that must be atomic.
- Use `@unique`, `@index`, and `@@index` for query performance. Add indexes for frequently filtered columns.
- Use `prisma generate` after schema changes to update the TypeScript client types.