AI AGENT ADDONS

Typescript Best Practices

0xbigboss/claude-code

Writing strong TypeScript code is easier with these best practices. The type system helps catch errors before your code runs. This skill focuses on using types to avoid bugs and write cleaner code.

One key idea is to make impossible states impossible. Use discriminated unions to represent different states like loading, success, or error. Use branded types to keep different IDs separate. An exhaustive switch with a never check ensures you handle every case.

For data from the outside world, use Zod to validate and parse input. Zod lets you define a single source of truth for your data shape and infer the TypeScript type. Use safeParse for user input and parse for trusted data to enforce correctness.

Add Typescript Best Practices skill to your workflow

Global

mkdir -p ~/.claude/skills/typescript-best-practices

Project

mkdir -p .claude/skills/typescript-best-practices

Source Repository

Stars
51
Forks
7
Watchers
51
License
Apache-2.0
Last Push
27 days ago
Created
1 year ago