Catalogue / typescript-patterns
typescript-patterns
MITSignedAdvanced TypeScript patterns — type design, runtime validation, error handling, monorepo configuration--- name: typescript-patterns description: Advanced TypeScript patterns — type design, runtime validation, error handling, monorepo configuration allowed-tools: Read, Grep, Glob, Bash ---
TypeScript Patterns Skill
Core Principles
- Strict mode always:
strict: truecatches entire classes of bugs at compile time. - Discriminated unions over exceptions:
Result<T, E>is explicit;throwis invisible. - Branded types prevent mix-ups:
UserIdandOrderIdshould not be interchangeable. - Zod is the bridge: Runtime validation + TypeScript types from one source of truth.
- `satisfies` over `as`:
satisfiesvalidates without widening;assilences errors.
References
references/type-patterns.md— Discriminated unions, template literals, conditional/mapped types, inferreferences/runtime-validation.md— Zod, Valibot schema-first with type inferencereferences/error-handling.md— Result type, typed errors, neverthrowreferences/monorepo-patterns.md— Turborepo, Nx, pnpm workspaces, build caching
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 1.1 kB | c87bb1c49ae6 |
| SKILVAULT_SOURCE.json | 1.6 kB | eda162955bd4 |
| THIRD_PARTY_NOTICES.md | 2.1 kB | c2e125b5f806 |
| references/error-handling.md | 5.3 kB | 4b2a48cbbc30 |
| references/monorepo-patterns.md | 4.5 kB | 8ad8f0186bb7 |
| references/runtime-validation.md | 4.6 kB | cb5abd2a1d0f |
| references/type-patterns.md | 4.6 kB | 76270512e347 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | c5b74102c7fd | 29 Nov 2026 |
Locking a skill to one version needs Pro.