typescript-best-practices

typescript best practices

0xbigboss ↓ 2.9k
Claude Code
View source ↗

What it does

  • Define schemas as single source of truth; infer TypeScript types with z.infer<>. Avoid duplicating types and schemas.
  • Use safeParse for user input where failure is expected; use parse at trust boundaries where invalid data is a bug.
  • Compose schemas with .extend(), .pick(), .omit(), .merge() for DRY definitions.
  • Add .transform() for data normalization at parse time (trim strings, parse dates).
  • Opaque<T, Token> - cleaner branded types than manual & { brand } pattern
  • PartialDeep<T> - recursive partial for nested objects
  • ReadonlyDeep<T> - recursive readonly for immutable data

Requirements & configuration

  • Opaque<T, Token> - cleaner branded types than manual & { brand } pattern

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

typescript best practices

Source

Repository: https://github.com/0xbigboss/claude-code

typescript-best-practices FAQ

What does the typescript-best-practices skill do?

Use when reading or writing TypeScript or JavaScript files (.ts, .tsx, .js, tsconfig.json). Define schemas as single source of truth; infer TypeScript types with z.infer<>. Avoid duplicating types and schemas. Use safeParse for user input where failure is expected; use parse at trust boundaries where invalid data is a bug.

What does typescript-best-practices require?

Opaque<T, Token> - cleaner branded types than manual & { brand } pattern

How do I install typescript-best-practices?

Run: npx -y skills add https://github.com/0xbigboss/claude-code --skill typescript-best-practices --agent claude-code — the source lives at github.com/0xbigboss/claude-code.

Maintain typescript-best-practices?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[typescript-best-practices on getagentictools](https://getagentictools.com/skills/0xbigboss-claude-code-typescript-best-practices?ref=badge)
npx agentictools info skills/0xbigboss-claude-code-typescript-best-practices

The second line is the CLI lookup for this page — handy in READMEs and docs.