Typescript Best Practices
Provides TypeScript patterns for type-first development, making illegal states unrepresentable, exhaustive handling, and runtime validation. Must use when reading or writing TypeScript/JavaScript files.
Install
npx skills add NeverSight/learn-skills.dev --skill typescript-best-practicesgit clone --depth 1 https://github.com/NeverSight/learn-skills.dev.git /tmp/learn-skills.dev
mkdir -p ~/.claude/skills
cp -r /tmp/learn-skills.dev/data/skills-md/0xbigboss/claude-code/typescript-best-practices ~/.claude/skills/typescript-best-practicesPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# TypeScript Best Practices
## 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.
## Type-First Development
Types define the contract before implementation. Follow this workflow:
1. **Define the data model** - types, interfaces, and schemas first
2. **Define function signatures** - input/output types before logic
3. **Implement to satisfy types** - let the compiler guide completeness
4. **Validate at boundaries** - runtime checks where data enters the system
### Make Illegal States Unrepresentable
Use the type system to prevent invalid states at compile time.
**Discriminated unions for mutually exclusive states:**
```ts
// 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:**Details
- Skill name
typescript-best-practices- Repository
- NeverSight/learn-skills.dev
- Path
data/skills-md/0xbigboss/claude-code/typescript-best-practices/SKILL.md- Repo updated
- 18 November 2026
FAQ
What does the Typescript Best Practices skill do?
Provides TypeScript patterns for type-first development, making illegal states unrepresentable, exhaustive handling, and runtime validation. Must use when reading or writing TypeScript/JavaScript files.
How do I install the Typescript Best Practices skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add NeverSight/learn-skills.dev --skill typescript-best-practices. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Typescript Best Practices popular?
It lives in NeverSight/learn-skills.dev, which has 223 GitHub stars and 42 forks.
Related skills
Council
223NeverSight/learn-skills.dev
Convene the Council of High Intelligence — multi-persona deliberation with historical thinkers for deeper analysis of complex problems.
Megaeth Developer
223NeverSight/learn-skills.dev
End-to-end MegaETH development playbook (Feb 2026). Covers wallet operations, token swaps (Kyber Network), eth_sendRawTransactionSync (EIP-7966) for instant receipts, JSON-RPC batching, real-time mini-block subscriptions, storage-aware contract patterns (Solady RedBlackTreeLib), MegaEVM gas model, WebSocket keepalive, bridging from Ethereum, and debugging with mega-evme. Use when building on MegaETH, managing wallets, sending transactions, or deploying contracts.
Openclaw Stock Skill
223NeverSight/learn-skills.dev
使用 data.diemeng.chat 提供的接口查询股票日线、分钟线、财务指标等数据,支持 A 股等市场。
Typescript Pro
121theguysudo/ENZO
Implements advanced TypeScript type systems, creates custom type guards, utility types, and branded types, and configures tRPC for end-to-end type safety. Use when building TypeScript applications requiring advanced generics, conditional or mapped types, discriminated unions, monorepo setup, or full-stack type safety with tRPC.
Trails
223NeverSight/learn-skills.dev
Integrate Trails cross-chain infrastructure — Widget, Headless SDK, or Direct API
Viem
223NeverSight/learn-skills.dev
TypeScript patterns for low-level EVM blockchain interactions using Viem. Use when writing Node scripts, CLI tools, or backend services that read/write to Ethereum or EVM chains. Triggers on contract interactions, wallet operations, transaction signing, event watching, ABI encoding, or any non-React blockchain TypeScript code. Do NOT use for React/Next.js apps with hooks (use wagmi skill instead).
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.