
Typescript Best Practices
Teaches you to use TypeScript's type system to make invalid states impossible at compile time. You'll write discriminated unions instead of boolean soup, use branded types to prevent mixing up IDs, and enforce exhaustive switch statements with never checks. The Zod section is practical: schema as source of truth, safeParse for user input, parse at API boundaries. It assumes you know TypeScript syntax already and focuses on patterns that prevent bugs before runtime. If you're still writing types with a bunch of optional fields and crossing your fingers, this will change how you model data.
- skills.sh installs
- 2.9K
- GitHub stars
- 51
- last updated
- Jul 14, 2026
Install
$ npx -y skills add 0xbigboss/claude-code --skill typescript-best-practices --agent claude-codeInstalls into .claude/skills of the current project.
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' };
Sponsors
Details
- Repository
- github.com/0xbigboss/claude-code
More from 0xbigboss/claude-code
All 22- Python Best Practices1.8K
- Web Fetch929
- Zig Best Practices388
- Nix Best Practices359
- Tamagui Best Practices290
- Openai Image Gen288
- Go Best Practices272
- Playwright Best Practices266
- Axe Ios Simulator239
- Electrobun Best Practices209
- Tilt196
- Orbstack Best Practices180
- Canton Network Repos157
- Ios Device Screenshot155
- Atlas Best Practices154
- Git Best Practices149
- Git Rebase Sync146
- Testing Best Practices135
- E2e126
- Extract Transcripts122
- React Best Practices3K