prisma-relations-mapping

Map PascalCase Prisma relations to camelCase in API routes.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/vperreard/Mathildanesth --skill prisma-relations-mapping
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-relations-mapping
Source: https://github.com/vperreard/Mathildanesth/tree/main/.claude/skills/prisma-relations-mapping
Command: npx skills add https://github.com/vperreard/Mathildanesth --skill prisma-relations-mapping

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prisma relation names become PascalCase after migration, while frontend code and API contracts expect camelCase, leading to runtime errors and data-mapping gaps.

Core Features & Use Cases

  • Complete PascalCase-to-camelCase mapping guidance for all models (post-migration, 121 models).
  • Guidelines for include, select, and nested relation mappings in API routes to prevent undefined or 500 errors.
  • Reusable mapping patterns and templates to align backend Prisma results with frontend expectations.

Quick Start

Review the mapping tables and implement API-level mappers to convert PascalCase relations to camelCase before sending responses to clients.

Frequently Asked Questions about prisma-relations-mapping

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Prisma API return undefined for nested relations after a PascalCase migration?

Prisma migrations convert relation names to PascalCase, but frontend code expects camelCase, causing data-mapping gaps and runtime errors. You need to apply PascalCase-to-camelCase mapping in the API layer before sending responses to clients.

How do I map PascalCase Prisma relations to camelCase in API routes?

Implement API-level mappers that convert PascalCase relations to camelCase before sending responses. This includes mapping rules for include, select, and nested relation mappings to prevent undefined or 500 errors.

What is the best way to handle Prisma relation name changes for frontend compatibility?

The best way is enforcing mapping in the API layer with robust error handling. Use reusable mapping patterns and templates to align backend Prisma results with frontend expectations for consistent key naming.

Can I use API-level mapping rules for Prisma includes and counts across multiple modules?

Yes, consistent mapping rules apply across planning, site, personnel, and leave modules covering 121 models. The rules handle includes, counts, and nested relations to prevent runtime errors and maintain frontend compatibility.

Does Prisma migration break snake_case collections and camelCase frontend keys?

Yes, post-migration Prisma produces PascalCase relation names that break snake_case collections and frontend camelCase expectations. Mapping rules enforce snake_case for collections and frontend-friendly key renaming in the API layer.

Prisma PascalCase migration not working with frontend API contracts, how do I fix it?

Fix it by applying PascalCase-to-camelCase mapping in your API routes with robust error handling. Use reusable mapping templates to ensure backend Prisma results align with frontend API contracts and prevent 500 errors.