mcpField
P
prisma-development

prisma-development

github.com/mindrallyData & databases287704 installsUpdated 3w ago
Repository

About prisma-development

A development guide for TypeScript and Prisma ORM, with practices for type safety, schema design, client usage, and migrations.

Key features

  1. 01TypeScript typing and naming conventions
  2. 02Prisma schema and relation design
  3. 03Type-safe client operations
  4. 04Transactions, errors, and middleware
  5. 05Migration and testing practices

Use cases

  1. 01Design Prisma data models
  2. 02Write type-safe database operations
  3. 03Handle transactions and database errors
  4. 04Plan and test database migrations

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mindrally/skills --skill prisma-development

After installing, type/prisma-developmentin Claude Code to confirm it loaded.

Details

From the project README

Prisma ORM Development

You are an expert in Prisma ORM development with TypeScript.

TypeScript Fundamentals

Basic Principles
  • Always declare explicit types for variables and functions
  • Avoid using 'any'
  • Leverage JSDoc for public APIs
  • Maintain single exports per file
  • Prioritize self-documenting code
Naming Conventions
  • PascalCase for classes/interfaces
  • camelCase for variables and methods
  • kebab-case for files/directories
  • UPPERCASE for constants
  • Verb-based boolean names (isLoading, hasError, canDelete)

Function Design

  • Aim for less than 20 lines of code per function
  • Single responsibility per function
  • Implement early returns
  • Extract complex logic into separate functions
  • Leverage functional patterns (map, filter, reduce)
  • Use object parameters for multiple arguments

Data & Error Handling

  • Encapsulate data in composite types with immutability preference
  • Use readonly and as const appropriately
  • Validate at boundaries
  • Employ specific, descriptive error types with contextual messaging

Prisma-Specific Practices

Schema Design
  • Domain-driven naming for models and fields
  • Explicit relations using @relation
  • Normalized structures where appropriate
  • Soft deletes via deletedAt field
  • Native type decorators for database-specific types
Client Usage
  • Always use type-safe Prisma client operations
  • Use transactions for complex flows
  • Implement middleware for logging, soft deletes, and auditing
  • Use select and include judiciously to avoid over-fetching
Migrations
  • Create descriptive migrations with clear naming
  • Never modify existing migrations
  • Ensure idempotency for all migrations
  • Test migrations on staging before production
Error Handling
  • Catch PrismaClientKnownRequestError for constraint violations
  • Handle PrismaClientUnknownRequestError for unexpected database errors
  • Validate with PrismaClientValidationError for schema mismatches

Quality Standards

  • Avoid N+1 queries through proper eager loading
  • Test with in-memory databases for speed
  • Mock Prisma client for unit test isolation
  • Never expose raw Prisma clients in APIs
  • Validate all user inputs before database operations
  • Follow SOLID principles with composition over inheritance

Comments

Markdown supported