language-typescript

Enforce strict TypeScript idioms with unknown, discriminated unions, and async error handling.

2|8|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/lugassawan/swe-workbench --skill language-typescript-lugassawan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: language-typescript
Source: https://github.com/lugassawan/swe-workbench/tree/main/skills/language-typescript
Command: npx skills add https://github.com/lugassawan/swe-workbench --skill language-typescript-lugassawan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid unsafe TypeScript practices by enforcing strict, predictable typing and modern idioms for JavaScript and Node codebases.

Core Features & Use Cases

  • Strict configuration for real type safety: Enable strict compiler options so types don’t silently lie, especially in Node projects using TypeScript.
  • Safer type modeling patterns: Prefer unknown over any, use discriminated unions for exhaustiveness, and apply branded types for domain identifiers like UserId vs OrderId.
  • Reliable async and error handling: Use consistent async patterns with AbortController-based timeouts and typed boundary error handling to prevent swallowed failures.

Quick Start

Ask an AI assistant to review your TypeScript code and propose concrete changes to enforce strict mode, replace any with safer alternatives, and improve discriminated union handling for your API responses.

Frequently Asked Questions about language-typescript

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

FAQPage Schema
How do I enforce strict TypeScript compiler settings to prevent unsafe type assertions?

Use discriminated unions in TypeScript to model API payloads by defining a shared literal property across object types. This allows exhaustive type checking, ensuring all possible response states are handled safely without relying on unsafe any casts.

What is the best way to replace any with unknown in TypeScript API payload modeling?

The best way to replace any with unknown in TypeScript is to use the unknown type for boundary data like API payloads. This forces explicit type narrowing before accessing properties, preventing silent runtime failures caused by assumed type shapes.

How do I implement async patterns with AbortController for fetch timeouts in Node.js?

To implement async patterns with AbortController for fetch timeouts in Node.js, create an AbortController instance and pass its signal to the fetch request. This ensures reliable async handling by canceling pending requests and preventing swallowed boundary errors.

Does this strict TypeScript approach work with React and TSX codebases?

Yes, this strict TypeScript approach works with React and TSX codebases. The strict typing idioms, including discriminated unions and unknown types, apply directly to component props and state management to prevent unpredictable runtime behavior in TSX files.

Why does using branded types for domain identifiers improve type safety in TypeScript?

Using branded types for domain identifiers improves type safety in TypeScript by creating distinct types for primitives like UserId and OrderId. This prevents accidental cross-assignment of structurally identical types, eliminating brittle domain logic errors at compile time.