TypeScript Best Practices

•
94
•

Enforces high-quality TypeScript conventions including strict type safety, efficient promise handling, and robust type narrowing.

This skill provides a comprehensive set of specialized TypeScript guidelines designed to improve code maintainability and runtime reliability within the Claude Code environment. It automates best practices such as eliminating redundant optional chaining after type narrowing, implementing discriminated unions for clear success/failure outcomes, and ensuring type assertions occur at the point of origin. By prioritizing 'unknown' over 'any' and standardizing asynchronous cleanup with .finally(), it helps developers build type-safe data pipelines and complex backend services with fewer bugs and cleaner logic.

主な機能

01Promotion of 'unknown' types for safer generic container handling
02Discriminated union patterns for safer function return types
0394 GitHub stars
04Standardized promise cleanup patterns using .finally()
05Context-aware type narrowing and property access optimization
06Early-point type casting to prevent type-leakage across call sites

ユースケース

01Refactoring legacy JavaScript or loosely-typed TypeScript into strict, type-safe code
02Standardizing asynchronous logic and error handling across large-scale TypeScript projects
03Building resilient data transformation pipelines where type accuracy is critical