typescript-best-practices

Apply TypeScript best practices for strict type checks and async error handling.

Updated Jan 2, 2026
One-click install
npx skills add https://github.com/nategarelik/claude-code-config --skill typescript-best-practices-nategarelik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-best-practices
Source: https://github.com/nategarelik/claude-code-config/tree/main/skills/language/typescript-best-practices
Command: npx skills add https://github.com/nategarelik/claude-code-config --skill typescript-best-practices-nategarelik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides practical TypeScript patterns to improve type safety, reduce runtime errors, and promote modern idioms across projects.

Core Features & Use Cases

  • Strict Types: Enforce non-null handling, prefer unknown over any, and implement robust type guards to improve reliability.
  • Async Patterns: Provide safe asynchronous flows with proper error handling, retries where appropriate, and clear handling of parallel operations.
  • Discriminated Unions & Utility Types: Use strong type narrowing and common TypeScript utilities to express intent clearly, enabling safer state machines and data shapes.

Quick Start

Start by reviewing the TypeScript best-practice examples and integrating strict types, safe JSON handling, and union-based patterns into your codebase.

Frequently Asked Questions about typescript-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I improve type safety and reduce runtime errors in TypeScript?

To improve TypeScript type safety, enforce strict non-null checks, prefer unknown over any, and implement robust type guards. These patterns reduce runtime errors and promote modern idioms across frontend and backend contexts.

What is the best way to handle async errors and parallel operations in TypeScript?

The best way to handle async errors in TypeScript is to implement safe asynchronous flows with proper error handling, retries where appropriate, and clear management of parallel operations to ensure robust execution.

How do I use discriminated unions for safer state machines in TypeScript?

Use discriminated unions in TypeScript to achieve strong type narrowing and express data shapes clearly. This enables safer state machines and robust data handling by clearly defining distinct object states.

Do I need established TypeScript tooling and conventions to apply these code quality patterns?

Yes, integrating these TypeScript code quality patterns requires established TypeScript tooling support and conventions within your codebase to effectively guide usage and enforce strict type checks.

How do I safely handle JSON data parsing in TypeScript?

Safely handle JSON data in TypeScript by applying safe JSON handling patterns alongside strict type guards. This ensures parsed data is rigorously validated and narrowed to prevent runtime type mismatches.