
Typescript Best Practices
Type-first TypeScript idioms covering discriminated unions, branded types, Zod runtime validation, and type-fest utilities.
- skills.sh installs
- 2.9K
- GitHub stars
- 49
- last updated
- Jul 14, 2026
Own this skill? Claim it
What it does
- Covers language-specific TypeScript and JavaScript idioms for
.ts,.tsx,.jsfiles, andtsconfig.json - Includes patterns for discriminated unions, branded primitives, const assertions, and exhaustive
neverswitches - Enforces schema-first validation with Zod, using
parseat trust boundaries andsafeParsefor user input - Designed for React work alongside
react-best-practices, which covers component, hook, and effect patterns
Install
$ npx -y skills add alleneubank/claude-code --skill typescript-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
TypeScript Best Practices
Follows type-first, functional, and error handling patterns from CLAUDE.md. This skill covers language-specific idioms only.
Pair with React Best Practices
When working with React components (.tsx, .jsx files or @react imports), always load react-best-practices alongside this skill. This skill covers TypeScript fundamentals; React-specific patterns (effects, hooks, refs, component design) are in the dedicated React skill.
Make Illegal States Unrepresentable
Use the type system to prevent invalid states at compile time.
Discriminated unions for mutually exclusive states:
// Good: only valid combinations possible
type RequestState<T> =
| { status: 'idle' }
| { status: 'loading' }
| { status: 'success'; data: T }
| { status: 'error'; error: Error };
// Bad: allows invalid combinations like { loading: true, error: Error }
type RequestState<T> = {
loading: boolean;
data?: T;
error?: Error;
};
Branded types for domain primitives:
type UserId = string & { readonly __brand: 'UserId' };
type OrderId = string & { readonly __brand: 'OrderId' };
Details
- Repository
- github.com/alleneubank/claude-code
- Categories
- Frontend & UI Code, Testing & QA, Code Review & Quality
More from alleneubank/claude-code
All 8Similar to Typescript Best Practices
More Frontend & UI Code
typescript-corebobmatnyc/claude-mpm-skills494 installsModern TypeScript patterns with a strict tsconfig baseline, runtime validation choices, and TS 5.2+ features.
zodpproenca/dot-skills7.3K installsBest-practice rules for Zod schema definition, safe parsing, type inference, and error handling in TypeScript.
mastering-typescriptspillwavesolutions/mastering-typescript-skill813 installsComprehensive TypeScript 5.9+ guide covering generics, mapped types, Zod validation, and React, NestJS, and LangChain.js integration.
typescriptdalestudy/skills452 installsKorean-language TypeScript skill that enforces inference-first typing, explicit return types, and a ban on any.
typescript-advanced-typeswshobson/agents100.4K installsComprehensive guide to TypeScript's advanced type system for building reusable, compile-time-safe type logic.
zod-schema-validationmindrally/skills1.2K installsPractical Zod guidance for TypeScript schemas, type inference, parsing, forms, and API validation.