cross-package-types

Derive and propagate Prisma schema types through Zod, tRPC, and client interfaces.

1|6|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/bitovi/carton-case-management --skill cross-package-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cross-package-types
Source: https://github.com/bitovi/carton-case-management/tree/main/.github/skills/cross-package-types
Command: npx skills add https://github.com/bitovi/carton-case-management --skill cross-package-types

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manage TypeScript types across a three-package monorepo by deriving and propagating Prisma-generated types from @carton/shared to @carton/server and to @carton/client, avoiding duplications and drift.

Core Features & Use Cases

  • Unified type derivation: derive API schemas from Prisma models in shared, then expose type-safe interfaces to server and client without manual synchronization.
  • Derivation patterns: apply .pick(), .omit(), and .extend() to shape input and output schemas for create, update, and query operations.
  • Use Case: when adding a Prisma model or changing schema, regenerate types and ensure client components stay in sync with server APIs.

Quick Start

Update the Prisma schema, run the type generation step, and verify that derived API schemas flow correctly to server and client.

Frequently Asked Questions about cross-package-types

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

FAQPage Schema
How do I enforce end-to-end TypeScript type flow across a Prisma, Zod, and tRPC monorepo?

Enforce end-to-end TypeScript type flow by deriving Zod schemas and tRPC procedures directly from Prisma models, propagating them through shared packages to client interfaces to maintain a single source of truth.

What's the best way to prevent type drift and circular dependencies between server and client packages?

Prevent type drift and circular dependencies by isolating server-side Prisma runtime while exporting only browser-safe derived types to the client, ensuring consistent type inference across the stack.

How do I shape input and output schemas for tRPC procedures derived from a Prisma model?

Shape input and output schemas for tRPC procedures by applying Zod derivation patterns like `.pick()`, `.omit()`, and `.extend()` to your Prisma models for create, update, and query operations.

Do I need to manually synchronize types when adding a new Prisma model in a monorepo?

You do not need to manually synchronize types when adding a Prisma model; simply update the schema, run the type generation step, and verify that derived API schemas flow correctly to server and client.

Can I keep Prisma runtime isolated on the server while exposing type-safe interfaces to the client?

You can keep Prisma runtime isolated on the server by deriving browser-safe client exports from shared schemas, ensuring the client receives only type inference without server-side runtime dependencies.

Why does my monorepo experience type duplication across shared, server, and client packages?

Monorepo type duplication occurs when types are manually defined per package; deriving and propagating types directly from the Prisma schema through shared packages eliminates this drift.