typescript

Applies 45 prioritized TypeScript rules for compiler performance, type safety, and async patterns.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/yamcodes/the-hat --skill typescript-yamcodes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/yamcodes/the-hat/tree/main/skills/typescript
Command: npx skills add https://github.com/yamcodes/the-hat --skill typescript-yamcodes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? TypeScript projects often suffer from slow compilation, exponential type-checking costs, runtime errors from unsafe types, and memory leaks. This Skill provides a curated, impact-prioritized rule set that guides automated refactoring and code generation toward faster builds and safer code. ## Core Features & Use Cases - Type System Performance: Rules to avoid deep generics, large unions, and complex mapped types that cause quadratic compile times. - Compiler Configuration: Guidance on tsconfig.json settings like incremental compilation, skipLibCheck, project references, and isolatedModules for 50-90% faster builds. - Async, Module & Memory Patterns: Covers Promise.all parallelization, barrel file avoidance, type-only imports, WeakMap usage, and event listener cleanup. - Use Case: When a build takes minutes due to misconfigured tsconfig or deeply nested generics, apply these rules to cut compile time and eliminate TS errors like TS2322 and TS2339. ## Quick Start Review my TypeScript project for performance issues and apply the relevant optimization rules to speed up compilation and fix type errors.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I speed up TypeScript compilation in a large project?▼

Enable incremental compilation, skipLibCheck, and project references in tsconfig.json for 50-90% faster rebuilds. Also configure include/exclude properly to prevent scanning unnecessary files, and use isolatedModules for faster single-file transpilation with bundlers.

How to fix slow TypeScript type checking with generics?▼

Avoid deeply nested generic types and large union types, which cause exponential instantiation and quadratic comparison costs. Extract conditional types to named aliases to enable compiler caching, and prefer interfaces over type intersections for 2-5× faster resolution.

Should I use interfaces or type intersections in TypeScript?▼

Prefer interfaces over type intersections because they resolve 2-5× faster during type checking. Interfaces create named types the compiler caches, while intersections force repeated structural comparison of all members.

Why does await inside a loop cause performance problems?▼

Await inside loops creates N sequential operations, so 10 iterations at 100ms each take 1000ms total. Use Promise.all with map() to run independent operations in parallel, reducing wall-clock time to the slowest single operation.

Does this skill cover TypeScript basics or framework patterns?▼

No, it explicitly excludes TypeScript basics, framework-specific patterns, and testing. It focuses on performance optimization, compiler configuration, type safety, async patterns, and memory management for existing TypeScript code.

When should I use unknown instead of any in TypeScript?▼

Use unknown whenever the type is not known at compile time, such as JSON parsing or API responses. Unlike any, unknown forces explicit type narrowing through type guards before operations, preventing runtime errors from unsafe property access.