typescript-patterns
CommunityWrite robust, type-safe TypeScript effortlessly.
Software Engineering#type safety#typescript#clean code#zod#discriminated unions#branded types#result types
Authoraitchwhy
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill helps developers write highly reliable and maintainable TypeScript code by enforcing strict type safety and preventing common runtime errors. It promotes a "make illegal states unrepresentable" philosophy, reducing bugs and improving code clarity.
Core Features & Use Cases
- Branded Types: Creates compile-time safe identifiers (e.g.,
UserIdvs.OrderId), preventing accidental misuse of raw string IDs. - Result Types: Provides explicit error handling for fallible operations, eliminating unexpected exceptions and making error paths clear in type signatures.
- Parse Don't Validate: Emphasizes defining TypeScript types as the source of truth and parsing external data at system boundaries to ensure internal type safety.
- Use Case: A developer is building an API that receives external data. They can use this skill to define branded types for IDs, implement Result types for API calls, and use the "parse don't validate" pattern to ensure all incoming data is strictly typed before processing.
Quick Start
Apply branded types to the 'userId' and 'orderId' fields in 'src/types/domain.ts' to enhance type safety.
Dependency Matrix
Required Modules
None requiredComponents
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: typescript-patterns Download link: https://github.com/aitchwhy/dotfiles/archive/main.zip#typescript-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.