prisma — Claude Code skill: what it does, how to install
Prisma ORM guidelines for schema modeling, type-safe queries, and test isolation. Useful when building a repository layer in Node.js.
npx skills add Mindrally/skills --skill prisma -a claude-codeWhat prisma does
This skill configures coding rules for Prisma ORM. It enforces explicit types without any and keeps functions under 20 lines. Data access is separated from business logic via repositories. Schemas must define relations with decorators like @id and @relation, alongside soft deletes through deletedAt.
The guidelines prioritize performance and strict error handling. Agents must limit fetched fields via select and resolve N+1 query issues using include. Specific exceptions such as PrismaClientKnownRequestError require targeted handling. Without a connection pool, the database will exhaust available connections under load, which is why the skill insists on connection pooling in production.
What it helps with
- design Prisma schemas with soft delete timestamps
- prevent N+1 query overhead using
selectandinclude - catch
PrismaClientKnownRequestErrorand validation failures - isolate integration tests with database transactions
Example prompts for the agent
- Create a Prisma schema for auth accounts with soft deletes and relations
- Implement a user repository using select queries and error handling
- Write isolated tests for Prisma operations using transactions
How to install prisma
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill prisma -a claude-code2Manually: put the files in place
~/.claude/skills/prisma/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/prisma/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill prisma -a codex2Manually: put the files in place
.agents/skills/prisma/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill prisma -a cursor2Manually: put the files in place
.cursor/skills/prisma/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills prisma2Manually: put the files in place
.github/skills/prisma/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill prisma -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path prismaManually: put the files in place
.devin/skills/prisma/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill prisma -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about prisma
How to install prisma in Claude Code?
Run npx skills add Mindrally/skills --skill prisma -a claude-code. The file will be placed in ~/.claude/skills/prisma/SKILL.md.
What does the prisma skill do?
It guides the agent to write structured Prisma code: enforcing repository patterns, strict types without any, and minimal field selection.
How does the skill isolate database tests?
It directs the agent to mock the Prisma client for unit tests and wrap database test runs inside transactions.
Source text
SKILL.md · Apache-2.0
--- name: prisma description: Expert in Prisma ORM with type-safe database operations and schema design metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # 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
© Mindrally · Apache-2.0 · Mindrally/skills