What problem does it solve?
This Skill prevents accidental mixing of structurally identical TypeScript values such as UserId, PostId, Email, and unit-specific numbers by adding compile-time nominal safety with zero runtime overhead.
Core Features & Use Cases
- Defines a recommended branded type pattern using a shared unique symbol for clean, reusable type aliases.
- Teaches validated constructor functions so unsafe casts stay confined to one place.
- Covers practical use cases including type-safe IDs, validated strings, unit values, tokens, and integrations with tools like Zod, Drizzle, and Prisma.
- Helps developers avoid common mistakes such as runtime brand checks, duplicate brand names, and over-branding.
- Supports advanced patterns like composing multiple brands and unwrapping branded base types.
Quick Start
Ask the assistant to convert plain TypeScript string and number aliases into branded types with validated constructors and safe usage guidance.