branded-types
Branded Types
What & Why
TypeScript uses structural typing — two types with the same shape are interchangeable. This means UserId and PostId (both string) can be silently swapped, causing bugs:
type UserId = string
type PostId = string
function getUser(id: UserId) { /* ... */ }
const postId: PostId = "post-123"
getUser(postId) // No error! Both are just `string`
Branded types add a compile-time-only marker that makes structurally identical types incompatible. Zero runtime overhead — brands are erased during compilation.
Core Pattern (Recommended)
More from iaskshahram/skills
ts-rules-iaskshahram
Personal TypeScript and development preferences — package managers, tech stack defaults, command policies, and code style rules. Apply when working in any TypeScript/JavaScript project to enforce these conventions.
6uncodixfy
Prevents generic AI/Codex UI patterns when generating frontend code. Use this skill whenever generating HTML, CSS, React, Vue, Svelte, or any frontend UI code to enforce clean, human-designed aesthetics inspired by Linear, Raycast, Stripe, and GitHub instead of typical AI-generated UI.
4impeccable
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
3generate-dockerfile-iaskshahram
Generate production-ready, secure, multi-stage Dockerfile and .dockerignore for any project
3