branded-types

Official

Create type-safe distinct primitives.

Authorwellcrafted-dev
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill solves the problem of TypeScript's structural typing allowing interchangeable primitive types (like strings or numbers) that should be distinct, preventing accidental misuse of values like user IDs and order IDs.

Core Features & Use Cases

  • Nominal Typing: Creates distinct types from primitives using phantom branding.
  • Type Safety: Prevents mixing up different kinds of IDs, tokens, or other primitives at compile time.
  • Brand Constructor Pattern: Encourages a single source of truth for creating branded types, optionally including runtime validation.
  • Use Case: Define UserId and OrderId as distinct types, ensuring that a function expecting a UserId cannot accidentally receive an OrderId.

Quick Start

Use the branded-types skill to create a new type ProductId that is a string and cannot be confused with other strings.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: branded-types
Download link: https://github.com/wellcrafted-dev/wellcrafted/archive/main.zip#branded-types

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.