Migrate from Prisma 5 to Prisma 6 handling breaking changes including Buffer to Uint8Array, implicit m-n PK changes, NotFoundError to P2025, and reserved keywords. Use when upgrading Prisma, encountering Prisma 6 type errors, or migrating legacy code.
Migrates Prisma 5 to 6 by fixing breaking changes: Buffer→Uint8Array, implicit m-n PKs, NotFoundError→P2025, and reserved keywords. Use when upgrading Prisma or encountering Prisma 6 type errors.
/plugin marketplace add djankies/claude-configs/plugin install prisma-6@claude-configsThis skill is limited to using the following tools:
references/breaking-changes.mdreferences/migration-checklist.mdreferences/migration-examples.mdreferences/troubleshooting.mdThis skill guides you through upgrading from Prisma 5 to Prisma 6, handling all breaking changes systematically to prevent runtime failures and type errors.
async, await, using are now reserved model/field namesAttempting to use Prisma 6 without these updates causes type errors, runtime failures, and migration issues. </overview>
<workflow> ## Migration WorkflowPhase 1: Pre-Migration Assessment
Identify all Bytes fields in schema
@db.ByteA, Bytes field typesFind implicit many-to-many relationships
@relation without relationNameLocate NotFoundError usage
NotFoundError imports and usageCheck for reserved keywords
async, await, usingPhase 2: Schema Migration
Update reserved keywords in schema
Generate migration for implicit m-n changes
npx prisma migrate dev --name v6-implicit-mn-pksPhase 3: Code Migration
Update Buffer → Uint8Array conversions
Buffer.from() with TextEncoder.toString() with TextDecoderUpdate NotFoundError handling
isPrismaClientKnownRequestError type guardTest all changes
Phase 4: Validation
Run TypeScript compiler
Run database migrations
Runtime testing
Breaking Changes Summary:
| Change | Before | After |
|---|---|---|
| Buffer API | Buffer.from(), .toString() | TextEncoder, TextDecoder |
| Error Handling | error instanceof NotFoundError | error.code === 'P2025' |
| Implicit m-n PK | Auto-increment id | Compound PK (A, B) |
| Reserved Words | async, await, using allowed | Must use @map() |
Migration Command:
npx prisma migrate dev --name v6-upgrade
Validation Commands:
npx tsc --noEmit
npx prisma migrate status
npm test
<constraints>
## Migration Guidelines
MUST:
SHOULD:
@map() when renaming reserved keywordsNEVER:
async, await, using as model/field names without @map()
</constraints>
After completing migration:
TypeScript Compilation:
npx tsc --noEmitDatabase Migration Status:
npx prisma migrate statusnpx prisma migrate deployRuntime Testing:
Performance Check:
Rollback Readiness:
For detailed migration guides and examples:
references/breaking-changes.md for complete API migration patterns, SQL examples, and edge casesreferences/migration-examples.md for real-world migration scenarios with before/after codereferences/migration-checklist.md for step-by-step migration tasksreferences/troubleshooting.md for common migration issues and solutionsFor framework-specific migration patterns:
For error handling patterns:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.